<commit_before>/* globals console */

/*
 * Copyright (c) $year, <NAME> (DNT)
 *
 * https://github.com/Turistforeningen/turadmin
 */

define(function (require, exports, module) {
    "use strict";

    // Dependencies
    var $ = require('jquery'),
        _ = require('underscore'),
        Backbone = require('backbone'),
        state = require('state');

    var objects = {};
    var objectType;
    var currentOwnerId;
    var $list = $('#objects ul');

    var onObjectFetch = function (data, textStatus, jqXhr) {
        var $li = $('li[data-id="' + data._id + '"]');
        objects[data._id] = data;
        $li.html('<span class="done"></span>' + data.navn);
    };

    var  onObjectPatch = function (data, textStatus, jqXhr) {
        var id = this.url.split('/').reverse()[0];
        $('li[data-id="'+ id +'"] span').html('&#10004;');
    };

    $('#current-owner button').on('click', function () {
        currentOwnerId = $('#current-owner input').val();
        objectType = $('#current-owner select').val();

        $.ajax({
            url: '/restProxy/' + objectType + '/',
            data: 'privat.opprettet_av.id=' + currentOwnerId + '&limit=50&fields=navn,privat',
            processData: false,
            dataType: 'json',
            success: function (data, textStatus, jqXhr) {
                $list.html('');
                objects = {};

                if (data.documents && data.documents.length) {
                    for (var i = 0; i < data.documents.length; i++) {
                        var object = data.documents[i];

                        var $li = '<li data-id="' + object._id + '">' + object.navn + ' -  Henter detaljer... <span style="color: red; font-weight: bold;">Vennligst vent til alle er ferdige</span></li>';
                        $list.append($li);

                        $.ajax({
                            url: '/restProxy/' + objectType + '/' + object._id,
                            data: 'fields=navn,privat',
                            processData: false,
                            dataType: 'json',
                            success: onObjectFetch
                        });

                    }<commit_msg>encodeURIComponent id to add support for changing owner for turforslag still owned by NRK users<commit_after>/* globals console */

/*
 * Copyright (c) $year, <NAME> (DNT)
 *
 * https://github.com/Turistforeningen/turadmin
 */

define(function (require, exports, module) {
    "use strict";

    // Dependencies
    var $ = require('jquery'),
        _ = require('underscore'),
        Backbone = require('backbone'),
        state = require('state');

    var objects = {};
    var objectType;
    var currentOwnerId;
    var $list = $('#objects ul');

    var onObjectFetch = function (data, textStatus, jqXhr) {
        var $li = $('li[data-id="' + data._id + '"]');
        objects[data._id] = data;
        $li.html('<span class="done"></span>' + data.navn);
    };

    var  onObjectPatch = function (data, textStatus, jqXhr) {
        var id = this.url.split('/').reverse()[0];
        $('li[data-id="'+ id +'"] span').html('&#10004;');
    };

    $('#current-owner button').on('click', function () {
        currentOwnerId = $('#current-owner input').val();
        objectType = $('#current-owner select').val();

        $.ajax({
            url: '/restProxy/' + objectType + '/',
            data: 'privat.opprettet_av.id=' + encodeURIComponent(currentOwnerId) + '&limit=50&fields=navn,privat',
            processData: false,
            dataType: 'json',
            success: function (data, textStatus, jqXhr) {
                $list.html('');
                objects = {};

                if (data.documents && data.documents.length) {
                    for (var i = 0; i < data.documents.length; i++) {
                        var object = data.documents[i];

                        var $li = '<li data-id="' + object._id + '">' + object.navn + ' -  Henter detaljer... <span style="color: red; font-weight: bold;">Vennligst vent til alle er ferdige</span></li>';
                        $list.append($li);

                        $.ajax({
                            url: '/restProxy/' + objectType + '/' + object._id,
                            data: 'fields=navn,privat',
                            processData: false,
                            dataType: 'json',
                            success: onObjectFetch
                        });

                    }
{'fraction_non_alphanumeric': 0.16651785714285713, 'fraction_numerical': 0.0040178571428571425, 'mean_word_length': 1.7240121580547112, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5267226', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1249, 'n_words': 280}