<commit_before>locale.fr = {
    modes: {
        add_area: {
            title: "Polygone",
            description: "Les polygones peuvent être des parcs, des batîments, des lacs ou tout autre objet surfacique.",
            tail: "Cliquez sur la carte pour ajouter un polygone tel qu'un parc, un lac ou un bâtiment."
        },
        add_line: {
            title: "Ligne",
            description: "Les lignes peuvent être des autoroutes, des routes, des chemins ou encore des caneaux.",
            tail: "Cliquez sur la carte pour ajouter une nouvelle ligne telle qu'une route ou un nouveau chemin."
        },
        add_point: {
            title: "Point",
            description: "Les points peuvent être des restaurants, des monuments, ou encore des boites aux lettres.",
            tail: "Cliquez sur la carte pour ajouter un point tel qu'un restaurant ou un monument."
        },
        browse: {
            title: "Navigation",
            description: "Naviguer ou zoomer sur la carte."
        },
        draw_area: {
            tail: "Cliquez pour ajouter un point à la zone. Cliquez sur le dernier point pour fermer la zone."
        },
        draw_line: {
            tail: "Cliquez pour ajouter un point à la ligne. Cliquez sur une autre ligne pour les connecter, puis faîtes un double-clique pour terminer la ligne."
        }
    },

    operations: {
        add: {
            annotation: {
                point: "Ajouter un point.",
                vertex: "Ajouter un noeud à une ligne."
            }
        },
        start: {
            annotation: {
                line: "Commencer une nouvelle ligne.",
                area: "Commencer un polygone."
            }
        },
        'continue': {
            annotation: {
                line: "Continuer une ligne.",
                area: "Continuer un polygone."
            }
        },
        cancel_draw: {
            annotation: "Annuler un ajout."
        },
        change_tags: {
            annotation: "Modifier les tags."
        },
        circularize: {
            title: "Circularize",
            description: "Créer un cercle.",
            key: "O",
            annotation: {
                line: "Créer un cercle linéaire.",
                area: "Créer un cercle surfacique (disque)."
            }
        },
        orthogonalize: {
            title: "Orthogonaliser",
            description: "Rendre une forme orthogonale.",
            key: "Q",
            annotation: {
                line: "Orthogonaliser une ligne orthogonale.",
                area: "Orthogonaliser un polygone orthogonale."
            }
        },
        'delete': {
            title: "Supprimer",
            description: "Supprime l'élément de la carte.",
            key: "⌫",
            annotation: {
                point: "Supprime un point.",
                vertex: "Supprime le noeud d'une ligne.",
                line: "Supprime une ligne.",
                area: "Supprime un polygone.",
                relation: "Supprime une relation.",
                multiple: "Supprime {n} objets."
            }
        },
        connect: {
            annotation: {
                point: "Joindre une ligne à un point.",
                vertex: "Joindre les noeuds à une ligne.",
                line: "Joindre les chemins ensemble.",
                area: "Joindre une ligne à un polygone."
            }
        },
        disconnect: {
            title: "Séparer",
            description: "Sépare les lignes l'une de l'autre.",
            key: "D",
            annotation: "Sépare les lignes."
        },
        merge: {
            title: "Fusionner",
            description: "Fusionne les lignes.",
            key: "C",
            annotation: "Fusionne les {n} ligne."
        },
        move: {
            title: "Déplacer",
            description: "Déplace l'élément à un autre endroit.",
            key: "M",
            annotation: {
                point: "Déplace un point.",
                vertex: "Déplace le noeud d'une ligne.",
                line: "Déplace une ligne.",
                area: "Déplace un polygone."
            }
        },
        reverse: {
            title: "Inverser",
            description: "Inverse le sens d'une ligne.",
            key: "V",
            annotation: "Inverse le sens d'une ligne."
        },
        split: {
            title: "Couper",
            description: "Coupe une ligne en deux par rapport au point sélectionné.",
            key: "X",
            annotation: "Coupe une ligne."
        }
    },

    nothing_to_undo: "Rien à annuler.",
    nothing_to_redo: "Rien à refaire.",

    just_edited: "Vous venez de participer à OpenStreetMap!",
    browser_notice: "Les navigateurs supportés par cet éditeur sont : Firefox, Chrome, Safari, Opera et Internet Explorer (version 9 et supérieures). Pour éditer la carte, veuillez mettre à jour votre navigateur ou utiliser Potlatch 2.",
    view_on_osm: "Consulter dans OSM",
    zoom_in_edit: "Zoomer pour modifier la carte",
    logout: "Déconnexion",
    report_a_bug: "Signaler un bug",

    commit: {
        title: "Save Changes",
        description_placeholder: "Brief description of your contributions",
        upload_explanation: "The changes you upload as {user} will be visible on all maps that use OpenStreetMap data.",
        save: "Save",
        cancel: "Cancel",
        warnings: "Warnings",
        modified: "Modified",
        deleted: "Deleted",
        created: "Created"
    },

    contributors: {
        list: "Consulter les contributions de {users}",
        truncated_list: "Consulter les contributions de {users} et {count} les autres"
    },

    geocoder: {
        title: "Trouver un emplacement",
        placeholder: "Trouver un endroit",
        no_results: "Impossible de localiser l'endroit nommé '{name}'"
    },

    geolocate: {
        title: "Show My Location"
    },

    inspector: {
        no_documentation_combination:  "Aucune documentation n'est disponible pour cette combinaison de tag",
        no_documentation_key: "Aucune documentation n'est disponible pour cette clé",
        new_tag: "Nouveau tag",
        edit_tags: "Editer les tags",
        okay: "Okay",
        view_on_osm: "View on OSM"
    },

    layerswitcher: {
        title: "Fond de carte",
        description: "Paramètres du fond de carte",
        percent_brightness: "{opacity}% brightness",
        fix_misalignment: "Fix misalignment",
        reset: "reset"
    },

    restore: {
        description: "You have unsaved changes from a previous editing session. Do you wish to restore these changes?",
        restore: "Restore",
        reset: "Reset"
    },

    save: {
        title: "Sauvegarder",
        help: "Envoie des modifications au serveyr OpenStreetMap afin qu'elles soient visibles par les autres contributeurs.",
        error: "Une erreur est survenue lors de l'enregistrement des données",
        uploading: "Envoie des modifications vers OpenStreetMap.",
        unsaved_changes: "Vous avez des modifications non enregistrées"
    },

    splash: {
        welcome: "Welcome to the iD OpenStreetMap editor",
        text: "This is development version {version}. For more information see {website} and report bugs at {github}."
    },

    source_switch: {
        live: "live",
        dev: "dev"
    },

    tag_reference: {
        description: "Déscription",
        on_wiki: "{tag} on wiki.osm.org",
        used_with: "used with {type}"
    },

    validations: {
        untagged_point: "Point sans aucun tag ne faisant partie ni d'une ligne, ni d'un polygone",
        untagged_line: "Ligne sans aucun tag",
        untagged_area: "Polygone sans aucun tag",
        tag_suggests_area: "Ce tag {tag} suppose que cette ligne devrait être un polygone, or ce n'est pas le cas",
        deprecated_tags: "Tags obsolètes : {tags}"
    },

    zoom: {
        in: "Zoomer",
        out: "Dézoomer"
    }
};
<commit_msg>Update locale/fr.js<commit_after>locale.fr = {
    modes: {
        add_area: {
            title: "Polygone",
            description: "Les polygones peuvent être des parcs, des batîments, des lacs ou tout autre objet surfacique.",
            tail: "Cliquez sur la carte pour ajouter un polygone tel qu'un parc, un lac ou un bâtiment."
        },
        add_line: {
            title: "Ligne",
            description: "Les lignes peuvent être des autoroutes, des routes, des chemins ou encore des caneaux.",
            tail: "Cliquez sur la carte pour ajouter une nouvelle ligne telle qu'une route ou un nouveau chemin."
        },
        add_point: {
            title: "Point",
            description: "Les points peuvent être des restaurants, des monuments, ou encore des boites aux lettres.",
            tail: "Cliquez sur la carte pour ajouter un point tel qu'un restaurant ou un monument."
        },
        browse: {
            title: "Navigation",
            description: "Naviguer ou zoomer sur la carte."
        },
        draw_area: {
            tail: "Cliquez pour ajouter un point à la zone. Cliquez sur le dernier point pour fermer la zone."
        },
        draw_line: {
            tail: "Cliquez pour ajouter un point à la ligne. Cliquez sur une autre ligne pour les connecter, puis faîtes un double-clique pour terminer la ligne."
        }
    },

    operations: {
        add: {
            annotation: {
                point: "Ajouter un point.",
                vertex: "Ajouter un noeud à une ligne."
            }
        },
        start: {
            annotation: {
                line: "Commencer une nouvelle ligne.",
                area: "Commencer un polygone."
            }
        },
        'continue': {
            annotation: {
                line: "Continuer une ligne.",
                area: "Continuer un polygone."
            }
        },
        cancel_draw: {
            annotation: "Annuler un ajout."
        },
        change_tags: {
            annotation: "Modifier les tags."
        },
        circularize: {
            title: "Circularize",
            description: "Créer un cercle.",
            key: "O",
            annotation: {
                line: "Créer un cercle linéaire.",
                area: "Créer un cercle surfacique (disque)."
            }
        },
        orthogonalize: {
            title: "Orthogonaliser",
            description: "Rendre une forme orthogonale.",
            key: "Q",
            annotation: {
                line: "Orthogonaliser une ligne orthogonale.",
                area: "Orthogonaliser un polygone orthogonale."
            }
        },
        'delete': {
            title: "Supprimer",
            description: "Supprime l'élément de la carte.",
            key: "⌫",
            annotation: {
                point: "Supprime un point.",
                vertex: "Supprime le noeud d'une ligne.",
                line: "Supprime une ligne.",
                area: "Supprime un polygone.",
                relation: "Supprime une relation.",
                multiple: "Supprime {n} objets."
            }
        },
        connect: {
            annotation: {
                point: "Joindre une ligne à un point.",
                vertex: "Joindre les noeuds à une ligne.",
                line: "Joindre les chemins ensemble.",
                area: "Joindre une ligne à un polygone."
            }
        },
        disconnect: {
            title: "Séparer",
            description: "Sépare les lignes l'une de l'autre.",
            key: "D",
            annotation: "Sépare les lignes."
        },
        merge: {
            title: "Fusionner",
            description: "Fusionne les lignes.",
            key: "C",
            annotation: "Fusionne les {n} ligne."
        },
        move: {
            title: "Déplacer",
            description: "Déplace l'élément à un autre endroit.",
            key: "M",
            annotation: {
                point: "Déplace un point.",
                vertex: "Déplace le noeud d'une ligne.",
                line: "Déplace une ligne.",
                area: "Déplace un polygone."
            }
        },
        reverse: {
            title: "Inverser",
            description: "Inverse le sens d'une ligne.",
            key: "V",
            annotation: "Inverse le sens d'une ligne."
        },
        split: {
            title: "Couper",
            description: "Coupe une ligne en deux par rapport au point sélectionné.",
            key: "X",
            annotation: "Coupe une ligne."
        }
    },

    nothing_to_undo: "Rien à annuler.",
    nothing_to_redo: "Rien à refaire.",

    just_edited: "Vous venez de participer à OpenStreetMap!",
    browser_notice: "Les navigateurs supportés par cet éditeur sont : Firefox, Chrome, Safari, Opera et Internet Explorer (version 9 et supérieures). Pour éditer la carte, veuillez mettre à jour votre navigateur ou utiliser Potlatch 2.",
    view_on_osm: "Consulter dans OSM",
    zoom_in_edit: "Zoomer pour modifier la carte",
    logout: "Déconnexion",
    report_a_bug: "Signaler un bug",

    commit: {
        title: "Sauvegarder vos modifications",
        description_placeholder: "Description succinte de vos contributions",
        upload_explanation: "{user} : les modifications apportées seront visibles par l'ensemble des services utilisant les données d'OpenStreetMap.",
        save: "Sauvegarder",
        cancel: "Annuler",
        warnings: "Attention",
        modified: "Modifié",
        deleted: "Supprimé",
        created: "Créé"
    },

    contributors: {
        list: "Consulter les contributions de {users}",
        truncated_list: "Consulter les contributions de {users} et {count} les autres"
    },

    geocoder: {
        title: "Trouver un emplacement",
        placeholder: "Trouver un endroit",
        no_results: "Impossible de localiser l'endroit nommé '{name}'"
    },

    geolocate: {
        title: "Show My Location"
    },

    inspector: {
        no_documentation_combination:  "Aucune documentation n'est disponible pour cette combinaison de tag",
        no_documentation_key: "Aucune documentation n'est disponible pour cette clé",
        new_tag: "Nouveau tag",
        edit_tags: "Editer les tags",
        okay: "Okay",
        view_on_osm: "View on OSM"
    },

    layerswitcher: {
        title: "Fond de carte",
        description: "Paramètres du fond de carte",
        percent_brightness: "{opacity}% brightness",
        fix_misalignment: "Fix misalignment",
        reset: "reset"
    },

    restore: {
        description: "Vous avez des changements d'une précédente édition non sauvegardés. Souhaitez-vous restaurer ces changements?",
        restore: "Restaurer",
        reset: "Annuler"
    },

    save: {
        title: "Sauvegarder",
        help: "Envoie des modifications au serveyr OpenStreetMap afin qu'elles soient visibles par les autres contributeurs.",
        error: "Une erreur est survenue lors de l'enregistrement des données",
        uploading: "Envoie des modifications vers OpenStreetMap.",
        unsaved_changes: "Vous avez des modifications non enregistrées"
    },

    splash: {
        welcome: "Bienvenue sur ID l'editeur en ligne d'OpenStreetMap",
        text: "Cette version {version}, est une version de développement. Si vous souhaitez plus d'informations, veuillez consulter {website} ou pour signaler un bug   {github}."
    },

    source_switch: {
        live: "live",
        dev: "dev"
    },

    tag_reference: {
        description: "Déscription",
        on_wiki: "{tag} sur le wiki.osm.org",
        used_with: "Utilisé avec {type}"
    },

    validations: {
        untagged_point: "Point sans aucun tag ne faisant partie ni d'une ligne, ni d'un polygone",
        untagged_line: "Ligne sans aucun tag",
        untagged_area: "Polygone sans aucun tag",
        tag_suggests_area: "Ce tag {tag} suppose que cette ligne devrait être un polygone, or ce n'est pas le cas",
        deprecated_tags: "Tags obsolètes : {tags}"
    },

    zoom: {
        in: "Zoomer",
        out: "Dézoomer"
    }
};
<|endoftext|>


