diff --git a/assets/js/Model.js b/assets/js/Model.js index d36f0c7d..213ebd7f 100644 --- a/assets/js/Model.js +++ b/assets/js/Model.js @@ -8,7 +8,7 @@ global.OO = require( '../../node_modules/oojs/dist/oojs.js' ); App.Model = function appModel( translations ) { OO.EventEmitter.call( this ); this.localStorageKey = 'svgtranslate'; - this.translations = translations || {}; + this.translations = OO.copy( translations ) || {}; this.originalTranslations = OO.copy( this.translations ); this.sourceLang = null; this.targetLang = null; @@ -164,18 +164,24 @@ App.Model.prototype.getTargetTranslation = function ( nodeId ) { /** * Load model values from LocalStorage. + * @return {boolean} Whether translation changes were loaded. */ App.Model.prototype.loadFromLocalStorage = function () { var model = this, - changedTranslations = this.getLocalStorageValue( 'changedTranslations' ); + changedTranslations = this.getLocalStorageValue( 'changedTranslations' ), + changesFromOriginal = false; this.setSourceLang( this.getLocalStorageValue( 'sourceLang' ) ); this.setTargetLang( this.getLocalStorageValue( 'targetLang' ) ); // After setting the target language, update the translations. if ( changedTranslations ) { Object.keys( changedTranslations ).forEach( function ( nodeId ) { - model.setTargetTranslation( nodeId, changedTranslations[ nodeId ] ); + if ( model.getTargetTranslation( nodeId ) !== changedTranslations[ nodeId ] ) { + changesFromOriginal = true; + model.setTargetTranslation( nodeId, changedTranslations[ nodeId ] ); + } } ); } + return changesFromOriginal; }; /** diff --git a/assets/translate.js b/assets/translate.js index d98ddc05..3402abf8 100644 --- a/assets/translate.js +++ b/assets/translate.js @@ -110,7 +110,7 @@ $( function () { } ); // After adding all the event handlers above, update the widget values. - model.loadFromLocalStorage(); + appConfig.unsaved = model.loadFromLocalStorage(); if ( sourceLangWidget && targetLangWidget ) { sourceLangWidget.setValue( model.getSourceLang() ); targetLangWidget.setValue( model.getTargetLang() ); @@ -124,71 +124,80 @@ $( function () { * When a translation field is changed, update the image preview, and also mark the form as unsaved. */ $( window ).on( 'load', function () { - $( '.translation-fields .oo-ui-fieldLayout .oo-ui-inputWidget' ).each( function () { - var inputWiget = OO.ui.infuse( $( this ) ), - $imgElement = $( '#translation-image img' ), - targetLang = $( ':input[name="target-lang"]' ).val(), - updatePreviewImage = function () { - var requestParams = {}, - canUpload = false, - $uploadButtonElement = $( '#upload-button-widget' ), - uploadButtonWidget = OO.ui.infuse( $uploadButtonElement ); - - if ( window.alreadyUpdating ) { - // Otherwise, it will needlessly update when the input is being enabled - return; - } - window.alreadyUpdating = true; - // Show loading indicator. - $( '.image-column' ).addClass( 'loading' ); - // Go through all fields and construct the request parameters. - $( '.translation-fields .oo-ui-fieldLayout' ).each( function () { - var textChanged, - originalText = '', - fieldLayout = OO.ui.infuse( $( this ) ), - tspanId = fieldLayout.getField().data[ 'tspan-id' ], - text = fieldLayout.getField().getValue(); - if ( appConfig.translations[ tspanId ][ targetLang ] !== undefined ) { - originalText = appConfig.translations[ tspanId ][ targetLang ].text; + $( function () { + $( '.translation-fields .oo-ui-fieldLayout .oo-ui-inputWidget' ).each( function () { + var inputWiget = OO.ui.infuse( $( this ) ), + $imgElement = $( '#translation-image img' ), + targetLang = $( ':input[name="target-lang"]' ).val(), + updatePreviewImage = function () { + var requestParams = {}, + $uploadButtonElement = $( '#upload-button-widget' ), + uploadButtonWidget = OO.ui.infuse( $uploadButtonElement ); + + if ( window.alreadyUpdating ) { + // Otherwise, it will needlessly update when the input is being enabled + return; } - textChanged = text !== '' && text !== originalText; - requestParams[ tspanId ] = text; - canUpload = canUpload || ( textChanged && appConfig.loggedIn ); - } ); - // Update the image. - $.ajax( { - type: 'POST', - url: appConfig.baseUrl + 'api/translate/' + $imgElement.data( 'filename' ) + '/' + targetLang, - data: requestParams, - success: function ( result ) { - // Remove the loading class after the image layer has re-loaded. - appConfig.imageMapLayer.on( 'load', function () { + appConfig.unsaved = false; + window.alreadyUpdating = true; + // Show loading indicator. + $( '.image-column' ).addClass( 'loading' ); + // Go through all fields and construct the request parameters. + $( '.translation-fields .oo-ui-fieldLayout' ).each( function () { + var textChanged, + originalText = '', + fieldLayout = OO.ui.infuse( $( this ) ), + tspanId = fieldLayout.getField().data[ 'tspan-id' ], + text = fieldLayout.getField().getValue(); + if ( appConfig.translations[ tspanId ][ targetLang ] !== undefined ) { + originalText = appConfig.translations[ tspanId ][ targetLang ].text; + } + textChanged = text !== '' && text !== originalText; + requestParams[ tspanId ] = text; + appConfig.unsaved = appConfig.unsaved || textChanged; + } ); + + // Update the image. + $.ajax( { + type: 'POST', + url: appConfig.baseUrl + 'api/translate/' + $imgElement.data( 'filename' ) + '/' + targetLang, + data: requestParams, + success: function ( result ) { + // Remove the loading class after the image layer has re-loaded. + appConfig.imageMapLayer.on( 'load', function () { + $( '.image-column' ).removeClass( 'loading' ); + } ); + // Set the new image URL. + appConfig.imageMapLayer.setUrl( result.imageSrc ); + }, + error: function () { + OO.ui.alert( $.i18n( 'preview-error-occurred' ) ); $( '.image-column' ).removeClass( 'loading' ); - } ); - // Set the new image URL. - appConfig.imageMapLayer.setUrl( result.imageSrc ); - }, - error: function () { - OO.ui.alert( $.i18n( 'preview-error-occurred' ) ); - $( '.image-column' ).removeClass( 'loading' ); - }, - complete: function () { - window.alreadyUpdating = false; - } - } ); + }, + complete: function () { + window.alreadyUpdating = false; + } + } ); - // Disable the upload image if there's nothing to translate - uploadButtonWidget.setDisabled( !canUpload ); - }; + // Disable the upload image if there's nothing to translate. + uploadButtonWidget.setDisabled( !appConfig.unsaved || !appConfig.loggedIn ); + }; - // Update the preview image on field blur and after two seconds of no typing. - inputWiget.$input.on( 'blur', updatePreviewImage ); - inputWiget.on( 'change', OO.ui.debounce( updatePreviewImage, 2000 ) ); - inputWiget.on( 'change', function () { - appConfig.unsaved = true; + // Update the preview image on field blur and after two seconds of no typing. + inputWiget.$input.on( 'blur', updatePreviewImage ); + inputWiget.on( 'change', OO.ui.debounce( updatePreviewImage, 2000 ) ); + + // Also update on initial page load, to catch any browser- or model-supplied changes. + updatePreviewImage(); + + // And update on form submission. + $( 'form' ).on( 'submit', function ( e ) { + updatePreviewImage(); + if ( !appConfig.unsaved ) { + return e.preventDefault(); + } + } ); } ); - // Also update on initial page load, to catch any browser- or model-supplied changes. - updatePreviewImage(); } ); } ); diff --git a/public/assets/app.84ff4c25.js b/public/assets/app.95f71650.js similarity index 98% rename from public/assets/app.84ff4c25.js rename to public/assets/app.95f71650.js index 67828803..f51c7f29 100644 --- a/public/assets/app.84ff4c25.js +++ b/public/assets/app.95f71650.js @@ -9,7 +9,7 @@ * * Date: 2019-01-23T01:14:20Z */ -!function(t){"use strict";t.ui.WikimediaUITheme=function(){t.ui.WikimediaUITheme.parent.call(this)},t.inheritClass(t.ui.WikimediaUITheme,t.ui.Theme),t.ui.WikimediaUITheme.prototype.getElementClasses=function(e){var i,n,o,s,a={warning:!1,invert:!1,progressive:!1,destructive:!1},r=t.ui.WikimediaUITheme.parent.prototype.getElementClasses.call(this,e);for(i in e instanceof t.ui.IconWidget&&e.$element.hasClass("oo-ui-checkboxInputWidget-checkIcon")?a.invert=!0:e.supports(["hasFlag"])&&(n=e.supports(["isFramed"])&&e.isFramed(),o=e.supports(["isActive"])&&e.isActive(),s=t.ui.Tool&&e instanceof t.ui.Tool||t.ui.ToolGroup&&e instanceof t.ui.ToolGroup,n&&(o||e.isDisabled()||e.hasFlag("primary"))||s&&e.hasFlag("primary")?a.invert=!0:!n&&e.isDisabled()?a.invert=!1:e.isDisabled()||(a.progressive=e.hasFlag("progressive")||s&&o||(e instanceof t.ui.MenuOptionWidget||t.ui.OutlineOptionWidget&&e instanceof t.ui.OutlineOptionWidget)&&(e.isPressed()||e.isSelected()),a.destructive=e.hasFlag("destructive"),a.warning=e.hasFlag("warning"))),a)r[a[i]?"on":"off"].push("oo-ui-image-"+i);return r},t.ui.WikimediaUITheme.prototype.getDialogTransitionDuration=function(){return 250},t.ui.theme=new t.ui.WikimediaUITheme}(t)}).call(this,i("ovuR"))},"0oQ0":function(t,e,i){(function(t){!function(t){"use strict";var e;(e=function(e,i){var n;for(n in this.$element=t(e),this.options=t.extend({},t.fn.uls.defaults,i),this.$menu=t('
\t\t\t\t\t\t
\t\t\t
\t\t
'),this.languages=this.options.languages,this.languages)void 0===t.uls.data.languages[n]&&delete this.languages[n];this.left=this.options.left,this.top=this.options.top,this.shown=!1,this.initialized=!1,this.shouldRecreate=!1,this.menuWidth=this.getMenuWidth(),this.$languageFilter=this.$menu.find(".uls-languagefilter"),this.$resultsView=this.$menu.find(".uls-language-list"),this.render(),this.listen(),this.ready()}).prototype={constructor:e,ready:function(){this.options.onReady&&this.options.onReady.call(this)},visible:function(){this.options.onVisible&&this.options.onVisible.call(this)},position:function(){var e,i=this.top,n=this.left;return void 0===i&&(i=(e=t.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight})).top+e.height),void 0===n&&(n=t(window).width()/2-this.$menu.outerWidth()/2),{top:i,left:n}},show:function(){this.$menu.addClass({wide:"uls-wide",medium:"uls-medium",narrow:"uls-narrow"}[this.menuWidth]),this.initialized||(t("body").prepend(this.$menu),this.i18n(),this.initialized=!0),this.$menu.css(this.position()),this.$menu.show(),this.$menu.scrollIntoView(),this.shown=!0,this.isMobile()||this.$languageFilter.focus(),this.visible()},i18n:function(){t.i18n&&(this.$menu.find("[data-i18n]").i18n(),this.$languageFilter.prop("placeholder",t.i18n("uls-search-placeholder")))},hide:function(){this.$menu.hide(),this.shown=!1,this.$menu.removeClass("uls-wide uls-medium uls-narrow"),this.shouldRecreate&&this.recreateLanguageFilter(),this.options.onCancel&&this.options.onCancel.call(this)},render:function(){},success:function(){this.$resultsView.show()},createLanguageFilter:function(){var t,e;e=Object.keys(this.options.languages).length,t=this.$resultsView.lcd({languages:this.languages,columns:{wide:4,medium:2,narrow:1}[this.menuWidth],quickList:e>12?this.options.quickList:[],clickhandler:this.select.bind(this),showRegions:this.options.showRegions,languageDecorator:this.options.languageDecorator,noResultsTemplate:this.options.noResultsTemplate,itemsPerColumn:this.options.itemsPerColumn,groupByRegion:this.options.groupByRegion}).data("lcd"),this.$languageFilter.languagefilter({lcd:t,languages:this.languages,ulsPurpose:this.options.ulsPurpose,searchAPI:this.options.searchAPI,onSelect:this.select.bind(this)}),this.$languageFilter.on("noresults.uls",t.noResults.bind(t))},recreateLanguageFilter:function(){this.$resultsView.removeData("lcd"),this.$resultsView.empty(),this.$languageFilter.removeData("languagefilter"),this.createLanguageFilter(),this.shouldRecreate=!1},listen:function(){this.$element.on("click",this.click.bind(this)),this.$menu.on("click",function(t){t.stopPropagation()}),this.$menu.on("keydown",this.keypress.bind(this)),this.createLanguageFilter(),this.$languageFilter.on("resultsfound.uls",this.success.bind(this)),t("html").click(this.cancel.bind(this)),t(window).resize(t.fn.uls.debounce(this.resize.bind(this),250))},resize:function(){var t=this.getMenuWidth();this.menuWidth!==t&&(this.menuWidth=t,this.shouldRecreate=!0,this.shown||this.recreateLanguageFilter())},select:function(t,e){this.hide(),this.options.onSelect&&this.options.onSelect.call(this,t,e)},cancel:function(e){e&&(this.$element.is(e.target)||t.contains(this.$element[0],e.target))||this.hide()},keypress:function(t){this.shown&&27===t.keyCode&&(this.cancel(),t.preventDefault(),t.stopPropagation())},click:function(){this.shown?this.hide():this.show()},getMenuWidth:function(){var t,e=document.documentElement.clientWidth;return this.options.menuWidth?this.options.menuWidth:(t=Object.keys(this.options.languages).length,e>900&&t>=48?"wide":e>500&&t>=24?"medium":"narrow")},isMobile:function(){return navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)}},t.fn.uls=function(i){return this.each(function(){var n=t(this),o=n.data("uls"),s="object"==typeof i&&i;o||n.data("uls",o=new e(this,s)),"string"==typeof i&&o[i]()})},t.fn.uls.defaults={top:void 0,left:void 0,onSelect:void 0,onCancel:void 0,onReady:void 0,onVisible:void 0,languages:t.uls.data.getAutonyms(),menuWidth:void 0,ulsPurpose:"",quickList:[],showRegions:void 0,languageDecorator:void 0,noResultsTemplate:void 0,itemsPerColumn:void 0,groupByRegion:void 0,searchAPI:void 0},t.fn.i18n||(t.fn.i18n=function(){}),t.fn.uls.debounce=function(t,e,i){var n;return function(){var o,s=this;o=i&&!n,clearTimeout(n),n=setTimeout(function(){n=null,i||t.apply(s,arguments)},e||100),o&&t.apply(s,arguments)}},t.fn.scrollIntoView=function(){return this.each(function(){var e,i=t(window),n=i.height(),o=i.scrollTop(),s=o+n,a=t(this),r=a.height(),l=a.offset().top,u=l+r;(ls)&&(e=o>l?l:u-n,t("html, body").stop().animate({scrollTop:e},500))})},t.fn.uls.Constructor=e}(t)}).call(this,i("EVdn"))},"1Wo5":function(t,e,i){(function(t,e,n){e.OO=t,e.App=i("UmG/"),i("mwPO"),i("6efa"),i("5gvb"),i("2nf7"),n(function(){var t=n("html").attr("lang"),e={},i={};e[t]=appConfig.assetsPath+"/i18n/jquery.uls/"+t+".json",i[t]=appConfig.assetsPath+"/i18n/app/"+t+".json","en"!==t&&(e.en=appConfig.assetsPath+"/i18n/jquery.uls/en.json",i.en=appConfig.assetsPath+"/i18n/app/en.json"),n.i18n().locale=t,n.i18n().load(e),n.i18n().load(i).then(App.addLanguageSettingsLink)}),App.getCookieVal=function(t,e){var n=i("p46w").get("svgtranslate");if(n)try{return JSON.parse(n)[t]}catch(t){return e}return e},App.addLanguageSettingsLink=function(){var e=n("").html(n.i18n("language-settings")).attr("href","#lang-dialog").on("click",function(){var e=t.ui.getWindowManager(),i=new App.LanguageDialog({interfaceLang:n("html").attr("lang")});e.isElementAttached()||n("body").append(e.$element),e.addWindows([i]),e.openWindow(i)});n("nav.user ul").prepend(n("
  • ").append(e))},n(function(){var e=n("#search-widget");e.length>0&&t.ui.infuse(e)})}).call(this,i("ovuR"),i("yLpj"),i("EVdn"))},"2nf7":function(t,e){t.exports="../assets/images/fa-question-circle-solid.266cfdc5.svg"},"3iwj":function(t,e,i){(function(t){!function(t){"use strict";t.i18n.languages.ml=t.extend({},t.i18n.languages.default,{convertGrammar:function(t,e){switch(e=e.toLowerCase()){case"ഉദ്ദേശിക":case"dative":"ു"===t.slice(-1)||"ൂ"===t.slice(-1)||"ൗ"===t.slice(-1)||"ൌ"===t.slice(-1)?t+="വിന്":"ം"===t.slice(-1)?t=t.slice(0,-1)+"ത്തിന്":"ൻ"===t.slice(-1)?t=t.slice(0,-1)+"ന്":"ന്‍"===t.slice(-3)?t=t.slice(0,-1):"ൾ"===t.slice(-1)||"ള്‍"===t.slice(-3)?t+="ക്ക്":"ർ"===t.slice(-1)||"ര്‍"===t.slice(-3)?t+="ക്ക്":"ൽ"===t.slice(-1)?t=t.slice(0,-1)+"ലിന്":"ല്‍"===t.slice(-3)?t=t.slice(0,-2)+"ിന്":"ു്"===t.slice(-2)?t=t.slice(0,-2)+"ിന്":"്"===t.slice(-1)?t=t.slice(0,-1)+"ിന്":t+="യ്ക്ക്";break;case"സംബന്ധിക":case"genitive":"ം"===t.slice(-1)?t=t.slice(0,-1)+"ത്തിന്റെ":"ു്"===t.slice(-2)?t=t.slice(0,-2)+"ിന്റെ":"്"===t.slice(-1)?t=t.slice(0,-1)+"ിന്റെ":"ു"===t.slice(-1)||"ൂ"===t.slice(-1)||"ൗ"===t.slice(-1)||"ൌ"===t.slice(-1)?t+="വിന്റെ":"ൻ"===t.slice(-1)?t=t.slice(0,-1)+"ന്റെ":"ന്‍"===t.slice(-3)?t=t.slice(0,-1)+"റെ":"ള്‍"===t.slice(-3)?t=t.slice(0,-2)+"ുടെ":"ൾ"===t.slice(-1)?t=t.slice(0,-1)+"ളുടെ":"ൽ"===t.slice(-1)?t=t.slice(0,-1)+"ലിന്റെ":"ല്‍"===t.slice(-3)?t=t.slice(0,-2)+"ിന്റെ":"ര്‍"===t.slice(-3)?t=t.slice(0,-2)+"ുടെ":"ർ"===t.slice(-1)?t=t.slice(0,-1)+"രുടെ":t+="യുടെ"}return t}})}(t)}).call(this,i("EVdn"))},"5gvb":function(t,e){t.exports="../assets/images/download.82450a39.svg"},"6NS1":function(t,e,i){},"6R2C":function(t,e,i){(function(t){!function(t){"use strict";t.uls.data.isRedirect=function(e){return void 0!==t.uls.data.languages[e]&&1===t.uls.data.languages[e].length&&t.uls.data.languages[e][0]},t.uls.data.getScript=function(e){var i=t.uls.data.isRedirect(e);return i?t.uls.data.getScript(i):t.uls.data.languages[e]?t.uls.data.languages[e][0]:"Zyyy"},t.uls.data.getRegions=function(e){var i=t.uls.data.isRedirect(e);return i?t.uls.data.getRegions(i):t.uls.data.languages[e]&&t.uls.data.languages[e][1]||"UNKNOWN"},t.uls.data.getAutonym=function(e){var i=t.uls.data.isRedirect(e);return i?t.uls.data.getAutonym(i):t.uls.data.languages[e]&&t.uls.data.languages[e][2]||e},t.uls.data.getAutonyms=function(){var e,i={};for(e in t.uls.data.languages)t.uls.data.isRedirect(e)||(i[e]=t.uls.data.getAutonym(e));return i},t.uls.data.getLanguagesInScript=function(e){return t.uls.data.getLanguagesInScripts([e])},t.uls.data.getLanguagesInScripts=function(e){var i,n,o=[];for(i in t.uls.data.languages)if(!t.uls.data.isRedirect(i))for(n=0;n \t\t\t\t\t\t
    \t\t\t
    \t\t'),this.languages=this.options.languages,this.languages)void 0===t.uls.data.languages[n]&&delete this.languages[n];this.left=this.options.left,this.top=this.options.top,this.shown=!1,this.initialized=!1,this.shouldRecreate=!1,this.menuWidth=this.getMenuWidth(),this.$languageFilter=this.$menu.find(".uls-languagefilter"),this.$resultsView=this.$menu.find(".uls-language-list"),this.render(),this.listen(),this.ready()}).prototype={constructor:e,ready:function(){this.options.onReady&&this.options.onReady.call(this)},visible:function(){this.options.onVisible&&this.options.onVisible.call(this)},position:function(){var e,i=this.top,n=this.left;return void 0===i&&(i=(e=t.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight})).top+e.height),void 0===n&&(n=t(window).width()/2-this.$menu.outerWidth()/2),{top:i,left:n}},show:function(){this.$menu.addClass({wide:"uls-wide",medium:"uls-medium",narrow:"uls-narrow"}[this.menuWidth]),this.initialized||(t("body").prepend(this.$menu),this.i18n(),this.initialized=!0),this.$menu.css(this.position()),this.$menu.show(),this.$menu.scrollIntoView(),this.shown=!0,this.isMobile()||this.$languageFilter.focus(),this.visible()},i18n:function(){t.i18n&&(this.$menu.find("[data-i18n]").i18n(),this.$languageFilter.prop("placeholder",t.i18n("uls-search-placeholder")))},hide:function(){this.$menu.hide(),this.shown=!1,this.$menu.removeClass("uls-wide uls-medium uls-narrow"),this.shouldRecreate&&this.recreateLanguageFilter(),this.options.onCancel&&this.options.onCancel.call(this)},render:function(){},success:function(){this.$resultsView.show()},createLanguageFilter:function(){var t,e;e=Object.keys(this.options.languages).length,t=this.$resultsView.lcd({languages:this.languages,columns:{wide:4,medium:2,narrow:1}[this.menuWidth],quickList:e>12?this.options.quickList:[],clickhandler:this.select.bind(this),showRegions:this.options.showRegions,languageDecorator:this.options.languageDecorator,noResultsTemplate:this.options.noResultsTemplate,itemsPerColumn:this.options.itemsPerColumn,groupByRegion:this.options.groupByRegion}).data("lcd"),this.$languageFilter.languagefilter({lcd:t,languages:this.languages,ulsPurpose:this.options.ulsPurpose,searchAPI:this.options.searchAPI,onSelect:this.select.bind(this)}),this.$languageFilter.on("noresults.uls",t.noResults.bind(t))},recreateLanguageFilter:function(){this.$resultsView.removeData("lcd"),this.$resultsView.empty(),this.$languageFilter.removeData("languagefilter"),this.createLanguageFilter(),this.shouldRecreate=!1},listen:function(){this.$element.on("click",this.click.bind(this)),this.$menu.on("click",function(t){t.stopPropagation()}),this.$menu.on("keydown",this.keypress.bind(this)),this.createLanguageFilter(),this.$languageFilter.on("resultsfound.uls",this.success.bind(this)),t("html").click(this.cancel.bind(this)),t(window).resize(t.fn.uls.debounce(this.resize.bind(this),250))},resize:function(){var t=this.getMenuWidth();this.menuWidth!==t&&(this.menuWidth=t,this.shouldRecreate=!0,this.shown||this.recreateLanguageFilter())},select:function(t,e){this.hide(),this.options.onSelect&&this.options.onSelect.call(this,t,e)},cancel:function(e){e&&(this.$element.is(e.target)||t.contains(this.$element[0],e.target))||this.hide()},keypress:function(t){this.shown&&27===t.keyCode&&(this.cancel(),t.preventDefault(),t.stopPropagation())},click:function(){this.shown?this.hide():this.show()},getMenuWidth:function(){var t,e=document.documentElement.clientWidth;return this.options.menuWidth?this.options.menuWidth:(t=Object.keys(this.options.languages).length,e>900&&t>=48?"wide":e>500&&t>=24?"medium":"narrow")},isMobile:function(){return navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)}},t.fn.uls=function(i){return this.each(function(){var n=t(this),o=n.data("uls"),s="object"==typeof i&&i;o||n.data("uls",o=new e(this,s)),"string"==typeof i&&o[i]()})},t.fn.uls.defaults={top:void 0,left:void 0,onSelect:void 0,onCancel:void 0,onReady:void 0,onVisible:void 0,languages:t.uls.data.getAutonyms(),menuWidth:void 0,ulsPurpose:"",quickList:[],showRegions:void 0,languageDecorator:void 0,noResultsTemplate:void 0,itemsPerColumn:void 0,groupByRegion:void 0,searchAPI:void 0},t.fn.i18n||(t.fn.i18n=function(){}),t.fn.uls.debounce=function(t,e,i){var n;return function(){var o,s=this;o=i&&!n,clearTimeout(n),n=setTimeout(function(){n=null,i||t.apply(s,arguments)},e||100),o&&t.apply(s,arguments)}},t.fn.scrollIntoView=function(){return this.each(function(){var e,i=t(window),n=i.height(),o=i.scrollTop(),s=o+n,a=t(this),r=a.height(),l=a.offset().top,u=l+r;(ls)&&(e=o>l?l:u-n,t("html, body").stop().animate({scrollTop:e},500))})},t.fn.uls.Constructor=e}(t)}).call(this,i("EVdn"))},"1Wo5":function(t,e,i){(function(t,e,n){e.OO=t,e.App=i("UmG/"),i("mwPO"),i("6efa"),i("5gvb"),i("2nf7"),n(function(){var t=n("html").attr("lang"),e={},i={};e[t]=appConfig.assetsPath+"/i18n/jquery.uls/"+t+".json",i[t]=appConfig.assetsPath+"/i18n/app/"+t+".json","en"!==t&&(e.en=appConfig.assetsPath+"/i18n/jquery.uls/en.json",i.en=appConfig.assetsPath+"/i18n/app/en.json"),n.i18n().locale=t,n.i18n().load(e),n.i18n().load(i).then(App.addLanguageSettingsLink)}),App.getCookieVal=function(t,e){var n=i("p46w").get("svgtranslate");if(n)try{return JSON.parse(n)[t]}catch(t){return e}return e},App.addLanguageSettingsLink=function(){var e=n("
    ").html(n.i18n("language-settings")).attr("href","#lang-dialog").on("click",function(){var e=t.ui.getWindowManager(),i=new App.LanguageDialog({interfaceLang:n("html").attr("lang")});e.isElementAttached()||n("body").append(e.$element),e.addWindows([i]),e.openWindow(i)});n("nav.user ul").prepend(n("
  • ").append(e))},n(function(){var e=n("#search-widget");e.length>0&&t.ui.infuse(e)})}).call(this,i("ovuR"),i("yLpj"),i("EVdn"))},"2nf7":function(t,e){t.exports="../assets/images/fa-question-circle-solid.266cfdc5.svg"},"3iwj":function(t,e,i){(function(t){!function(t){"use strict";t.i18n.languages.ml=t.extend({},t.i18n.languages.default,{convertGrammar:function(t,e){switch(e=e.toLowerCase()){case"ഉദ്ദേശിക":case"dative":"ു"===t.slice(-1)||"ൂ"===t.slice(-1)||"ൗ"===t.slice(-1)||"ൌ"===t.slice(-1)?t+="വിന്":"ം"===t.slice(-1)?t=t.slice(0,-1)+"ത്തിന്":"ൻ"===t.slice(-1)?t=t.slice(0,-1)+"ന്":"ന്‍"===t.slice(-3)?t=t.slice(0,-1):"ൾ"===t.slice(-1)||"ള്‍"===t.slice(-3)?t+="ക്ക്":"ർ"===t.slice(-1)||"ര്‍"===t.slice(-3)?t+="ക്ക്":"ൽ"===t.slice(-1)?t=t.slice(0,-1)+"ലിന്":"ല്‍"===t.slice(-3)?t=t.slice(0,-2)+"ിന്":"ു്"===t.slice(-2)?t=t.slice(0,-2)+"ിന്":"്"===t.slice(-1)?t=t.slice(0,-1)+"ിന്":t+="യ്ക്ക്";break;case"സംബന്ധിക":case"genitive":"ം"===t.slice(-1)?t=t.slice(0,-1)+"ത്തിന്റെ":"ു്"===t.slice(-2)?t=t.slice(0,-2)+"ിന്റെ":"്"===t.slice(-1)?t=t.slice(0,-1)+"ിന്റെ":"ു"===t.slice(-1)||"ൂ"===t.slice(-1)||"ൗ"===t.slice(-1)||"ൌ"===t.slice(-1)?t+="വിന്റെ":"ൻ"===t.slice(-1)?t=t.slice(0,-1)+"ന്റെ":"ന്‍"===t.slice(-3)?t=t.slice(0,-1)+"റെ":"ള്‍"===t.slice(-3)?t=t.slice(0,-2)+"ുടെ":"ൾ"===t.slice(-1)?t=t.slice(0,-1)+"ളുടെ":"ൽ"===t.slice(-1)?t=t.slice(0,-1)+"ലിന്റെ":"ല്‍"===t.slice(-3)?t=t.slice(0,-2)+"ിന്റെ":"ര്‍"===t.slice(-3)?t=t.slice(0,-2)+"ുടെ":"ർ"===t.slice(-1)?t=t.slice(0,-1)+"രുടെ":t+="യുടെ"}return t}})}(t)}).call(this,i("EVdn"))},"5gvb":function(t,e){t.exports="../assets/images/download.82450a39.svg"},"6NS1":function(t,e,i){},"6R2C":function(t,e,i){(function(t){!function(t){"use strict";t.uls.data.isRedirect=function(e){return void 0!==t.uls.data.languages[e]&&1===t.uls.data.languages[e].length&&t.uls.data.languages[e][0]},t.uls.data.getScript=function(e){var i=t.uls.data.isRedirect(e);return i?t.uls.data.getScript(i):t.uls.data.languages[e]?t.uls.data.languages[e][0]:"Zyyy"},t.uls.data.getRegions=function(e){var i=t.uls.data.isRedirect(e);return i?t.uls.data.getRegions(i):t.uls.data.languages[e]&&t.uls.data.languages[e][1]||"UNKNOWN"},t.uls.data.getAutonym=function(e){var i=t.uls.data.isRedirect(e);return i?t.uls.data.getAutonym(i):t.uls.data.languages[e]&&t.uls.data.languages[e][2]||e},t.uls.data.getAutonyms=function(){var e,i={};for(e in t.uls.data.languages)t.uls.data.isRedirect(e)||(i[e]=t.uls.data.getAutonym(e));return i},t.uls.data.getLanguagesInScript=function(e){return t.uls.data.getLanguagesInScripts([e])},t.uls.data.getLanguagesInScripts=function(e){var i,n,o=[];for(i in t.uls.data.languages)if(!t.uls.data.isRedirect(i))for(n=0;n-1)return!0;for(n=0;n1},setGroupByRegionOverride:function(t){this.groupByRegionOverride=t},render:function(){var t,i=this.buildQuicklist(),n=[],o={all:"All languages",WW:"Worldwide",SP:"Special",AM:"America",EU:"Europe",ME:"Middle East",AS:"Asia",AF:"Africa",PA:"Pacific"};i.length?n.push(i):this.$element.addClass("uls-lcd--no-quicklist"),this.options.showRegions.forEach(function(i){this.regionLanguages[i]=[],t=e("
    ").addClass("uls-lcd-region-section hide").attr("data-region",i),e("

    ").attr("data-i18n","uls-region-"+i).addClass("uls-lcd-region-title").text(o[i]).appendTo(t),n.push(t)}.bind(this)),this.$element.append(n),this.i18n()},renderRegions:function(){var t,i=this;this.$element.removeClass("uls-no-results"),this.$element.children(".uls-lcd-region-section").each(function(){var n=e(this),o=n.data("region");n.is(".uls-lcd-quicklist")||(n.children(".uls-language-block").remove(),(t=i.regionLanguages[o])&&0!==t.length?(i.renderRegion(n,t,i.options.itemsPerColumn,i.options.columns),n.removeClass("hide"),i.regionLanguages[o]=[]):n.addClass("hide"))})},renderRegion:function(t,i,n,o){var s,a,r,l,u,h,c=i.length,d=[],p=[],g=[];if(i=e.uls.data.sortByScriptGroup(i.sort(e.uls.data.sortByAutonym)),s=1===o?"twelve columns":2===o?"six columns":"three columns",1===this.options.columns){for(a=0;a").addClass(s).append(d)),g.push(e("
    ").addClass("row uls-language-block").append(p))}else for(a=0;a1&&(h=!0):l=e.uls.data.getScriptGroupOfLanguage(i[a]),l=u,d.push(this.renderItem(i[a])),(d.length>=n||r||h)&&(p.push(e("
      ").addClass(s).append(d)),d=[],(p.length>=o||r)&&(g.push(e("
      ").addClass("row uls-language-block").append(p)),p=[]));t.append(g)},renderItem:function(t){var i,n,o,s;return n=this.options.languages[t],o=e.uls.data.getAutonym(t)||n||t,(s=document.createElement("li")).title=n,s.setAttribute("data-code",t),(i=document.createElement("a")).appendChild(document.createTextNode(o)),i.className="autonym",i.lang=t,i.dir=e.uls.data.getDir(t),s.appendChild(i),this.options.languageDecorator&&this.options.languageDecorator(e(i),t),s},i18n:function(){this.$element.find("[data-i18n]").i18n()},quicklist:function(){this.$element.find(".uls-lcd-quicklist").removeClass("hide")},buildQuicklist:function(){var t,i,n;return null!==this.cachedQuicklist?this.cachedQuicklist:(e.isFunction(this.options.quickList)&&(this.options.quickList=this.options.quickList()),this.options.quickList.length?((t=(t=this.options.quickList).slice(0,16)).sort(e.uls.data.sortByAutonym),i=e("
      ").addClass("uls-lcd-region-section uls-lcd-quicklist"),n=e("

      ").attr("data-i18n","uls-common-languages").addClass("uls-lcd-region-title").text("Suggested languages"),i.append(n),this.renderRegion(i,t,this.options.itemsPerColumn,this.options.columns),n.i18n(),this.cachedQuicklist=i,this.cachedQuicklist):(this.cachedQuicklist=e([]),this.cachedQuicklist))},show:function(){this.regionDivs||this.render()},empty:function(){this.$element.addClass("uls-lcd--no-quicklist"),this.$element.find(".uls-lcd-quicklist").addClass("hide")},focus:function(){this.$element.focus()},noResults:function(e,i){var n;if(this.$element.addClass("uls-no-results"),this.$element.find(".uls-no-results-view").remove(),"function"==typeof this.options.noResultsTemplate)n=this.options.noResultsTemplate.call(this,i.query);else{if(!(this.options.noResultsTemplate instanceof t))throw new Error("noResultsTemplate option must be either jQuery or function returning jQuery");n=this.options.noResultsTemplate}this.$element.append(n.addClass("uls-no-results-view").i18n())},listen:function(){var t=this;this.options.clickhandler&&this.$element.on("click",".row li",function(i){t.options.clickhandler.call(this,e(this).data("code"),i)})}},e.fn.lcd=function(t){return this.each(function(){var n=e(this),o=n.data("lcd"),s="object"==typeof t&&t;o||n.data("lcd",o=new i(this,s)),"string"==typeof t&&o[t]()})},e.fn.lcd.defaults={languages:[],showRegions:["WW","AM","EU","ME","AF","AS","PA"],groupByRegion:"auto",itemsPerColumn:8,columns:4,languageDecorator:void 0,quickList:[],clickhandler:void 0,noResultsTemplate:function(){var t,i=e('
      \t\t

      No results found

      \t\t
      \t\t
      \t\t
      You can search by language name, script name, ISO code of language or you can browse by region.
      \t\t
      ');return(t=this.buildQuicklist().clone()).removeClass("hide").find("h3").data("i18n","uls-no-results-suggestion-title").text("You may be interested in:").i18n(),i.find(".uls-no-results-suggestions").append(t),i}}}(t)}).call(this,i("EVdn"))},ML86:function(t,e,i){},Mh5E:function(t,e,i){(function(t){var e;!function(){return function t(i,n,o){function s(r,l){if(!n[r]){if(!i[r]){if(!l&&"function"==typeof e&&e)return e(r,!0);if(a)return a(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var h=n[r]={exports:{}};i[r][0].call(h.exports,function(t){return s(i[r][1][t]||t)},h,h.exports,t,i,n,o)}return n[r].exports}for(var a="function"==typeof e&&e,r=0;r").attr("type","hidden").attr("name","upload");e.prepend(n),i.setLabel(t.i18n("upload-button-in-progress")),i.setDisabled(!0),e.submit()})})}).call(this,i("EVdn"),i("ovuR"))},anCX:function(t,e,i){(function(t){!function(t){"use strict";t.i18n.languages.fi=t.extend({},t.i18n.languages.default,{convertGrammar:function(t,e){var i=t.match(/[aou][^äöy]*$/i),n=t;switch(t.match(/wiki$/i)&&(i=!1),t.match(/[bcdfghjklmnpqrstvwxz]$/i)&&(t+="i"),e){case"genitive":t+="n";break;case"elative":t+=i?"sta":"stä";break;case"partitive":t+=i?"a":"ä";break;case"illative":t+=t.slice(-1)+"n";break;case"inessive":t+=i?"ssa":"ssä";break;default:t=n}return t}})}(t)}).call(this,i("EVdn"))},bMVF:function(t,e,i){},gXRV:function(t,e,i){},iGkt:function(t,e,i){(function(t,e){App.InterfaceLangButton=function(e){this.interfaceLang=e.interfaceLang,this.currentLang=this.interfaceLang,e=t.extend({indicator:"down",label:appConfig.languages[this.interfaceLang]},e),App.InterfaceLangButton.super.call(this,e)},e.inheritClass(App.InterfaceLangButton,e.ui.ButtonWidget),App.InterfaceLangButton.prototype.onClick=function(t){this.$element.uls({ulsPurpose:"interfaceLang",languages:appConfig.languages,onSelect:this.onUlsSelect.bind(this),top:App.LanguageDialog.prototype.calculateUlsTop.bind(this.$element)})},App.InterfaceLangButton.prototype.onUlsSelect=function(t){this.setLabel(appConfig.languages[t]),this.currentLang=t}}).call(this,i("EVdn"),i("ovuR"))},lK6O:function(t,e,i){ +!function(t){"use strict";var e,i,n,o=Array.prototype.slice;(e=function(i){this.options=t.extend({},e.defaults,i),this.parser=this.options.parser,this.locale=this.options.locale,this.messageStore=this.options.messageStore,this.languages={}}).prototype={localize:function(e){var i,n,o,s,a,r;for(o=this.locale,s=0;o;){n=(i=o.split("-")).length;do{if(a=i.slice(0,n).join("-"),r=this.messageStore.get(a,e))return r;n--}while(n);if("en"===o)break;o=t.i18n.fallbacks[this.locale]&&t.i18n.fallbacks[this.locale][s]||this.options.fallbackLocale,t.i18n.log("Trying fallback locale for "+this.locale+": "+o+" ("+e+")"),s++}return""},destroy:function(){t.removeData(document,"i18n")},load:function(e,i){var n,o,s,a={};if(e||i||(e="i18n/"+t.i18n().locale+".json",i=t.i18n().locale),"string"==typeof e&&"json"!==e.split("?")[0].split(".").pop()){for(a[i]=e+"/"+i+".json",n=(t.i18n.fallbacks[i]||[]).concat(this.options.fallbackLocale),o=0;o-1)return!0;for(n=0;n1},setGroupByRegionOverride:function(t){this.groupByRegionOverride=t},render:function(){var t,i=this.buildQuicklist(),n=[],o={all:"All languages",WW:"Worldwide",SP:"Special",AM:"America",EU:"Europe",ME:"Middle East",AS:"Asia",AF:"Africa",PA:"Pacific"};i.length?n.push(i):this.$element.addClass("uls-lcd--no-quicklist"),this.options.showRegions.forEach(function(i){this.regionLanguages[i]=[],t=e("
      ").addClass("uls-lcd-region-section hide").attr("data-region",i),e("

      ").attr("data-i18n","uls-region-"+i).addClass("uls-lcd-region-title").text(o[i]).appendTo(t),n.push(t)}.bind(this)),this.$element.append(n),this.i18n()},renderRegions:function(){var t,i=this;this.$element.removeClass("uls-no-results"),this.$element.children(".uls-lcd-region-section").each(function(){var n=e(this),o=n.data("region");n.is(".uls-lcd-quicklist")||(n.children(".uls-language-block").remove(),(t=i.regionLanguages[o])&&0!==t.length?(i.renderRegion(n,t,i.options.itemsPerColumn,i.options.columns),n.removeClass("hide"),i.regionLanguages[o]=[]):n.addClass("hide"))})},renderRegion:function(t,i,n,o){var s,a,r,l,u,h,c=i.length,d=[],p=[],g=[];if(i=e.uls.data.sortByScriptGroup(i.sort(e.uls.data.sortByAutonym)),s=1===o?"twelve columns":2===o?"six columns":"three columns",1===this.options.columns){for(a=0;a").addClass(s).append(d)),g.push(e("
      ").addClass("row uls-language-block").append(p))}else for(a=0;a1&&(h=!0):l=e.uls.data.getScriptGroupOfLanguage(i[a]),l=u,d.push(this.renderItem(i[a])),(d.length>=n||r||h)&&(p.push(e("
        ").addClass(s).append(d)),d=[],(p.length>=o||r)&&(g.push(e("
        ").addClass("row uls-language-block").append(p)),p=[]));t.append(g)},renderItem:function(t){var i,n,o,s;return n=this.options.languages[t],o=e.uls.data.getAutonym(t)||n||t,(s=document.createElement("li")).title=n,s.setAttribute("data-code",t),(i=document.createElement("a")).appendChild(document.createTextNode(o)),i.className="autonym",i.lang=t,i.dir=e.uls.data.getDir(t),s.appendChild(i),this.options.languageDecorator&&this.options.languageDecorator(e(i),t),s},i18n:function(){this.$element.find("[data-i18n]").i18n()},quicklist:function(){this.$element.find(".uls-lcd-quicklist").removeClass("hide")},buildQuicklist:function(){var t,i,n;return null!==this.cachedQuicklist?this.cachedQuicklist:(e.isFunction(this.options.quickList)&&(this.options.quickList=this.options.quickList()),this.options.quickList.length?((t=(t=this.options.quickList).slice(0,16)).sort(e.uls.data.sortByAutonym),i=e("
        ").addClass("uls-lcd-region-section uls-lcd-quicklist"),n=e("

        ").attr("data-i18n","uls-common-languages").addClass("uls-lcd-region-title").text("Suggested languages"),i.append(n),this.renderRegion(i,t,this.options.itemsPerColumn,this.options.columns),n.i18n(),this.cachedQuicklist=i,this.cachedQuicklist):(this.cachedQuicklist=e([]),this.cachedQuicklist))},show:function(){this.regionDivs||this.render()},empty:function(){this.$element.addClass("uls-lcd--no-quicklist"),this.$element.find(".uls-lcd-quicklist").addClass("hide")},focus:function(){this.$element.focus()},noResults:function(e,i){var n;if(this.$element.addClass("uls-no-results"),this.$element.find(".uls-no-results-view").remove(),"function"==typeof this.options.noResultsTemplate)n=this.options.noResultsTemplate.call(this,i.query);else{if(!(this.options.noResultsTemplate instanceof t))throw new Error("noResultsTemplate option must be either jQuery or function returning jQuery");n=this.options.noResultsTemplate}this.$element.append(n.addClass("uls-no-results-view").i18n())},listen:function(){var t=this;this.options.clickhandler&&this.$element.on("click",".row li",function(i){t.options.clickhandler.call(this,e(this).data("code"),i)})}},e.fn.lcd=function(t){return this.each(function(){var n=e(this),o=n.data("lcd"),s="object"==typeof t&&t;o||n.data("lcd",o=new i(this,s)),"string"==typeof t&&o[t]()})},e.fn.lcd.defaults={languages:[],showRegions:["WW","AM","EU","ME","AF","AS","PA"],groupByRegion:"auto",itemsPerColumn:8,columns:4,languageDecorator:void 0,quickList:[],clickhandler:void 0,noResultsTemplate:function(){var t,i=e('
        \t\t

        No results found

        \t\t
        \t\t
        \t\t
        You can search by language name, script name, ISO code of language or you can browse by region.
        \t\t
        ');return(t=this.buildQuicklist().clone()).removeClass("hide").find("h3").data("i18n","uls-no-results-suggestion-title").text("You may be interested in:").i18n(),i.find(".uls-no-results-suggestions").append(t),i}}}(t)}).call(this,i("EVdn"))},ML86:function(t,e,i){},Mh5E:function(t,e,i){(function(t){var e;!function(){return function t(i,n,o){function s(r,l){if(!n[r]){if(!i[r]){if(!l&&"function"==typeof e&&e)return e(r,!0);if(a)return a(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var h=n[r]={exports:{}};i[r][0].call(h.exports,function(t){return s(i[r][1][t]||t)},h,h.exports,t,i,n,o)}return n[r].exports}for(var a="function"==typeof e&&e,r=0;r").attr("type","hidden").attr("name","upload");e.prepend(n),i.setLabel(t.i18n("upload-button-in-progress")),i.setDisabled(!0),e.submit()})})}).call(this,i("EVdn"),i("ovuR"))},anCX:function(t,e,i){(function(t){!function(t){"use strict";t.i18n.languages.fi=t.extend({},t.i18n.languages.default,{convertGrammar:function(t,e){var i=t.match(/[aou][^äöy]*$/i),n=t;switch(t.match(/wiki$/i)&&(i=!1),t.match(/[bcdfghjklmnpqrstvwxz]$/i)&&(t+="i"),e){case"genitive":t+="n";break;case"elative":t+=i?"sta":"stä";break;case"partitive":t+=i?"a":"ä";break;case"illative":t+=t.slice(-1)+"n";break;case"inessive":t+=i?"ssa":"ssä";break;default:t=n}return t}})}(t)}).call(this,i("EVdn"))},bMVF:function(t,e,i){},gXRV:function(t,e,i){},iGkt:function(t,e,i){(function(t,e){App.InterfaceLangButton=function(e){this.interfaceLang=e.interfaceLang,this.currentLang=this.interfaceLang,e=t.extend({indicator:"down",label:appConfig.languages[this.interfaceLang]},e),App.InterfaceLangButton.super.call(this,e)},e.inheritClass(App.InterfaceLangButton,e.ui.ButtonWidget),App.InterfaceLangButton.prototype.onClick=function(t){this.$element.uls({ulsPurpose:"interfaceLang",languages:appConfig.languages,onSelect:this.onUlsSelect.bind(this),top:App.LanguageDialog.prototype.calculateUlsTop.bind(this.$element)})},App.InterfaceLangButton.prototype.onUlsSelect=function(t){this.setLabel(appConfig.languages[t]),this.currentLang=t}}).call(this,i("EVdn"),i("ovuR"))},lK6O:function(t,e,i){ /* @preserve * Leaflet 1.4.0, a JS library for interactive maps. http://leafletjs.com * (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade diff --git a/public/assets/entrypoints.json b/public/assets/entrypoints.json index 38f4e153..7cb620a3 100644 --- a/public/assets/entrypoints.json +++ b/public/assets/entrypoints.json @@ -5,7 +5,7 @@ "assets/app.0fb3aba2.css" ], "js": [ - "assets/app.84ff4c25.js" + "assets/app.95f71650.js" ] } } diff --git a/public/assets/manifest.json b/public/assets/manifest.json index e8446180..2acd9317 100644 --- a/public/assets/manifest.json +++ b/public/assets/manifest.json @@ -1,6 +1,6 @@ { "assets/app.css": "assets/app.0fb3aba2.css", - "assets/app.js": "assets/app.84ff4c25.js", + "assets/app.js": "assets/app.95f71650.js", "assets/grabbing.cur": "assets/a8c874b93b3d848f39a71260c57e3863.cur", "assets/grab.cur": "assets/b06c243f534d9c5461d16528156cd5a8.cur", "assets/i18n/app/af.json": "assets/i18n/app/af.json",