<commit_before>/*!
* Turkuaz Css v1.0.0
* www.turkuazcss.com
* MIT Lisansi (https://raw.githubusercontent.com/TurkuazCss/Framework/master/LICENSE)
* Roboto Yazi Stili (https://fonts.google.com/specimen/Roboto)
*/
/*!
*    Turkuaz Css - JavaScript Kod Duzeni
*
*    1.     Ortak Fonksiyonlar
*    2.     Renk Gecisi
*    3.     Etiket Kapat
*    4.     Input Uzunluk
*    5.     Textarea Otomatik Yukseklik
*    6.     Range Input
*    7.     Modal
*    8.     Select
*    9.     Popovers
*    10.     Mobil Menu
*    11.    Tab Menu
*    12.    Akordiyon Menu
*
*/
/* ============= 1. Ortak Fonksiyonlar  */

function fadeIn(el, duration, display) {
    var s = el.style, step = 25/(duration || 1000);
    s.opacity = s.opacity || 0;
    s.display = display || "inline-block";
    (function fade() { (s.opacity = s.opacity+step) > 0.5 ? s.opacity = 0.5 : setTimeout(fade, 25); })();
}

function fadeOut(el, duration) {
    var s = el.style, step = 25/(duration || 1000);
    s.opacity = s.opacity || 1;
    (function fade() {(s.opacity -= step) < 0 ? s.display = "none" : setTimeout(fade, 25); })();
}

/* ============= 2. Renk Gecisi  */

var gradient = document.querySelectorAll("[tr-gradient]");
Array.prototype.forEach.call(gradient, function(el, i) {
	var attributeValue = el.attributes["0"].value;
	el.style.backgroundImage = "linear-gradient(to " + attributeValue + ")";
});

/* ============= 3. Etiket Kapat  */

var tag = document.querySelectorAll(".etiket.kapat");
Array.prototype.forEach.call(tag, function(el, i) {
    var span = document.createElement("span");
    span.className += "etiket-kaldir";
    span.innerHTML = "&times";
    el.appendChild(span);
    tag[i].addEventListener("click", function() {
        el.remove();
    }, false);
});

/* ============= 4. Input Uzunluk  */

var inputLength = document.querySelectorAll("input[data-uzunluk]");
Array.prototype.forEach.call(inputLength, function(el, i) {
    inputLength[i].addEventListener("keyup", function() {
    	var maxLenght = el.getAttribute("data-uzunluk");
    	var currentLenght = el.value.length;
    	var span = el.parentNode.getElementsByTagName("span")[0];

    	if(typeof span == "undefined")
    	{
    		span = document.createElement("span");
    		el.parentNode.appendChild(span);
    	}

    	span.innerHTML = currentLenght  + '/' + maxLenght;

    	if(currentLenght > maxLenght)
    	{
    		el.style["border-bottom-color"] = "#F44336";
    	}
    	else if (currentLenght == 0) {
    		span.remove();
    		el.style["border-bottom-color"] = "";
    	}
    	else
    	{
    		el.style["border-bottom-color"] = "#03968A";
    	}
    }, false);
});

/* ============= 5. Textarea Otomatik Yukseklik  */

var textarea = document.getElementsByClassName("tr-textarea");
Array.prototype.forEach.call(textarea, function(el) {
    el.addEventListener("keyup", function () {
        var lineCount = el.value.split(/\r|\r\n|\n/).length;
        var newHeight = ++lineCount * 1.2;
        el.style.height = (lineCount > 4) ? newHeight.toString() + "em" : "6em";
    }, false);
});

/* ============= 6. Range Input  */

var range = document.querySelectorAll("input[type='range'].tr-range");
Array.prototype.forEach.call(range, function(el, i) {
	var rangeChange = function (){
		var span = el.parentNode.querySelector(".range-deger");
		var spanWidth = span.offsetWidth;
		var rangeMax = el.max;
		var rangeValue = el.value;
		var rangeWidth = el.offsetWidth - (spanWidth/2);
		span.innerHTML = rangeValue;
		span.style.left = Math.ceil(rangeWidth/rangeMax*rangeValue) + "px";
	}
	el.addEventListener("mousemove", function () {
		rangeChange();
	}, false);
	el.addEventListener("change", function () {
		rangeChange();
	}, false);
});

/* ============= 7. Modal  */

var overlay = document.createElement("div");
overlay.className += "tr-karart modal";

var modal = document.querySelectorAll(".modal");
Array.prototype.forEach.call(modal, function(el, i) {
    modal[i].addEventListener("click", function(e) {
        e.preventDefault();
        var href = el.getAttribute("href");
        var modalTarget = document.getElementById(href);
        modalTarget.classList.add("goster");
        var overlayCount = document.querySelectorAll(".tr-karart").length;
        if(!overlayCount) {
            document.body.appendChild(overlay);
        }
        fadeIn(overlay);
    }, false);
});

function trModalClose(target = ".tr-modal a.kapat") {
    var modals = document.querySelectorAll(target);
    Array.prototype.forEach.call(modals, function(el, i) {
        modals[i].addEventListener("click", function(e) {
            e.preventDefault();
            overlay.click();
        }, false);
    });
}
trModalClose();

overlay.addEventListener("click", function() {
    var overlayCount = document.querySelectorAll(".tr-karart").length;
    var modalVisible = document.querySelectorAll(".tr-modal.goster")["0"];
    if(overlayCount && typeof modalVisible !== "undefined") {
        fadeOut(overlay);
        modalVisible.classList.remove("goster");
        setTimeout(function(){
            overlay.remove();
        }, 250);
    }
}, false);

/* ============= 8. Select  */

var select = document.querySelectorAll("select");
Array.prototype.forEach.call(select, function(el, i) {
	var options = el.getElementsByTagName("option");
	var optionsLength = options.length;

	var div = document.createElement("div");
	div.className += "tr-dropdown";

	var span = document.createElement("span");
	span.className += "dropdown-secili";
	span.innerHTML = "Seçiniz";

	div.appendChild(span);

	var ul = document.createElement("ul");
	ul.className += "dropdown-icerik";

	for (var j=0; j<optionsLength; j++) {
		var li = document.createElement("li");
		li.innerHTML = options[j].text;
		ul.appendChild(li);
	}

	div.appendChild(ul);
	div.setAttribute("tr-dropdown",i);

	select[i].style.display = "none";

	select[i].parentNode.appendChild(div);
});

var dropdown = document.querySelectorAll(".tr-dropdown");
Array.prototype.forEach.call(dropdown, function(el, i) {
	dropdown[i].addEventListener("click", function(e) {
		e.preventDefault();
		el.classList.toggle("aktif");
	}, false);

	var liContent = dropdown[i].querySelectorAll("ul.dropdown-icerik li");
	var liContentLength = liContent.length;

	var span = dropdown[i].querySelectorAll("span.dropdown-secili");
	Array.prototype.forEach.call(liContent, function(el, i) {
		liContent[i].addEventListener("click", function(e) {
			e.preventDefault();
			for (var k=0; k<liContentLength; k++) {
				el.parentNode.querySelectorAll("li")[k].classList.remove("aktif");
			}
			el.classList.add("aktif");

			var selectText = el.innerHTML;
			var selectIndex = i;
			var whichSelect = span["0"].parentNode.getAttribute("tr-dropdown");
			span[0].textContent = selectText;
			select[whichSelect].selectedIndex = selectIndex;
		}, false);
	});
});

/* ============= 9. Popovers  */

var popovers = document.querySelectorAll(".tr-popovers");
Array.prototype.forEach.call(popovers, function(el, i) {
	el.addEventListener("click", function () {
		el.classList.toggle("aktif");
	}, false);
});

/* ============= 10. Mobil Menu  */

$("nav.mobil li ul, nav.menu li ul").parents("li").addClass("acilir");
$("nav.mobil li.acilir ul").hide();
$("nav.mobil").on("click", "li.acilir>a", function() {
    $(this).parents("li.acilir:first").find("ul:first").slideToggle();
});
$("body").on("click", ".menuac", function() {
    $(this).animate({
        opacity: "0"
    }, 10).parents("body").append("

").find("nav.mobil").scrollTop(0);
    if ($("nav.mobil").hasClass("sag")) {
        $("nav.mobil").animate({
            right: "0"
        });
    }
    else {
        $("nav.mobil").animate({
            left: "0"
        });
    }
});
$("body").on("click", ".tr-karart.menu", function() {
    $(this).remove();
    $(".menuac").delay(400).animate({
        opacity: "1"
    }, 250);
    if ($("nav.mobil").hasClass("sag")) {
        $("nav.mobil").animate({
            right: "-250px"
        });
    }
    else {
        $("nav.mobil").animate({
            left: "-250px"
        });
    }
});

/* ============= 11. Tab Menu  */

var tabMenu =  document.querySelectorAll(".tr-tab");
Array.prototype.forEach.call(tabMenu, function(el, i) {
    var tabs = tabMenu[i].querySelectorAll(".tr-tab nav a");
    var tabContent = tabMenu[i].querySelectorAll(".tab-icerik");
    tabs["0"].classList.add("aktif");
    Array.prototype.forEach.call(tabContent, function(el, i) {
        tabContent[i].style.display = "none";
        tabContent["0"].style.display = "block";
        tabs[i].addEventListener("click", function(e) {
            e.preventDefault();
            Array.prototype.forEach.call(tabs, function(el, i) {
            	el.classList.remove("aktif");
            	tabContent[i].style.display = "none";
            });
            tabs[i].classList.add("aktif");
            tabContent[i].style.display = "block";
        }, false);
    });
});

/* ============= 12. Akordiyon Menu  */
$(".akordiyon-icerik").hide();
$(".tr-akordiyon > .akordiyon-baslik").on("click", function() {
    var t = $(this);
    var i = t.closest(".tr-akordiyon").children(".akordiyon-baslik").index(t);
    if (t.hasClass("aktif")) {
        t.removeClass("aktif").closest(".tr-akordiyon").children(".akordiyon-icerik").slideUp(250);
    } else {
        t.siblings().removeClass("aktif").end().addClass("aktif").closest(".tr-akordiyon").children(".akordiyon-icerik").eq(i).slideDown(250).siblings(".akordiyon-icerik").slideUp(250);
    }
})
<commit_msg> [turkuaz.js] Indentetion Fixment <commit_after>/*!
* Turkuaz Css v1.0.0
* www.turkuazcss.com
* MIT Lisansi (https://raw.githubusercontent.com/TurkuazCss/Framework/master/LICENSE)
* Roboto Yazi Stili (https://fonts.google.com/specimen/Roboto)
*/
/*!
*    Turkuaz Css - JavaScript Kod Duzeni
*
*    1.     Ortak Fonksiyonlar
*    2.     Renk Gecisi
*    3.     Etiket Kapat
*    4.     Input Uzunluk
*    5.     Textarea Otomatik Yukseklik
*    6.     Range Input
*    7.     Modal
*    8.     Select
*    9.     Popovers
*    10.     Mobil Menu
*    11.    Tab Menu
*    12.    Akordiyon Menu
*
*/
/* ============= 1. Ortak Fonksiyonlar  */

function fadeIn(el, duration, display) {
    var s = el.style, step = 25/(duration || 1000);
    s.opacity = s.opacity || 0;
    s.display = display || "inline-block";
    (function fade() { (s.opacity = s.opacity+step) > 0.5 ? s.opacity = 0.5 : setTimeout(fade, 25); })();
}

function fadeOut(el, duration) {
    var s = el.style, step = 25/(duration || 1000);
    s.opacity = s.opacity || 1;
    (function fade() {(s.opacity -= step) < 0 ? s.display = "none" : setTimeout(fade, 25); })();
}

/* ============= 2. Renk Gecisi  */

var gradient = document.querySelectorAll("[tr-gradient]");
Array.prototype.forEach.call(gradient, function(el, i) {
    var attributeValue = el.attributes["0"].value;
    el.style.backgroundImage = "linear-gradient(to " + attributeValue + ")";
});

/* ============= 3. Etiket Kapat  */

var tag = document.querySelectorAll(".etiket.kapat");
Array.prototype.forEach.call(tag, function(el, i) {
    var span = document.createElement("span");
    span.className += "etiket-kaldir";
    span.innerHTML = "&times";
    el.appendChild(span);
    tag[i].addEventListener("click", function() {
        el.remove();
    }, false);
});

/* ============= 4. Input Uzunluk  */

var inputLength = document.querySelectorAll("input[data-uzunluk]");
Array.prototype.forEach.call(inputLength, function(el, i) {
    inputLength[i].addEventListener("keyup", function() {
        var maxLenght = el.getAttribute("data-uzunluk");
        var currentLenght = el.value.length;
        var span = el.parentNode.getElementsByTagName("span")[0];

        if(typeof span == "undefined")
        {
            span = document.createElement("span");
            el.parentNode.appendChild(span);
        }

        span.innerHTML = currentLenght  + '/' + maxLenght;

        if(currentLenght > maxLenght)
        {
            el.style["border-bottom-color"] = "#F44336";
        }
        else if (currentLenght == 0) {
            span.remove();
            el.style["border-bottom-color"] = "";
        }
        else
        {
            el.style["border-bottom-color"] = "#03968A";
        }
    }, false);
});

/* ============= 5. Textarea Otomatik Yukseklik  */

var textarea = document.getElementsByClassName("tr-textarea");
Array.prototype.forEach.call(textarea, function(el) {
    el.addEventListener("keyup", function () {
        var lineCount = el.value.split(/\r|\r\n|\n/).length;
        var newHeight = ++lineCount * 1.2;
        el.style.height = (lineCount > 4) ? newHeight.toString() + "em" : "6em";
    }, false);
});

/* ============= 6. Range Input  */

var range = document.querySelectorAll("input[type='range'].tr-range");
Array.prototype.forEach.call(range, function(el, i) {
    var rangeChange = function (){
        var span = el.parentNode.querySelector(".range-deger");
        var spanWidth = span.offsetWidth;
        var rangeMax = el.max;
        var rangeValue = el.value;
        var rangeWidth = el.offsetWidth - (spanWidth/2);
        span.innerHTML = rangeValue;
        span.style.left = Math.ceil(rangeWidth/rangeMax*rangeValue) + "px";
    }
    el.addEventListener("mousemove", function () {
        rangeChange();
    }, false);
    el.addEventListener("change", function () {
        rangeChange();
    }, false);
});

/* ============= 7. Modal  */

var overlay = document.createElement("div");
overlay.className += "tr-karart modal";

var modal = document.querySelectorAll(".modal");
Array.prototype.forEach.call(modal, function(el, i) {
    modal[i].addEventListener("click", function(e) {
        e.preventDefault();
        var href = el.getAttribute("href");
        var modalTarget = document.getElementById(href);
        modalTarget.classList.add("goster");
        var overlayCount = document.querySelectorAll(".tr-karart").length;
        if(!overlayCount) {
            document.body.appendChild(overlay);
        }
        fadeIn(overlay);
    }, false);
});

function trModalClose(target = ".tr-modal a.kapat") {
    var modals = document.querySelectorAll(target);
    Array.prototype.forEach.call(modals, function(el, i) {
        modals[i].addEventListener("click", function(e) {
            e.preventDefault();
            overlay.click();
        }, false);
    });
}
trModalClose();

overlay.addEventListener("click", function() {
    var overlayCount = document.querySelectorAll(".tr-karart").length;
    var modalVisible = document.querySelectorAll(".tr-modal.goster")["0"];
    if(overlayCount && typeof modalVisible !== "undefined") {
        fadeOut(overlay);
        modalVisible.classList.remove("goster");
        setTimeout(function(){
            overlay.remove();
        }, 250);
    }
}, false);

/* ============= 8. Select  */

var select = document.querySelectorAll("select");
Array.prototype.forEach.call(select, function(el, i) {
    var options = el.getElementsByTagName("option");
    var optionsLength = options.length;

    var div = document.createElement("div");
    div.className += "tr-dropdown";

    var span = document.createElement("span");
    span.className += "dropdown-secili";
    span.innerHTML = "Seçiniz";

    div.appendChild(span);

    var ul = document.createElement("ul");
    ul.className += "dropdown-icerik";

    for (var j=0; j<optionsLength; j++) {
        var li = document.createElement("li");
        li.innerHTML = options[j].text;
        ul.appendChild(li);
    }

    div.appendChild(ul);
    div.setAttribute("tr-dropdown",i);

    select[i].style.display = "none";

    select[i].parentNode.appendChild(div);
});

var dropdown = document.querySelectorAll(".tr-dropdown");
Array.prototype.forEach.call(dropdown, function(el, i) {
    dropdown[i].addEventListener("click", function(e) {
        e.preventDefault();
        el.classList.toggle("aktif");
    }, false);

    var liContent = dropdown[i].querySelectorAll("ul.dropdown-icerik li");
    var liContentLength = liContent.length;

    var span = dropdown[i].querySelectorAll("span.dropdown-secili");
    Array.prototype.forEach.call(liContent, function(el, i) {
        liContent[i].addEventListener("click", function(e) {
            e.preventDefault();
            for (var k=0; k<liContentLength; k++) {
                el.parentNode.querySelectorAll("li")[k].classList.remove("aktif");
            }
            el.classList.add("aktif");

            var selectText = el.innerHTML;
            var selectIndex = i;
            var whichSelect = span["0"].parentNode.getAttribute("tr-dropdown");
            span[0].textContent = selectText;
            select[whichSelect].selectedIndex = selectIndex;
        }, false);
    });
});

/* ============= 9. Popovers  */

var popovers = document.querySelectorAll(".tr-popovers");
Array.prototype.forEach.call(popovers, function(el, i) {
    el.addEventListener("click", function () {
        el.classList.toggle("aktif");
    }, false);
});

/* ============= 10. Mobil Menu  */

$("nav.mobil li ul, nav.menu li ul").parents("li").addClass("acilir");
$("nav.mobil li.acilir ul").hide();
$("nav.mobil").on("click", "li.acilir>a", function() {
    $(this).parents("li.acilir:first").find("ul:first").slideToggle();
});
$("body").on("click", ".menuac", function() {
    $(this).animate({
        opacity: "0"
    }, 10).parents("body").append("

").find("nav.mobil").scrollTop(0);
    if ($("nav.mobil").hasClass("sag")) {
        $("nav.mobil").animate({
            right: "0"
        });
    }
    else {
        $("nav.mobil").animate({
            left: "0"
        });
    }
});
$("body").on("click", ".tr-karart.menu", function() {
    $(this).remove();
    $(".menuac").delay(400).animate({
        opacity: "1"
    }, 250);
    if ($("nav.mobil").hasClass("sag")) {
        $("nav.mobil").animate({
            right: "-250px"
        });
    }
    else {
        $("nav.mobil").animate({
            left: "-250px"
        });
    }
});

/* ============= 11. Tab Menu  */

var tabMenu =  document.querySelectorAll(".tr-tab");
Array.prototype.forEach.call(tabMenu, function(el, i) {
    var tabs = tabMenu[i].querySelectorAll(".tr-tab nav a");
    var tabContent = tabMenu[i].querySelectorAll(".tab-icerik");
    tabs["0"].classList.add("aktif");
    Array.prototype.forEach.call(tabContent, function(el, i) {
        tabContent[i].style.display = "none";
        tabContent["0"].style.display = "block";
        tabs[i].addEventListener("click", function(e) {
            e.preventDefault();
            Array.prototype.forEach.call(tabs, function(el, i) {
                el.classList.remove("aktif");
                tabContent[i].style.display = "none";
            });
            tabs[i].classList.add("aktif");
            tabContent[i].style.display = "block";
        }, false);
    });
});

/* ============= 12. Akordiyon Menu  */
$(".akordiyon-icerik").hide();
$(".tr-akordiyon > .akordiyon-baslik").on("click", function() {
    var t = $(this);
    var i = t.closest(".tr-akordiyon").children(".akordiyon-baslik").index(t);
    if (t.hasClass("aktif")) {
        t.removeClass("aktif").closest(".tr-akordiyon").children(".akordiyon-icerik").slideUp(250);
    } else {
        t.siblings().removeClass("aktif").end().addClass("aktif").closest(".tr-akordiyon").children(".akordiyon-icerik").eq(i).slideDown(250).siblings(".akordiyon-icerik").slideUp(250);
    }
})
<|endoftext|>


<commit_before>var turkic_timeaccepted = (new Date()).getTime();

/* automatically load dependents */
(function() {
var scripts = document.getElementsByTagName("script");
var src = scripts[scripts.length-1].src;
var folder = src.substr(0, src.lastIndexOf('/'));
document.write('');
document.write('');
})();

function mturk_parameters()
{
    var retval = new Object();
    retval.action = "http://www.mturk.com/mturk/externalSubmit";
    retval

    if (window.location.href.indexOf("?") == -1)
    {
        retval.assignmentid = null;
        retval.hitid = null;
        retval.workerid = null;
        return retval;
    }

    var params = window.location.href.split("?")[1].split("&");

    for (var i in params)
    {
        var sp = params[i].split("=");
        if (sp.length <= 1)
        {
            continue;
        }
        var result = sp[1].split("#")[0];

        if (sp[0] == "assignmentId")
        {
            retval.assignmentid = result;
        }
        else if (sp[0] == "hitId")
        {
            retval.hitid = result;
        }
        else if (sp[0] == "workerId")
        {
            retval.workerid = result;
        }
        else if (sp[0] == "turkSubmitTo")
        {
            retval.action = decodeURIComponent(result) +
                "/mturk/externalSubmit";
        }
        else
        {
            retval[sp[0]] = result;
        }
    }

    return retval;
}

function mturk_isassigned()
{
    var params = mturk_parameters();
    return params.assignmentid && params.assignmentid != "ASSIGNMENT_ID_NOT_AVAILABLE" && params.hitid && params.workerid;
}

function mturk_submit(callback)
{
    if (!mturk_isassigned())
    {
        alert("Please accept task before submitting.");
        return;
    }

    console.log("Preparing work for submission");

    var params = mturk_parameters();
    var now = (new Date()).getTime();

    $("body").append('<form method="get" id="turkic_mturk">' +
        '<input type="hidden" name="assignmentId" value="">' +
        '<input type="hidden" name="data" value="" />' +
        '</form>');

    $("#turkic_mturk input").val(params.assignmentid);
    $("#turkic_mturk").attr("action", params.action);

    // function that must be called to formally complete transaction
    function redirect()
    {
        server_request("turkic_markcomplete", [params.hitid, params.assignmentid, params.workerid], function() {
            $("#turkic_mturk").submit();
        });
    }

    var donateyes = $("#turkic_donate_yes").attr("checked") ? 1 : 0;
    server_request("turkic_savejobstats", [params.hitid, turkic_timeaccepted, now, donateyes], function() {
        callback(redirect);
    });
}

function mturk_acceptfirst()
{
    var af = $('

').prependTo("body")
    af.html("Remember to accept the task before working!");
}

function mturk_showstatistics()
{
    var stc = $('

');
    st = stc.children("#turkic_workerstatscontent");

    server_workerstats(function(data) {
        st.html("");

        var reward = $('

');
        var amount = Math.round(data["reward"] * 100);
        var bonus = Math.round(data["bonus"] * 100);
        var donationenabled = data["donate"];

        var rewardstr = '
' + amount + ' ¢
 pay';
        if (bonus > 0)
        {
            rewardstr += ' +
' + bonus + ' ¢
 bonus';
        }

        reward.html('Reward: ' + rewardstr);
        st.append(reward);

        if (!data["newuser"])
        {
            st.append("Your record:");

            var subm = $('

');
            var submn = $('

');
            submn.html(data["numsubmitted"]);
            submn.appendTo(subm);
            subm.append(" submitted");
            subm.appendTo(st);

            var accp = $('

');
            var accpn = $('

');
            accpn.html(data["numaccepted"]);
            accpn.appendTo(accp);
            accp.append(" accepted");
            accp.appendTo(st);

            var rejt = $('

');
            var rejtn = $('

');
            rejtn.html(data["numrejected"]);
            rejtn.appendTo(rejt);
            rejt.append(" rejected");
            rejt.appendTo(st);
        }
        else
        {
            st.append("Welcome new user! Please take a minute to read the instructions.");
        }
        stc.prependTo("body");

        if (donationenabled && bonus > 0)
        {
            mturk_showdonate(amount, bonus);
        }
    });
}

function mturk_showdonate(reward, bonus)
{
    if ($("#turkic_donation").size())
    {
        $("#turkic_donation").show();
        $("#turkic_overlay").show();
        return;
    }

    $('

').appendTo("body");

    var str = '
Do you want to end world hunger?
';
    str += '
We are offering our users the chance to work on behalf of a charity. When your HIT is accepted, we will pay you both your standard compensation as well as a bonus. If you choose, we can donate your bonus to charity instead.
';
    str += '
For this HIT, you will receive ' + reward + '¢ with an additional ' + bonus + '¢ bonus. If you opt to donate, your HIT will be accepted and you will receive ' + reward + '¢, but we will donate your bonus to charity.
';
    str += '
We urge you to consider donating. All proceeds will go to United Nation\'s World Food Programme to fight world hunger. If every worker donates, we can collectively donate hundreds of thousands of dollars. Your actions can have an impact — all you must do is donate.
';
    str += '
';
    str += "Can we donate your bonus to fight world hunger?
";
    str += '<input type="radio" id="turkic_donate_yes" name="turkic_donate_option">';
    str += 'Yes, donate this bonus to the World Food Programme on my behalf.
';
    str += '<input type="radio" id="turkic_donate_no" name="turkic_donate_option">';
    str += 'No, I want to keep this bonus for myself.
';
    //str += '
<input type="checkbox" id="turkic_donate_notagain"> Do not show again
';
    str += '<input type="button" id="turkic_donate_close" value="Continue">';
    str += '
';
    str += '
Looking for more ways to donate? Check out Freerice.com to donate even more.
';
    var donation = $('

').appendTo("body");
    donation.append(str);

    if ($.cookie("turkic_charity_previous") != null)
    {
        if ($.cookie("turkic_charity_previous") == 1)
        {
            $("#turkic_donate_yes").attr("checked", true);
        }
        else
        {
            $("#turkic_donate_no").attr("checked", true);
        }
    }

    $("#turkic_donate_close").click(function() {
        var donateyes = $("#turkic_donate_yes").attr("checked");
        var donateno  = $("#turkic_donate_no").attr("checked");

        if (!donateyes && !donateno)
        {
            window.alert("Please choose your donation option.");
            return;
        }

        $.cookie("turkic_charity_previous", donateyes ? 1 : 0);

        // we need to reset the timestamp because the task doesnt start until they continue
        turkic_timeaccepted = (new Date()).getTime();

        $("#turkic_overlay").hide();
        donation.hide();
    });
}

function server_geturl(action, parameters)
{
    var url = "server/" + action;
    for (var x in parameters)
    {
        url += "/" + parameters[x];
    }
    return url;
}

function server_request(action, parameters, callback)
{
    var url = server_geturl(action, parameters);
    console.log("Server request: " + url);
    $.ajax({
        url: url,
        dataType: "json",
        success: function(data) {
            callback(data);
        },
        error: function(xhr, textstatus) {
            console.log(xhr.responseText);
            death("Server Error");
        }
    });
}

function server_post(action, parameters, data, callback)
{
    var url = server_geturl(action, parameters);
    console.log("Server post: " + url);
    $.ajax({
        url: url,
        dataType: "json",
        type: "POST",
        data: data,
        success: function(data) {
            callback(data);
        },
        error: function(xhr, textstatus) {
            console.log(xhr.responseText);
            death("Server Error");
        }
    });
}

var server_workerstats_data = null;
function server_workerstats(callback)
{
    if (server_workerstats_data == null)
    {
        var params = mturk_parameters();
        if (params.workerid)
        {
            server_request("turkic_getworkerstats",
                [params.hitid, params.workerid],
                function (data) {
                    server_workerstats_data = data;
                    callback(data);
                });
        }
    }
    else
    {
        callback(server_workerstats_data);
    }
}

function death(message)
{
    document.write("" + message);
}

if (!console)
{
    var console = new Object();
    console.log = function() {};
}
<commit_msg>"all proceeds" --> "all bonuses"<commit_after>var turkic_timeaccepted = (new Date()).getTime();

/* automatically load dependents */
(function() {
var scripts = document.getElementsByTagName("script");
var src = scripts[scripts.length-1].src;
var folder = src.substr(0, src.lastIndexOf('/'));
document.write('');
document.write('');
})();

function mturk_parameters()
{
    var retval = new Object();
    retval.action = "http://www.mturk.com/mturk/externalSubmit";
    retval

    if (window.location.href.indexOf("?") == -1)
    {
        retval.assignmentid = null;
        retval.hitid = null;
        retval.workerid = null;
        return retval;
    }

    var params = window.location.href.split("?")[1].split("&");

    for (var i in params)
    {
        var sp = params[i].split("=");
        if (sp.length <= 1)
        {
            continue;
        }
        var result = sp[1].split("#")[0];

        if (sp[0] == "assignmentId")
        {
            retval.assignmentid = result;
        }
        else if (sp[0] == "hitId")
        {
            retval.hitid = result;
        }
        else if (sp[0] == "workerId")
        {
            retval.workerid = result;
        }
        else if (sp[0] == "turkSubmitTo")
        {
            retval.action = decodeURIComponent(result) +
                "/mturk/externalSubmit";
        }
        else
        {
            retval[sp[0]] = result;
        }
    }

    return retval;
}

function mturk_isassigned()
{
    var params = mturk_parameters();
    return params.assignmentid && params.assignmentid != "ASSIGNMENT_ID_NOT_AVAILABLE" && params.hitid && params.workerid;
}

function mturk_submit(callback)
{
    if (!mturk_isassigned())
    {
        alert("Please accept task before submitting.");
        return;
    }

    console.log("Preparing work for submission");

    var params = mturk_parameters();
    var now = (new Date()).getTime();

    $("body").append('<form method="get" id="turkic_mturk">' +
        '<input type="hidden" name="assignmentId" value="">' +
        '<input type="hidden" name="data" value="" />' +
        '</form>');

    $("#turkic_mturk input").val(params.assignmentid);
    $("#turkic_mturk").attr("action", params.action);

    // function that must be called to formally complete transaction
    function redirect()
    {
        server_request("turkic_markcomplete", [params.hitid, params.assignmentid, params.workerid], function() {
            $("#turkic_mturk").submit();
        });
    }

    var donateyes = $("#turkic_donate_yes").attr("checked") ? 1 : 0;
    server_request("turkic_savejobstats", [params.hitid, turkic_timeaccepted, now, donateyes], function() {
        callback(redirect);
    });
}

function mturk_acceptfirst()
{
    var af = $('

').prependTo("body")
    af.html("Remember to accept the task before working!");
}

function mturk_showstatistics()
{
    var stc = $('

');
    st = stc.children("#turkic_workerstatscontent");

    server_workerstats(function(data) {
        st.html("");

        var reward = $('

');
        var amount = Math.round(data["reward"] * 100);
        var bonus = Math.round(data["bonus"] * 100);
        var donationenabled = data["donate"];

        var rewardstr = '
' + amount + ' ¢
 pay';
        if (bonus > 0)
        {
            rewardstr += ' +
' + bonus + ' ¢
 bonus';
        }

        reward.html('Reward: ' + rewardstr);
        st.append(reward);

        if (!data["newuser"])
        {
            st.append("Your record:");

            var subm = $('

');
            var submn = $('

');
            submn.html(data["numsubmitted"]);
            submn.appendTo(subm);
            subm.append(" submitted");
            subm.appendTo(st);

            var accp = $('

');
            var accpn = $('

');
            accpn.html(data["numaccepted"]);
            accpn.appendTo(accp);
            accp.append(" accepted");
            accp.appendTo(st);

            var rejt = $('

');
            var rejtn = $('

');
            rejtn.html(data["numrejected"]);
            rejtn.appendTo(rejt);
            rejt.append(" rejected");
            rejt.appendTo(st);
        }
        else
        {
            st.append("Welcome new user! Please take a minute to read the instructions.");
        }
        stc.prependTo("body");

        if (donationenabled && bonus > 0)
        {
            mturk_showdonate(amount, bonus);
        }
    });
}

function mturk_showdonate(reward, bonus)
{
    if ($("#turkic_donation").size())
    {
        $("#turkic_donation").show();
        $("#turkic_overlay").show();
        return;
    }

    $('

').appendTo("body");

    var str = '
Do you want to end world hunger?
';
    str += '
We are offering our users the chance to work on behalf of a charity. When your HIT is accepted, we will pay you both your standard compensation as well as a bonus. If you choose, we can donate your bonus to charity instead.
';
    str += '
For this HIT, you will receive ' + reward + '¢ with an additional ' + bonus + '¢ bonus. If you opt to donate, your HIT will be accepted and you will receive ' + reward + '¢, but we will donate your bonus to charity.
';
    str += '
We urge you to consider donating. All bonuses will go to United Nation\'s World Food Programme to fight world hunger. If every worker donates, we can collectively donate hundreds of thousands of dollars. Your actions can have an impact — all you must do is donate.
';
    str += '
';
    str += "Can we donate your bonus to fight world hunger?
";
    str += '<input type="radio" id="turkic_donate_yes" name="turkic_donate_option">';
    str += 'Yes, donate this bonus to the World Food Programme on my behalf.
';
    str += '<input type="radio" id="turkic_donate_no" name="turkic_donate_option">';
    str += 'No, I want to keep this bonus for myself.
';
    //str += '
<input type="checkbox" id="turkic_donate_notagain"> Do not show again
';
    str += '<input type="button" id="turkic_donate_close" value="Continue">';
    str += '
';
    str += '
Looking for more ways to donate? Check out Freerice.com to donate even more.
';
    var donation = $('

').appendTo("body");
    donation.append(str);

    if ($.cookie("turkic_charity_previous") != null)
    {
        if ($.cookie("turkic_charity_previous") == 1)
        {
            $("#turkic_donate_yes").attr("checked", true);
        }
        else
        {
            $("#turkic_donate_no").attr("checked", true);
        }
    }

    $("#turkic_donate_close").click(function() {
        var donateyes = $("#turkic_donate_yes").attr("checked");
        var donateno  = $("#turkic_donate_no").attr("checked");

        if (!donateyes && !donateno)
        {
            window.alert("Please choose your donation option.");
            return;
        }

        $.cookie("turkic_charity_previous", donateyes ? 1 : 0);

        // we need to reset the timestamp because the task doesnt start until they continue
        turkic_timeaccepted = (new Date()).getTime();

        $("#turkic_overlay").hide();
        donation.hide();
    });
}

function server_geturl(action, parameters)
{
    var url = "server/" + action;
    for (var x in parameters)
    {
        url += "/" + parameters[x];
    }
    return url;
}

function server_request(action, parameters, callback)
{
    var url = server_geturl(action, parameters);
    console.log("Server request: " + url);
    $.ajax({
        url: url,
        dataType: "json",
        success: function(data) {
            callback(data);
        },
        error: function(xhr, textstatus) {
            console.log(xhr.responseText);
            death("Server Error");
        }
    });
}

function server_post(action, parameters, data, callback)
{
    var url = server_geturl(action, parameters);
    console.log("Server post: " + url);
    $.ajax({
        url: url,
        dataType: "json",
        type: "POST",
        data: data,
        success: function(data) {
            callback(data);
        },
        error: function(xhr, textstatus) {
            console.log(xhr.responseText);
            death("Server Error");
        }
    });
}

var server_workerstats_data = null;
function server_workerstats(callback)
{
    if (server_workerstats_data == null)
    {
        var params = mturk_parameters();
        if (params.workerid)
        {
            server_request("turkic_getworkerstats",
                [params.hitid, params.workerid],
                function (data) {
                    server_workerstats_data = data;
                    callback(data);
                });
        }
    }
    else
    {
        callback(server_workerstats_data);
    }
}

function death(message)
{
    document.write("" + message);
}

if (!console)
{
    var console = new Object();
    console.log = function() {};
}
<|endoftext|>


<commit_before>/*Uses WarmJS Library*/

/*Public Class Instance within the warm namespace*/
var instance1 = new warm.exampleClass1();

/*Access A method in the class*/
alert(instance1.property1);

/*Assign a value from outside*/
instance1.property1 = "assigned value";

/*Display Value after assignment operation*/
alert(instance1.property1);

/*Access A method in the class*/
instance1.method();

/*exampleClass2 Instance*/
var instance2 = new warm.exampleClass2();

/*Private Variables can not be accessed from the outside*/
//Uncomment the below section to see the output
//alert(instance2.privateProperty1); //Displays undefined since the inside variables are available to exampleClass2;

/*Private Methods can not be accessed from outside*/
//Uncomment the below section to see the output
//instance2.privateMethod(); //

/*Instances of Coder */
var coder1 = new warm.Coder();
var coder2 = new warm.Coder();

/*Lets name the coders*/
coder1.name = "Dilusha";
coder2.name = "Andrew";

/*Lets make coder1 Hit Enter over coder2*/
coder1.hitEnter(coder2);//This will deduct Andrew's codeScore by 10 points
alert(coder2.name + "'s codeScore is " + coder2.codeScore);

/*Use of Prototype Property*/
//Adding a method to coder
warm.Coder.prototype.debug = function (toCoder) {

    toCoder.codeScore += 10;

};

/*Lets call debug*/
coder1.debug(coder2);
alert("Prototype :: Method Inheritance" + coder2.name + "'s Code Score has been increased upto " + coder2.codeScore);

/*Use prototype property to set new variables*/
warm.Coder.prototype.testScore = "100";

/*Display the test Score of both the coders :: Use of inheritance*/
alert("Prototype :: Inheritance :: "+coder1.name +"'s Test Score : "+coder1.testScore+" And "+coder2.name+"'s Test Score is "+coder2.testScore);

/*Advanced Inheritance with Prototype Property*/
/*Create an instance of ParentClass for Child with Prototype Property*/
warm.ChildClass.prototype =  new warm.ParentClass();

//Child instance of ChildClass
var childInstance = new warm.ChildClass();

/*Testing if is an instance of */
alert(childInstance instanceof  warm.ParentClass);
alert(childInstance instanceof  warm.ChildClass);

warm.ChildClass.prototype.parentMethod = function parentMethod(arg1){

    return arg1 + " Child has overriden the parent method by now ! :)";

}
alert(childInstance.parentMethod("Hello Parent, !"));

//Different between with use strict and not
function f1(){
    return this;
}

f1() === window; // global object

function f2(){
    "use strict"; // see strict mode
    return this;
}<commit_msg>updated<commit_after>/*Uses WarmJS Library*/

/*Public Class Instance within the warm namespace*/
var instance1 = new warm.exampleClass1();

/*Access A method in the class*/
alert(instance1.property1);

/*Assign a value from outside*/
instance1.property1 = "assigned value";

/*Display Value after assignment operation*/
alert(instance1.property1);

/*Access A method in the class*/
instance1.method();

/*exampleClass2 Instance*/
var instance2 = new warm.exampleClass2();

/*Private Variables can not be accessed from the outside*/
//Uncomment the below section to see the output
//alert(instance2.privateProperty1); //Displays undefined since the inside variables are available to exampleClass2;

/*Private Methods can not be accessed from outside*/
//Uncomment the below section to see the output
//instance2.privateMethod(); //

/*Instances of Coder */
var coder1 = new warm.Coder();
var coder2 = new warm.Coder();

/*Lets name the coders*/
coder1.name = "Dilusha";
coder2.name = "Andrew";

/*Lets make coder1 Hit Enter over coder2*/
coder1.hitEnter(coder2);//This will deduct Andrew's codeScore by 10 points
alert(coder2.name + "'s codeScore is " + coder2.codeScore);

/*Use of Prototype Property*/
//Adding a method to coder
warm.Coder.prototype.debug = function (toCoder) {

    toCoder.codeScore += 10;

};

/*Lets call debug*/
coder1.debug(coder2);
alert("Prototype :: Method Inheritance" + coder2.name + "'s Code Score has been increased upto " + coder2.codeScore);

/*Use prototype property to set new variables*/
warm.Coder.prototype.testScore = "100";

/*Display the test Score of both the coders :: Use of inheritance*/
alert("Prototype :: Inheritance :: "+coder1.name +"'s Test Score : "+coder1.testScore+" And "+coder2.name+"'s Test Score is "+coder2.testScore);

/*Advanced Inheritance with Prototype Property*/
/*Create an instance of ParentClass for Child with Prototype Property*/
warm.ChildClass.prototype =  new warm.ParentClass();

//Child instance of ChildClass
var childInstance = new warm.ChildClass();

/*Testing if is an instance of */
alert(childInstance instanceof  warm.ParentClass);
alert(childInstance instanceof  warm.ChildClass);

warm.ChildClass.prototype.parentMethod = function parentMethod(arg1){

    return arg1 + " Child has overriden the parent method by now ! :)";

}
alert(childInstance.parentMethod("Hello Parent, !"));

//Different between with use strict and not
function f1(){
    return this;
}

f1() === window; // global object

function f2(){
    "use strict"; // see strict mode
    return this;
}

//This always refers to the outer object from inside and start the execution from outer to inside
var o = {
    prop: 37,
    f: function() {
        return this.prop;
    }
};

console.log(o.f()); // logs 37<|endoftext|>


<commit_before>define(["./scaffold", "lib/d3"], function (scaffold, d3) {
    return function(options) {
        // set defaults
	var o = scaffold.set_options(options, {
            margins: {top: 10, right: 10, bottom: 10, left: 20},
	    selection_is_svg: false,
            fillScreen: false,
            x_axis_label: "",
            y_axis_label: "",
            x_data_label: '1',
            y_data_label: '2',
            x_shift: 4,
            data_is_object: true,
            color_scale: false,
            y_range: false,
            title: false,
            is_stacked: false,
            update_hook: false,
	    css: '' });

	var out = scaffold.setup_svg(o.selection, o.selection_is_svg,
				     o.margins, o.fill_screen);
	o.svg = out.svg;
	o.height = out.height;
	o.width = out.width;

        // load the css
	o.ready = scaffold.load_css(o.css_path, function(css) {
	    o.css = css;
	    o.ready = true;
	});
	o.layers = [];

        return {
            update: update,
            collect_data: collect_data,
            update_hook: set_update_hook
        };

	// definitions
        function update_size() {
	    out = scaffold.resize_svg(o.selection, o.selection_is_svg, o.margins, o.fill_screen);
	    o.height = out.height;
	    o.width = out.width;

            // o.x.range([0, o.width]);
            // o.y.range([o.height, 0]);

            // o.xAxiscale(x);
            // o.yAxiscale(y);

            // o.svg.select('.x.hist-axis')
            //     .attr("transform", "translate(0," + o.height + ")")
            //     .call(o.xAxis)
            //     .select('text')
            //     .attr("x", o.width);
            // o.svg.select('.y.hist-axis')
            //     .call(o.yAxis);

            // var bar_w = o.x(1) - o.diff - 8;

            // for (var i=0; i<json.length; i++) {
            //     selection.selectAll(".bar.bar"+String(i))
            //         .attr("transform", function(d) {
            //             return "translate(" + (x(d.x) + x_shift*i) + "," + y(d.y) + ")";
            //         })
            //         .select('rect')
            //         .attr("width", bar_w)
            //         .attr("height", function(d) { return height - y(d.y); });
            // }

            return this;
        };

        function update() {
            // check data
            var i=-1;
            while(++i < o.layers.length) {
                if (o.layers[i]===undefined) {
                    console.log('waiting for all indices');
                    return this;
                }
            }

            // clear the container and add again
            o.svg.select("#bar-container").remove();
            var container = o.svg.append("g").attr("id","bar-container");
            container.append("style")
                .attr('type', "text/css")
                .text(o.css);
            var svg = container.append("g")
                    .attr("transform", "translate(" + o.margins.left + "," + o.margins.top + ")");

            // find x domain
            var x_dom = [0, d3.max(o.layers, function(a) { return a.data.length; })],
                y_dom;
            if (o.y_range) {
                y_dom = o.y_range;
            } else {
                if (o.is_stacked) {
                    // sum up each data point
                    var i=-1, max = 0;
                    while (++i<o.layers[0].data.length) {
                        var j=-1, t = 0;
                        while (++j<o.layers.length) t += o.layers[j].data[i].value;
                        if (t > max) max = t;
                    }
                    y_dom = [
                        d3.min(o.layers, function(a) {
                            return d3.min(a.data, function(d) { return d.value; });
                        }),
                        max
                    ];
                } else {
                    y_dom = [
                        d3.min(o.layers, function(a) {
                            return d3.min(a.data, function(d) { return d.value; });
                        }),
                        d3.max(o.layers, function(a) {
                            return d3.max(a.data, function(d) { return d.value; });
                        })
                    ];
                }
            }

            var dom = {'y': y_dom,
                     'x': x_dom},

            x = d3.scale.linear()
                .range([0, o.width])
                .domain(x_dom).nice(),
            y = d3.scale.linear()
                .range([o.height, 0])
                .domain(dom.y).nice(),
            xAxis = d3.svg.axis()
                .scale(x)
                .orient("bottom")
                .ticks(0),
            yAxis = d3.svg.axis()
                .scale(y)
                .orient("left")
                .tickFormat(d3.format("%"))
                .ticks(5);

            var diff = 0,
                bar_w = x(2) - x(1) - diff;

            for (var j = 0; j < o.layers.length; j++) {
                var cl = 'bar'+String(j);
                var bars = svg.selectAll("."+cl)
                        .data(o.layers[j].data)
                        .enter().append("g")
                        .attr("class", "bar "+cl);
                if (o.is_stacked) {
                    if (j > 0) {
                        bars.attr("transform", function(d, i) {
                            return "translate(" + x(i) + "," + (y(d.value) - o.height + y(o.layers[j-1].data[i].value)) + ")";
                        });
                    } else {
                        bars.attr("transform", function(d, i) { return "translate(" + x(i) + "," + y(d.value) + ")";  });
                    }
                } else {
                    bars.attr("transform", function(d, i) { return "translate(" + (x(i) + o.x_shift*j) + "," + y(d.value) + ")";  });
                }
                var rects = bars.append("rect")
                        .attr("x", 1)
                        .attr("width", bar_w)
                        .attr("height", function(d) { return o.height - y(d.value); })
                        .style("fill", function(d) { if (o.color_scale) return o.color_scale(d.category);
                                                     else return null; });
            }

            svg.append("g")
                .attr("class", "x bar-axis")
                .attr("transform", "translate(0," + o.height + ")")
                .call(xAxis)
                .append("text")
                .attr("class", "label")
                .attr("x", o.width)
                .attr("y", -6)
                .style("text-anchor", "end")
                .text(o.x_axis_label);

            svg.append("g")
                .attr("class", "y bar-axis")
                .call(yAxis)
                .append("text")
                .attr("class", "label")
                .attr("transform", "rotate(-90)")
                .attr("y", 6)
                .attr("dy", ".71em")
                .style("text-anchor", "end")
                .text(o.y_axis_label);

            if (o.title) {
                svg.append('text')
                    .attr('class', 'title')
                    .text(o.title)
                    .attr("transform", "translate("+o.width/2+",10)")
                    .attr("text-anchor", "middle");
            }

            if (o.update_hook) o.update_hook(svg);
            return this;
        };

        function collect_data(json, layer) {
            if (!o.ready) console.warn('Hasn\'t loaded css yet');
            if (o.data_is_object) {
                var objects = [];
                for (var key in json) objects.push({name: key, value: json[key]});
                o.layers[layer] = {data: objects};
            } else {
                o.layers[layer] = {data: json};
            }
            this.update();
	    return this;
        };

        function set_update_hook(fn) {
            o.update_hook = fn;
            return this;
        };

    };
});
<commit_msg>changed bar format for example<commit_after>define(["./scaffold", "lib/d3"], function (scaffold, d3) {
    return function(options) {
        // set defaults
	var o = scaffold.set_options(options, {
            margins: {top: 10, right: 10, bottom: 10, left: 20},
	    selection_is_svg: false,
            fillScreen: false,
            x_axis_label: "",
            y_axis_label: "",
            x_data_label: '1',
            y_data_label: '2',
            x_shift: 4,
            data_is_object: true,
            color_scale: false,
            y_range: false,
            title: false,
            is_stacked: false,
            update_hook: false,
	    css: '' });

	var out = scaffold.setup_svg(o.selection, o.selection_is_svg,
				     o.margins, o.fill_screen);
	o.svg = out.svg;
	o.height = out.height;
	o.width = out.width;

        // load the css
	o.ready = scaffold.load_css(o.css_path, function(css) {
	    o.css = css;
	    o.ready = true;
	});
	o.layers = [];

        return {
            update: update,
            collect_data: collect_data,
            update_hook: set_update_hook
        };

	// definitions
        function update_size() {
	    out = scaffold.resize_svg(o.selection, o.selection_is_svg, o.margins, o.fill_screen);
	    o.height = out.height;
	    o.width = out.width;

            // o.x.range([0, o.width]);
            // o.y.range([o.height, 0]);

            // o.xAxiscale(x);
            // o.yAxiscale(y);

            // o.svg.select('.x.hist-axis')
            //     .attr("transform", "translate(0," + o.height + ")")
            //     .call(o.xAxis)
            //     .select('text')
            //     .attr("x", o.width);
            // o.svg.select('.y.hist-axis')
            //     .call(o.yAxis);

            // var bar_w = o.x(1) - o.diff - 8;

            // for (var i=0; i<json.length; i++) {
            //     selection.selectAll(".bar.bar"+String(i))
            //         .attr("transform", function(d) {
            //             return "translate(" + (x(d.x) + x_shift*i) + "," + y(d.y) + ")";
            //         })
            //         .select('rect')
            //         .attr("width", bar_w)
            //         .attr("height", function(d) { return height - y(d.y); });
            // }

            return this;
        };

        function update() {
            // check data
            var i=-1;
            while(++i < o.layers.length) {
                if (o.layers[i]===undefined) {
                    console.log('waiting for all indices');
                    return this;
                }
            }

            // clear the container and add again
            o.svg.select("#bar-container").remove();
            var container = o.svg.append("g").attr("id","bar-container");
            container.append("style")
                .attr('type', "text/css")
                .text(o.css);
            var svg = container.append("g")
                    .attr("transform", "translate(" + o.margins.left + "," + o.margins.top + ")");

            // find x domain
            var x_dom = [0, d3.max(o.layers, function(a) { return a.data.length; })],
                y_dom;
            if (o.y_range) {
                y_dom = o.y_range;
            } else {
                if (o.is_stacked) {
                    // sum up each data point
                    var i=-1, max = 0;
                    while (++i<o.layers[0].data.length) {
                        var j=-1, t = 0;
                        while (++j<o.layers.length) t += o.layers[j].data[i].value;
                        if (t > max) max = t;
                    }
                    y_dom = [
                        d3.min(o.layers, function(a) {
                            return d3.min(a.data, function(d) { return d.value; });
                        }),
                        max
                    ];
                } else {
                    y_dom = [
                        d3.min(o.layers, function(a) {
                            return d3.min(a.data, function(d) { return d.value; });
                        }),
                        d3.max(o.layers, function(a) {
                            return d3.max(a.data, function(d) { return d.value; });
                        })
                    ];
                }
            }

            var dom = {'y': y_dom,
                     'x': x_dom},

            x = d3.scale.linear()
                .range([0, o.width])
                .domain(x_dom).nice(),
            y = d3.scale.linear()
                .range([o.height, 0])
                .domain(dom.y).nice(),
            xAxis = d3.svg.axis()
                .scale(x)
                .orient("bottom")
                .ticks(0),
            yAxis = d3.svg.axis()
                .scale(y)
                .orient("left")
                .tickFormat(d3.format("f"))
                .ticks(5);

            var diff = 0,
                bar_w = x(2) - x(1) - diff;

            for (var j = 0; j < o.layers.length; j++) {
                var cl = 'bar'+String(j);
                var bars = svg.selectAll("."+cl)
                        .data(o.layers[j].data)
                        .enter().append("g")
                        .attr("class", "bar "+cl);
                if (o.is_stacked) {
                    if (j > 0) {
                        bars.attr("transform", function(d, i) {
                            return "translate(" + x(i) + "," + (y(d.value) - o.height + y(o.layers[j-1].data[i].value)) + ")";
                        });
                    } else {
                        bars.attr("transform", function(d, i) { return "translate(" + x(i) + "," + y(d.value) + ")";  });
                    }
                } else {
                    bars.attr("transform", function(d, i) { return "translate(" + (x(i) + o.x_shift*j) + "," + y(d.value) + ")";  });
                }
                var rects = bars.append("rect")
                        .attr("x", 1)
                        .attr("width", bar_w)
                        .attr("height", function(d) { return o.height - y(d.value); })
                        .style("fill", function(d) { if (o.color_scale) return o.color_scale(d.category);
                                                     else return null; });
            }

            svg.append("g")
                .attr("class", "x bar-axis")
                .attr("transform", "translate(0," + o.height + ")")
                .call(xAxis)
                .append("text")
                .attr("class", "label")
                .attr("x", o.width)
                .attr("y", -6)
                .style("text-anchor", "end")
                .text(o.x_axis_label);

            svg.append("g")
                .attr("class", "y bar-axis")
                .call(yAxis)
                .append("text")
                .attr("class", "label")
                .attr("transform", "rotate(-90)")
                .attr("y", 6)
                .attr("dy", ".71em")
                .style("text-anchor", "end")
                .text(o.y_axis_label);

            if (o.title) {
                svg.append('text')
                    .attr('class', 'title')
                    .text(o.title)
                    .attr("transform", "translate("+o.width/2+",10)")
                    .attr("text-anchor", "middle");
            }

            if (o.update_hook) o.update_hook(svg);
            return this;
        };

        function collect_data(json, layer) {
            if (!o.ready) console.warn('Hasn\'t loaded css yet');
            if (o.data_is_object) {
                var objects = [];
                for (var key in json) objects.push({name: key, value: json[key]});
                o.layers[layer] = {data: objects};
            } else {
                o.layers[layer] = {data: json};
            }
            this.update();
	    return this;
        };

        function set_update_hook(fn) {
            o.update_hook = fn;
            return this;
        };

    };
});
<|endoftext|>


<commit_before>var app = {
    // Application Constructor
    initialize: function() {
      this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
      document.addEventListener('deviceready', this.onDeviceReady, false);
      document.addEventListener("offline", checkConnection, false);
      document.addEventListener("pause", onPause, false);
      document.addEventListener("resume", onResume, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicitly call 'app.receivedEvent(...);'
    onDeviceReady: function() {
      app.receivedEvent('deviceready');
      screen.lockOrientation('portrait');
      localStorage.setItem("saldo_actual",0);
      localStorage.setItem("wisi","false");
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
      getDeviceProperty();
      detectGEO();
    }
  };

  function detectGEO(){
    var options = {
      enableHighAccuracy: true,
      timeout: 5000,
      maximumAge: 75000
    };
    if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(onSuccess, onError, options);
    } else {
      console.log('Geolocalización no soportada');
    }
  }

// onSuccess Geolocation    //
function onSuccess(position) {
  localStorage.removeItem("position");
  lat1= position.coords.latitude;
  lng1= position.coords.longitude;
  var pos= {lat:lat1,lng:lng1};
  localStorage.setItem("position",JSON.stringify(pos));
  console.log('Coordenadas detectadas');
}

function onError(error) {
  console.log('Error detectando coordenadas');
}

function getDeviceProperty()
{
     var deviceOS  = device.platform  ;  //fetch the device operating system
     var deviceOSVersion = device.version ;  //fetch the device OS version
     localStorage.setItem("OS",deviceOS);
   }

   function onPause() {
    localStorage.setItem("wisi","false");
    console.log("paused");
    if(!localStorage.scanear)searchWISI();
  }

  function searchWISI(){
    var win= false;
    var statusWIFI=WifiWizard.isWifiEnabled(win, fail);

    window.setTimeout(function(){
      WifiWizard.getScanResults(listHandler, fail);
      //WifiWizard.listNetworks(listHandler, fail);
      console.log("Check available WIFIs");
    },60000);//1 minuto
  }
  function win(obj){
    console.log("Estado WIFI: "+obj);
  }

  function onResume() {
    localStorage.setItem("wisi","true");
    localStorage.setItem("scanner","false");
    console.log("resume");
  }

  function checkConnection() {
    var state=true;
    var networkState = navigator.connection.type;
    var states = {};
    states[Connection.UNKNOWN]  = 'Unknown connection';
    states[Connection.ETHERNET] = 'Ethernet connection';
    states[Connection.WIFI]     = 'WiFi connection';
    states[Connection.CELL_2G]  = 'Cell 2G connection';
    states[Connection.CELL_3G]  = 'Cell 3G connection';
    states[Connection.CELL_4G]  = 'Cell 4G connection';
    states[Connection.CELL]     = 'Cell generic connection';
    states[Connection.NONE]     = 'No network connection';

    if(states[networkState]=='No network connection'){
        //navigator.vibrate(1000);
        //alert('Internet no disponible!');
        state=false;
      }
      return state;
    }

    function fail(e){
      console.log("Detect active "+e);
    }

  function listHandler(a){
  console.log("Flag listar "+localStorage.wisi);
  console.log("Array Wifis "+JSON.stringify(a));
  if(localStorage.wisi=="false"){
    var exists=0;
    for(var i=0; i<a.length; i++){
      if((a[i].search("WISI TE CONECTA")>0||a[i].search("VALENCIA_V")>0)&&exists==0){
        console.log(a[i].search("WISI TE CONECTA")+" / "+a[i].search("VALENCIA_V"));
        if(localStorage.wisi=="false"){
            cordova.plugins.notification.local.schedule({ message:"Red WISI detectada",sound: "file://sounds/HTC Happy.mp3" });
            //myApp.alert("Red WISI detectada", "");
            localStorage.setItem("wisi","true");
            navigator.vibrate(1000);
            exists++;
          }
        }
      }
      searchWISI();
    }
  }<commit_msg>array<commit_after>var app = {
    // Application Constructor
    initialize: function() {
      this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
      document.addEventListener('deviceready', this.onDeviceReady, false);
      document.addEventListener("offline", checkConnection, false);
      document.addEventListener("pause", onPause, false);
      document.addEventListener("resume", onResume, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicitly call 'app.receivedEvent(...);'
    onDeviceReady: function() {
      app.receivedEvent('deviceready');
      screen.lockOrientation('portrait');
      localStorage.setItem("saldo_actual",0);
      localStorage.setItem("wisi","false");
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
      getDeviceProperty();
      detectGEO();
    }
  };

  function detectGEO(){
    var options = {
      enableHighAccuracy: true,
      timeout: 5000,
      maximumAge: 75000
    };
    if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(onSuccess, onError, options);
    } else {
      console.log('Geolocalización no soportada');
    }
  }

// onSuccess Geolocation    //
function onSuccess(position) {
  localStorage.removeItem("position");
  lat1= position.coords.latitude;
  lng1= position.coords.longitude;
  var pos= {lat:lat1,lng:lng1};
  localStorage.setItem("position",JSON.stringify(pos));
  console.log('Coordenadas detectadas');
}

function onError(error) {
  console.log('Error detectando coordenadas');
}

function getDeviceProperty()
{
     var deviceOS  = device.platform  ;  //fetch the device operating system
     var deviceOSVersion = device.version ;  //fetch the device OS version
     localStorage.setItem("OS",deviceOS);
   }

   function onPause() {
    localStorage.setItem("wisi","false");
    console.log("paused");
    if(!localStorage.scanear)searchWISI();
  }

  function searchWISI(){
    var statusWIFI=WifiWizard.isWifiEnabled(win, fail);

    window.setTimeout(function(){
      WifiWizard.getScanResults(listHandler, fail);
      console.log("Check available WIFIs");
    },60000);//1 minuto
  }
  function win(){
    console.log("Estado WIFI: ");
  }

  function onResume() {
    localStorage.setItem("wisi","true");
    localStorage.setItem("scanner","false");
    console.log("resume");
  }

  function checkConnection() {
    var state=true;
    var networkState = navigator.connection.type;
    var states = {};
    states[Connection.UNKNOWN]  = 'Unknown connection';
    states[Connection.ETHERNET] = 'Ethernet connection';
    states[Connection.WIFI]     = 'WiFi connection';
    states[Connection.CELL_2G]  = 'Cell 2G connection';
    states[Connection.CELL_3G]  = 'Cell 3G connection';
    states[Connection.CELL_4G]  = 'Cell 4G connection';
    states[Connection.CELL]     = 'Cell generic connection';
    states[Connection.NONE]     = 'No network connection';

    if(states[networkState]=='No network connection'){
        //navigator.vibrate(1000);
        //alert('Internet no disponible!');
        state=false;
      }
      return state;
    }

    function fail(e){
      console.log("Detect active "+e);
    }

  function listHandler(a){
  console.log("Flag listar "+localStorage.wisi);
  console.log("Array Wifis "+JSON.stringify(a));
  if(localStorage.wisi=="false"){
    var exists=0;
    for(var i=0; i<a.length; i++){
      alert(a[i]["SSID"]);
      if((a[i].search("WISI TE CONECTA")>0||a[i].search("VALENCIA_V")>0)&&exists==0){
        console.log(a[i].search("WISI TE CONECTA")+" / "+a[i].search("VALENCIA_V"));
        if(localStorage.wisi=="false"){
            cordova.plugins.notification.local.schedule({ message:"Red WISI detectada",sound: "file://sounds/HTC Happy.mp3" });
            //myApp.alert("Red WISI detectada", "");
            localStorage.setItem("wisi","true");
            navigator.vibrate(1000);
            exists++;
          }
        }
      }
      searchWISI();
    }
  }<|endoftext|>


<commit_before>import { formatFileSize, isDefinedGlobally } from './utils';

const messages = {
  after: (field, [target]) => `Câmpul ${field} trebuie să fie după ${target}.`,
  alpha: (field) => `Câmpul ${field} poate conține doar literele alfabetului.`,
  alpha_dash: (field) => `Câmpul ${field} poate conține litere și caracterele "-" sau "_".`,
  alpha_num: (field) => `Câmpul ${field} poate conține doar caractere alfanumerice.`,
  alpha_spaces: (field) => `Câmpul ${field} poate conține literele și spații.`,
  before: (field, [target]) => `Câmpul ${field} trebuie să fie după ${target}.`,
  between: (field, [min, max]) => `Valoare câmpului ${field} trebuie să fie între ${min} și ${max}.`,
  confirmed: (field) => `Câmpul ${field} nu coincide.`,
  credit_card: (field) => `Valoarea câmpului ${field} nu este un număr de card valid.`,
  date_between: (field, [min, max]) => `Data introdusă în ${field} trebuie să fie între ${min} și ${max}.`,
  date_format: (field, [format]) => `Respectați următorul format: ${format} în câmpul ${field}.`,
  decimal: (field, [decimals = '*'] = []) => `Câmpul ${field} trebuie să fie numberic și poate conține${decimals === '*' ? '' : ' ' + decimals} zecimale.`,
  digits: (field, [length]) => `Câmpul ${field} trebuie să fie numeric și să conțină exact ${length} caractere.`,
  dimensions: (field, [width, height]) => `Câmpul ${field} trebuie să fie ${width} pixeli lungime și ${height} pixeli înălțime.`,
  email: (field) => `Câmpul ${field} trebuie să conțină un email valid.`,
  excluded: (field) => `Câmpul ${field} trebuie să conțină o valoare validă.`,
  ext: (field) => `Câmpul ${field} trebuie să fie un nume de fișier valid.`,
  image: (field) => `Câmpul ${field} trebuie să fie o imagine.`,
  included: (field) => `Câmpul ${field} trebuie să conțină o valoare validă.`,
  ip: (field) => `Câmpul ${field} trebuie să conțină o adresa IP vaidă.`,
  max: (field, [length]) => `Câmpul ${field} nu poate fi mai mare de ${length} caractere.`,
  max_value: (field, [max]) => `Câmpul ${field} trebuie să fie maxim ${max}.`,
  mimes: (field) => `Câmpul ${field} trebuie să conțină un fișier cu extensie validă.`,
  min: (field, [length]) => `Câmpul ${field} trebuie să fie cel puțin ${length} caractere.`,
  min_value: (field, [min]) => `Câmpul ${field}trebuie să fie cel puțin ${min}.`,
  numeric: (field) => `Câmpul ${field} poate conține doar valori numerice.`,
  regex: (field) => `Formatul câmpului ${field} este invalid.`,
  required: (field) => `Câmpul ${field} este necesar.`,
  size: (field, [size]) => `Câmpul ${field} nu trebuie să depășească ${formatFileSize(size)}.`,
  url: (field) => `Câmpul ${field} nu este un URL valid.`
};

const locale = {
  name: 'ro',
  messages,
  attributes: {}
};

if (isDefinedGlobally()) {
  VeeValidate.Validator.localize({ [locale.name]: locale });
}

export default locale;
<commit_msg>Final updates (#1985)<commit_after>import { formatFileSize, isDefinedGlobally } from './utils';

const messages = {
  after: (field, [target]) => `Câmpul ${field} trebuie să fie după ${target}.`,
  alpha: (field) => `Câmpul ${field} poate conține doar literele alfabetului.`,
  alpha_dash: (field) => `Câmpul ${field} poate conține litere și caracterele "-" sau "_".`,
  alpha_num: (field) => `Câmpul ${field} poate conține doar caractere alfanumerice.`,
  alpha_spaces: (field) => `Câmpul ${field} poate conține literele și spații.`,
  before: (field, [target]) => `Câmpul ${field} trebuie să fie după ${target}.`,
  between: (field, [min, max]) => `Valoare câmpului ${field} trebuie să fie între ${min} și ${max}.`,
  confirmed: (field) => `Câmpul ${field} nu coincide.`,
  credit_card: (field) => `Valoarea câmpului ${field} nu este un număr de card valid.`,
  date_between: (field, [min, max]) => `Data introdusă în ${field} trebuie să fie între ${min} și ${max}.`,
  date_format: (field, [format]) => `Respectați următorul format: ${format} în câmpul ${field}.`,
  decimal: (field, [decimals = '*'] = []) => `Câmpul ${field} trebuie să fie numberic și poate conține ${decimals === '*' ? '' : ' ' + decimals} zecimale.`,
  digits: (field, [length]) => `Câmpul ${field} trebuie să fie numeric și să conțină exact ${length} caractere.`,
  dimensions: (field, [width, height]) => `Câmpul ${field} trebuie să fie ${width} pixeli lungime și ${height} pixeli înălțime.`,
  email: (field) => `Câmpul ${field} trebuie să conțină un email valid.`,
  excluded: (field) => `Câmpul ${field} trebuie să conțină o valoare validă.`,
  ext: (field) => `Câmpul ${field} trebuie să fie un nume de fișier valid.`,
  image: (field) => `Câmpul ${field} trebuie să fie o imagine.`,
  included: (field) => `Câmpul ${field} trebuie să conțină o valoare validă.`,
  ip: (field) => `Câmpul ${field} trebuie să conțină o adresă IP validă.`,
  max: (field, [length]) => `Câmpul ${field} nu poate conține mai mult de ${length} caractere.`,
  max_value: (field, [max]) => `Valoarea câmpului ${field} trebuie să fie maxim ${max}.`,
  mimes: (field) => `Câmpul ${field} trebuie să conțină un fișier cu extensie validă.`,
  min: (field, [length]) => `Câmpul ${field} trebuie să conțină cel puțin ${length} caractere.`,
  min_value: (field, [min]) => `Valoarea câmpului ${field} trebuie să fie mai mare de ${min}.`,
  numeric: (field) => `Câmpul ${field} poate conține doar valori numerice.`,
  regex: (field) => `Formatul câmpului ${field} este invalid.`,
  required: (field) => `Câmpul ${field} este obligatoriu.`,
  size: (field, [size]) => `Câmpul ${field} nu trebuie să depășească ${formatFileSize(size)}.`,
  url: (field) => `Câmpul ${field} nu este o adresă URL validă.`
};

const locale = {
  name: 'ro',
  messages,
  attributes: {}
};

if (isDefinedGlobally()) {
  VeeValidate.Validator.localize({ [locale.name]: locale });
}

export default locale;
<|endoftext|>


<commit_before><commit_msg>Added the header comment<commit_after>/**
 * @preserve Listen v1.0.0
 *
 * Copyright 2011, Oliver Caldwell
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * https://github.com/Wolfy87/Listen
 */
<|endoftext|>


<commit_before>import elem from "./_elem.js";

var convert = {
    addSassVariables: () =>{
        elem.el.codeBox.classList.remove("css_box", "less_box", "js_box");
        elem.el.codeBox.classList.add("sass_box");

        elem.el.codeBoxBorder.classList.remove("css_border", "less_border", "js_border");
        elem.el.codeBoxBorder.classList.add("sass_border");

        elem.el.innerCodeBox.innerHTML = `$num: ${elem.s.pixSize};<br>`;
        for(let x = 0; x < elem.s.storeColors.length; x++){
            elem.el.innerCodeBox.innerHTML += `$colors-${x + 1}: ${elem.s.storeColors[x]}; `;
        }

        elem.el.innerCodeBox.innerHTML += "
";

        for(let x = 0; x < elem.s.columnCount; x++){
            elem.el.innerCodeBox.innerHTML += `$X${x}: $num*${x}px; `;
        }
        //elem.el.innerCodeBox.innerHTML += `$num: ${elem.s.pixSize};<br>`;
        for(var y = 0; y < elem.s.columnCount; y++){
            elem.el.innerCodeBox.innerHTML += `$O${y}: $num*${y}px; `;
        }
        elem.el.innerCodeBox.innerHTML += "

";
    },

    convertToSass: () =>{

        elem.el.innerCodeBox.innerHTML += "box-shadow: ";
        for(var x = 0; x < elem.s.storeValues.length; x++) {
            elem.el.innerCodeBox.innerHTML += ` $X${parseFloat(elem.s.storeValues[x][0]) / elem.s.pixSize}`;
            elem.el.innerCodeBox.innerHTML += ` $O${parseFloat(elem.s.storeValues[x][1]) / elem.s.pixSize}`;
            //need to add support with name that color
            for(var y = 0; y < elem.s.storeColors.length; y++){
                if(elem.s.storeValues[x][2] === elem.s.storeColors[y]){
                    elem.el.innerCodeBox.innerHTML += ` $Colors-${elem.s.storeColors.indexOf(elem.s.storeValues[x][2]) + 1}`;
                }
            }
            if(x === elem.s.storeValues.length - 1){
                elem.el.innerCodeBox.innerHTML += ";";
            }
            else{
                elem.el.innerCodeBox.innerHTML += ",";
            }
        }
    },

    addLessVariables: () =>{
        elem.el.codeBox.classList.remove("css_box", "sass_box", "js_box");
        elem.el.codeBox.classList.add("less_box");

        elem.el.codeBoxBorder.classList.remove("css_border", "sass_border", "js_border");
        elem.el.codeBoxBorder.classList.add("less_border");

        elem.el.innerCodeBox.innerHTML = "@num:" + elem.s.pixSize + ";
";

        for(let x = 0; x < elem.s.storeColors.length; x++){
            elem.el.innerCodeBox.innerHTML += `@colors-${x + 1}: ${elem.s.storeColors[x]};`;
        }

        elem.el.innerCodeBox.innerHTML += "
";

        for(let x = 0; x < elem.s.columnCount; x++){
            elem.el.innerCodeBox.innerHTML += `@X${x}: @num*${x}px; `;
        }
        elem.el.innerCodeBox.innerHTML += `$num: ${elem.s.pixSize};<br>`;
        for(let y = 0; y < elem.s.columnCount; y++){
            elem.el.innerCodeBox.innerHTML += `@O${y}: @num*${y}px; `;
        }
        elem.el.innerCodeBox.innerHTML += "

";
    },

    convertToLess: () => {
        elem.el.innerCodeBox.innerHTML += "box-shadow: ";
        for (var xyz = 0; xyz < elem.s.storeValues.length; xyz++) {
            elem.el.innerCodeBox.innerHTML += " @X" + parseFloat(elem.s.storeValues[xyz][0]) / elem.s.pixSize;
            elem.el.innerCodeBox.innerHTML += " @O" + parseFloat(elem.s.storeValues[xyz][1]) / elem.s.pixSize;

            for(var x = 0; x < elem.s.storeColors.length; x++){
                if(elem.s.storeValues[xyz][2] === elem.s.storeColors[x]){
                    elem.el.innerCodeBox.innerHTML += ` @Colors-${elem.s.storeColors.indexOf(elem.s.storeValues[x][2]) + 1}`;
                }
            }

            if (xyz === elem.s.storeValues.length - 1) {
                elem.el.innerCodeBox.innerHTML += ";";
            }
            else {
                elem.el.innerCodeBox.innerHTML += ",";
            }
        }
    }
};

export default convert;

<commit_msg>sass works confirmed<commit_after>import elem from "./_elem.js";

var convert = {
    addSassVariables: () =>{
        elem.el.codeBox.classList.remove("css_box", "less_box", "js_box");
        elem.el.codeBox.classList.add("sass_box");

        elem.el.codeBoxBorder.classList.remove("css_border", "less_border", "js_border");
        elem.el.codeBoxBorder.classList.add("sass_border");

        elem.el.innerCodeBox.innerHTML = `$num: ${elem.s.pixSize};<br>`;
        for(let x = 0; x < elem.s.storeColors.length; x++){
            elem.el.innerCodeBox.innerHTML += `$colors-${x + 1}: ${elem.s.storeColors[x]}; `;
        }

        elem.el.innerCodeBox.innerHTML += "
";

        for(let x = 0; x < elem.s.columnCount; x++){
            elem.el.innerCodeBox.innerHTML += `$X${x}: $num*${x}px; `;
        }
        //elem.el.innerCodeBox.innerHTML += `$num: ${elem.s.pixSize};<br>`;
        for(var y = 0; y < elem.s.columnCount; y++){
            elem.el.innerCodeBox.innerHTML += `$O${y}: $num*${y}px; `;
        }
        elem.el.innerCodeBox.innerHTML += "

";
    },

    convertToSass: () =>{

        elem.el.innerCodeBox.innerHTML += "box-shadow: ";
        for(var x = 0; x < elem.s.storeValues.length; x++) {
            elem.el.innerCodeBox.innerHTML += ` $X${parseFloat(elem.s.storeValues[x][0]) / elem.s.pixSize}`;
            elem.el.innerCodeBox.innerHTML += ` $O${parseFloat(elem.s.storeValues[x][1]) / elem.s.pixSize}`;
            //need to add support with name that color
            for(var y = 0; y < elem.s.storeColors.length; y++){
                if(elem.s.storeValues[x][2] === elem.s.storeColors[y]){
                    elem.el.innerCodeBox.innerHTML += ` $colors-${elem.s.storeColors.indexOf(elem.s.storeValues[x][2]) + 1}`;
                }
            }
            if(x === elem.s.storeValues.length - 1){
                elem.el.innerCodeBox.innerHTML += ";";
            }
            else{
                elem.el.innerCodeBox.innerHTML += ",";
            }
        }
    },

    addLessVariables: () =>{
        elem.el.codeBox.classList.remove("css_box", "sass_box", "js_box");
        elem.el.codeBox.classList.add("less_box");

        elem.el.codeBoxBorder.classList.remove("css_border", "sass_border", "js_border");
        elem.el.codeBoxBorder.classList.add("less_border");

        elem.el.innerCodeBox.innerHTML = "@num:" + elem.s.pixSize + ";
";

        for(let x = 0; x < elem.s.storeColors.length; x++){
            elem.el.innerCodeBox.innerHTML += `@colors-${x + 1}: ${elem.s.storeColors[x]};`;
        }

        elem.el.innerCodeBox.innerHTML += "
";

        for(let x = 0; x < elem.s.columnCount; x++){
            elem.el.innerCodeBox.innerHTML += `@X${x}: @num*${x}px; `;
        }
        elem.el.innerCodeBox.innerHTML += `$num: ${elem.s.pixSize};<br>`;
        for(let y = 0; y < elem.s.columnCount; y++){
            elem.el.innerCodeBox.innerHTML += `@O${y}: @num*${y}px; `;
        }
        elem.el.innerCodeBox.innerHTML += "

";
    },

    convertToLess: () => {
        elem.el.innerCodeBox.innerHTML += "box-shadow: ";
        for (var xyz = 0; xyz < elem.s.storeValues.length; xyz++) {
            elem.el.innerCodeBox.innerHTML += " @X" + parseFloat(elem.s.storeValues[xyz][0]) / elem.s.pixSize;
            elem.el.innerCodeBox.innerHTML += " @O" + parseFloat(elem.s.storeValues[xyz][1]) / elem.s.pixSize;

            for(var x = 0; x < elem.s.storeColors.length; x++){
                if(elem.s.storeValues[xyz][2] === elem.s.storeColors[x]){
                    elem.el.innerCodeBox.innerHTML += ` @Colors-${elem.s.storeColors.indexOf(elem.s.storeValues[x][2]) + 1}`;
                }
            }

            if (xyz === elem.s.storeValues.length - 1) {
                elem.el.innerCodeBox.innerHTML += ";";
            }
            else {
                elem.el.innerCodeBox.innerHTML += ",";
            }
        }
    }
};

export default convert;

<|endoftext|>


<commit_before>'use strict'

module.exports = DynamicdatePlugin

function DynamicdatePlugin (editor) {
  editor.addMenuItem('dynamicdate', {
    context: 'insert',
    text: 'Dynamic date',
    type: 'menuitem',
    menu: [
      { text: 'sss' }
    ]
  })
}
<commit_msg>create menu list of available formats<commit_after>'use strict'

var DateTimeMenuItem = require('./DateTimeMenuItem')

module.exports = DynamicdatePlugin

function DynamicdatePlugin (editor) {
  // var now = new Date()
  editor.addMenuItem('dynamicdate', {
    context: 'insert',
    text: 'Dynamic date',
    type: 'menuitem',
    menu: [
      new DateTimeMenuItem('dd/mm/yyyy, HH\'h\'MM\'\'\'ss'),
      new DateTimeMenuItem('dd/mm/yyyy, HH\'h\'MM'),
      new DateTimeMenuItem('dd/mm/yyyy'),
      new DateTimeMenuItem('HH\'h\'MM\'\'\'ss'),
      new DateTimeMenuItem('HH\'h\'MM'),
      new DateTimeMenuItem('dddd'),
      new DateTimeMenuItem('dd'),
      new DateTimeMenuItem('mm'),
      new DateTimeMenuItem('mmmm'),
      new DateTimeMenuItem('yy'),
      new DateTimeMenuItem('yyyy')
    ]
  })
}
<|endoftext|>