# HG changeset patch # User Thierry Florac # Date 1545311625 -3600 # Node ID 7d479c20ee49b88c51488705db85d22d9ccf5146 # Parent 46ebb8b63379d3a56f22316c29b89ff9591cea41 Added plug-in and function to export datatable contents as TSV diff -r 46ebb8b63379 -r 7d479c20ee49 src/pyams_skin/resources/js/ext/js-filesaver.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/js-filesaver.js Thu Dec 20 14:13:45 2018 +0100 @@ -0,0 +1,180 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define([], factory); + } else if (typeof exports !== "undefined") { + factory(); + } else { + var mod = { + exports: {} + }; + factory(); + global.FileSaver = mod.exports; + } +})(this, function () { + "use strict"; + + /* + * FileSaver.js + * A saveAs() FileSaver implementation. + * + * By Eli Grey, http://eligrey.com + * + * License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT) + * source : http://purl.eligrey.com/github/FileSaver.js + */ + // The one and only way of getting global scope in all environments + // https://stackoverflow.com/q/3277182/1008999 + var _global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof global === 'object' && global.global === global ? global : void 0; + + function bom(blob, opts) { + if (typeof opts === 'undefined') opts = { + autoBom: false + };else if (typeof opts !== 'object') { + console.warn('Depricated: Expected third argument to be a object'); + opts = { + autoBom: !opts + }; + } // prepend BOM for UTF-8 XML and text/* types (including HTML) + // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF + + if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { + return new Blob([String.fromCharCode(0xFEFF), blob], { + type: blob.type + }); + } + + return blob; + } + + function download(url, name, opts) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url); + xhr.responseType = 'blob'; + + xhr.onload = function () { + saveAs(xhr.response, name, opts); + }; + + xhr.onerror = function () { + console.error('could not download file'); + }; + + xhr.send(); + } + + function corsEnabled(url) { + var xhr = new XMLHttpRequest(); // use sync to avoid popup blocker + + xhr.open('HEAD', url, false); + xhr.send(); + return xhr.status >= 200 && xhr.status <= 299; + } // `a.click()` doesn't work for all browsers (#465) + + + function click(node) { + try { + node.dispatchEvent(new MouseEvent('click')); + } catch (e) { + var evt = document.createEvent('MouseEvents'); + evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null); + node.dispatchEvent(evt); + } + } + + var saveAs = _global.saveAs || // probably in some web worker + typeof window !== 'object' || window !== _global ? function saveAs() {} + /* noop */ + // Use download attribute first if possible (#193 Lumia mobile) + : 'download' in HTMLAnchorElement.prototype ? function saveAs(blob, name, opts) { + var URL = _global.URL || _global.webkitURL; + var a = document.createElement('a'); + name = name || blob.name || 'download'; + a.download = name; + a.rel = 'noopener'; // tabnabbing + // TODO: detect chrome extensions & packaged apps + // a.target = '_blank' + + if (typeof blob === 'string') { + // Support regular links + a.href = blob; + + if (a.origin !== location.origin) { + corsEnabled(a.href) ? download(blob, name, opts) : click(a, a.target = '_blank'); + } else { + click(a); + } + } else { + // Support blobs + a.href = URL.createObjectURL(blob); + setTimeout(function () { + URL.revokeObjectURL(a.href); + }, 4E4); // 40s + + setTimeout(function () { + click(a); + }, 0); + } + } // Use msSaveOrOpenBlob as a second approach + : 'msSaveOrOpenBlob' in navigator ? function saveAs(blob, name, opts) { + name = name || blob.name || 'download'; + + if (typeof blob === 'string') { + if (corsEnabled(blob)) { + download(blob, name, opts); + } else { + var a = document.createElement('a'); + a.href = blob; + a.target = '_blank'; + setTimeout(function () { + click(a); + }); + } + } else { + navigator.msSaveOrOpenBlob(bom(blob, opts), name); + } + } // Fallback to using FileReader and a popup + : function saveAs(blob, name, opts, popup) { + // Open a popup immediately do go around popup blocker + // Mostly only avalible on user interaction and the fileReader is async so... + popup = popup || open('', '_blank'); + + if (popup) { + popup.document.title = popup.document.body.innerText = 'downloading...'; + } + + if (typeof blob === 'string') return download(blob, name, opts); + var force = blob.type === 'application/octet-stream'; + + var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari; + + var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent); + + if ((isChromeIOS || force && isSafari) && typeof FileReader === 'object') { + // Safari doesn't allow downloading of blob urls + var reader = new FileReader(); + + reader.onloadend = function () { + var url = reader.result; + url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;'); + if (popup) popup.location.href = url;else location = url; + popup = null; // reverse-tabnabbing #460 + }; + + reader.readAsDataURL(blob); + } else { + var URL = _global.URL || _global.webkitURL; + var url = URL.createObjectURL(blob); + if (popup) popup.location = url;else location.href = url; + popup = null; // reverse-tabnabbing #460 + + setTimeout(function () { + URL.revokeObjectURL(url); + }, 4E4); // 40s + } + }; + _global.saveAs = saveAs.saveAs = saveAs; + + if (typeof module !== 'undefined') { + module.exports = saveAs; + } +}); diff -r 46ebb8b63379 -r 7d479c20ee49 src/pyams_skin/resources/js/ext/js-filesaver.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/js-filesaver.min.js Thu Dec 20 14:13:45 2018 +0100 @@ -0,0 +1,1 @@ +!function(e,t){if("function"==typeof define&&define.amd)define([],t);else if("undefined"!=typeof exports)t();else{t(),e.FileSaver={exports:{}}.exports}}(this,function(){"use strict";function e(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Depricated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}function t(e,t,o){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){a(n.response,t,o)},n.onerror=function(){console.error("could not download file")},n.send()}function o(e){var t=new XMLHttpRequest;return t.open("HEAD",e,!1),t.send(),t.status>=200&&t.status<=299}function n(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(o){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,a=i.saveAs||"object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype?function(e,a,r){var l=i.URL||i.webkitURL,c=document.createElement("a");a=a||e.name||"download",c.download=a,c.rel="noopener","string"==typeof e?(c.href=e,c.origin!==location.origin?o(c.href)?t(e,a,r):n(c,c.target="_blank"):n(c)):(c.href=l.createObjectURL(e),setTimeout(function(){l.revokeObjectURL(c.href)},4e4),setTimeout(function(){n(c)},0))}:"msSaveOrOpenBlob"in navigator?function(i,a,r){if(a=a||i.name||"download","string"==typeof i)if(o(i))t(i,a,r);else{var l=document.createElement("a");l.href=i,l.target="_blank",setTimeout(function(){n(l)})}else navigator.msSaveOrOpenBlob(e(i,r),a)}:function(e,o,n,a){if((a=a||open("","_blank"))&&(a.document.title=a.document.body.innerText="downloading..."),"string"==typeof e)return t(e,o,n);var r="application/octet-stream"===e.type,l=/constructor/i.test(i.HTMLElement)||i.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||r&&l)&&"object"==typeof FileReader){var s=new FileReader;s.onloadend=function(){var e=s.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=e:location=e,a=null},s.readAsDataURL(e)}else{var f=i.URL||i.webkitURL,d=f.createObjectURL(e);a?a.location=d:location.href=d,a=null,setTimeout(function(){f.revokeObjectURL(d)},4e4)}};i.saveAs=a.saveAs=a,"undefined"!=typeof module&&(module.exports=a)}); diff -r 46ebb8b63379 -r 7d479c20ee49 src/pyams_skin/resources/js/myams-container.js --- a/src/pyams_skin/resources/js/myams-container.js Thu Dec 20 14:13:03 2018 +0100 +++ b/src/pyams_skin/resources/js/myams-container.js Thu Dec 20 14:13:45 2018 +0100 @@ -107,6 +107,40 @@ } }); } + }, + + /** + * Export table to CSV + */ + exportTableToTSV: function() { + return function() { + var source = $(this); + ams.ajax && ams.ajax.check(globals.saveAs, + ams.baseURL + 'ext/js-filesaver' + ams.devext + '.js', + function() { + var table = $('table.datatable', source.parents('.ams-widget:first')); + var datatable = table.dataTable(); + var output = ''; + $('th', table).each(function(index) { + if (index > 0) { + output += '\t'; + } + output += $(this).text(); + }); + output += '\n'; + $(datatable.fnGetData()).each(function() { + $(this).each(function(index) { + if (index > 0) { + output += '\t'; + } + output += this; + }); + output += '\n'; + }); + var blob = new Blob([output], {type: 'text/tsv; charset=utf-8'}); + saveAs(blob, "export.tsv"); + }); + } } }; diff -r 46ebb8b63379 -r 7d479c20ee49 src/pyams_skin/resources/js/myams-container.min.js --- a/src/pyams_skin/resources/js/myams-container.min.js Thu Dec 20 14:13:03 2018 +0100 +++ b/src/pyams_skin/resources/js/myams-container.min.js Thu Dec 20 14:13:45 2018 +0100 @@ -1,1 +1,1 @@ -!function(i,a){var f=a.MyAMS;f.container={changeOrder:function(a,t){i('input[name="'+i(this).data("ams-input-name")+'"]',i(this)).val(t.join(";"))},deleteElement:function(){return function(){var r=i(this);f.skin&&f.skin.bigBox({title:f.i18n.WARNING,content:'  '+f.i18n.DELETE_WARNING,status:"info",buttons:f.i18n.BTN_OK_CANCEL},function(a){if(a===f.i18n.BTN_OK){var e=r.parents("tr").first(),n=e.parents("table").first(),t=e.data("ams-location")||n.data("ams-location")||"";t&&(t+="/");var s=e.data("ams-delete-target")||n.data("ams-delete-target")||"delete-element.json",i=e.data("ams-element-name");f.ajax&&f.ajax.post(t+s,{object_name:i},function(a,t){"success"===a.status?(n.hasClass("datatable")?n.dataTable().fnDeleteRow(e[0]):e.remove(),a.handle_json&&f.ajax&&f.ajax.handleJSON(a)):f.ajax&&f.ajax.handleJSON(a)})}})}},switchElementVisibility:function(){return function(){var e=i(this),a=e.parents("td").first(),t=e.parents("tr").first(),n=t.parents("table");i("i",e).attr("class","fa fa-fw fa-spinner fa-pulse"),f.ajax&&f.ajax.post(n.data("ams-location")+"/"+(a.data("ams-attribute-switcher")||n.data("ams-attribute-switcher")),{object_name:t.data("ams-element-name")},function(a,t){a.visible?i("i",e).attr("class","fa fa-fw fa-eye"):i("i",e).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var e=i(this),a=e.parents("td").first(),n=a.data("ams-switcher-attribute-name"),t=e.parents("tr").first(),s=t.parents("table");i("i",e).attr("class","fa fa-fw fa-spinner fa-pulse"),f.ajax&&f.ajax.post(s.data("ams-location")+"/"+(a.data("ams-attribute-switcher")||s.data("ams-attribute-switcher")),{object_name:t.data("ams-element-name")},function(a,t){a[n]||a.on?i("i",e).attr("class",s.data("ams-"+n+"-icon-on")||"fa fa-fw fa-check-square-o"):i("i",e).attr("class",s.data("ams-"+n+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}}}}(jQuery,this); +!function(a,t){var e=t.MyAMS;e.container={changeOrder:function(t,e){a('input[name="'+a(this).data("ams-input-name")+'"]',a(this)).val(e.join(";"))},deleteElement:function(){return function(){var t=a(this);e.skin&&e.skin.bigBox({title:e.i18n.WARNING,content:'  '+e.i18n.DELETE_WARNING,status:"info",buttons:e.i18n.BTN_OK_CANCEL},function(a){if(a===e.i18n.BTN_OK){var n=t.parents("tr").first(),s=n.parents("table").first(),i=n.data("ams-location")||s.data("ams-location")||"";i&&(i+="/");var r=n.data("ams-delete-target")||s.data("ams-delete-target")||"delete-element.json",f=n.data("ams-element-name");e.ajax&&e.ajax.post(i+r,{object_name:f},function(a,t){"success"===a.status?(s.hasClass("datatable")?s.dataTable().fnDeleteRow(n[0]):n.remove(),a.handle_json&&e.ajax&&e.ajax.handleJSON(a)):e.ajax&&e.ajax.handleJSON(a)})}})}},switchElementVisibility:function(){return function(){var t=a(this),n=t.parents("td").first(),s=t.parents("tr").first(),i=s.parents("table");a("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),e.ajax&&e.ajax.post(i.data("ams-location")+"/"+(n.data("ams-attribute-switcher")||i.data("ams-attribute-switcher")),{object_name:s.data("ams-element-name")},function(e,n){e.visible?a("i",t).attr("class","fa fa-fw fa-eye"):a("i",t).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var t=a(this),n=t.parents("td").first(),s=n.data("ams-switcher-attribute-name"),i=t.parents("tr").first(),r=i.parents("table");a("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),e.ajax&&e.ajax.post(r.data("ams-location")+"/"+(n.data("ams-attribute-switcher")||r.data("ams-attribute-switcher")),{object_name:i.data("ams-element-name")},function(e,n){e[s]||e.on?a("i",t).attr("class",r.data("ams-"+s+"-icon-on")||"fa fa-fw fa-check-square-o"):a("i",t).attr("class",r.data("ams-"+s+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}},exportTableToTSV:function(){return function(){var n=a(this);e.ajax&&e.ajax.check(t.saveAs,e.baseURL+"ext/js-filesaver"+e.devext+".js",function(){var t=a("table.datatable",n.parents(".ams-widget:first")),e=t.dataTable(),s="";a("th",t).each(function(t){t>0&&(s+="\t"),s+=a(this).text()}),s+="\n",a(e.fnGetData()).each(function(){a(this).each(function(a){a>0&&(s+="\t"),s+=this}),s+="\n"});var i=new Blob([s],{type:"text/tsv; charset=utf-8"});saveAs(i,"export.tsv")})}}}}(jQuery,this); diff -r 46ebb8b63379 -r 7d479c20ee49 src/pyams_skin/resources/js/myams.js --- a/src/pyams_skin/resources/js/myams.js Thu Dec 20 14:13:03 2018 +0100 +++ b/src/pyams_skin/resources/js/myams.js Thu Dec 20 14:13:45 2018 +0100 @@ -2565,8 +2565,8 @@ shown: function(e) { function resetViewport(ev) { - var top = $('.scrollmarker.top', viewport); - var topPosition = viewport.scrollTop(); + var top = $('.scrollmarker.top', viewport), + topPosition = viewport.scrollTop(); if (topPosition > 0) { top.show(); } else { @@ -2580,11 +2580,11 @@ } } - var modal = e.target; - var viewport = $('.modal-viewport', modal); + var modal = e.target, + viewport = $('.modal-viewport', modal); if (viewport.exists()) { - var maxHeight = parseInt(viewport.css('max-height')); - var barWidth = $.scrollbarWidth(); + var maxHeight = parseInt(viewport.css('max-height')), + barWidth = $.scrollbarWidth(); if ((viewport.css('overflow') !== 'hidden') && (viewport.height() === maxHeight)) { $('
').addClass('scrollmarker') @@ -2614,8 +2614,8 @@ } }); // Call shown callbacks registered for this dialog - var index; - var callbacks = $('.modal-dialog', modal).data('shown-callbacks'); + var index, + callbacks = $('.modal-dialog', modal).data('shown-callbacks'); if (callbacks) { for (index=0; index < callbacks.length; index++) { callbacks[index].call(modal); @@ -5253,6 +5253,40 @@ } }); } + }, + + /** + * Export table to CSV + */ + exportTableToTSV: function() { + return function() { + var source = $(this); + ams.ajax && ams.ajax.check(globals.saveAs, + ams.baseURL + 'ext/js-filesaver' + ams.devext + '.js', + function() { + var table = $('table.datatable', source.parents('.ams-widget:first')); + var datatable = table.dataTable(); + var output = ''; + $('th', table).each(function(index) { + if (index > 0) { + output += '\t'; + } + output += $(this).text(); + }); + output += '\n'; + $(datatable.fnGetData()).each(function() { + $(this).each(function(index) { + if (index > 0) { + output += '\t'; + } + output += this; + }); + output += '\n'; + }); + var blob = new Blob([output], {type: 'text/tsv; charset=utf-8'}); + saveAs(blob, "export.tsv"); + }); + } } }; diff -r 46ebb8b63379 -r 7d479c20ee49 src/pyams_skin/resources/js/myams.min.js --- a/src/pyams_skin/resources/js/myams.min.js Thu Dec 20 14:13:03 2018 +0100 +++ b/src/pyams_skin/resources/js/myams.min.js Thu Dec 20 14:13:45 2018 +0100 @@ -1,1 +1,1 @@ -"use strict";!function(e,a){var t=a.console;String.prototype.startsWith=function(e){var a=this.length,t=e.length;return!(a0},void 0===e.scrollbarWidth&&(e.scrollbarWidth=function(){var a=e('
').appendTo("body"),t=a.children(),n=t.innerWidth()-t.height(99).innerWidth();return a.remove(),n}),e.fn.extend({exists:function(){return e(this).length>0},objectOrParentWithClass:function(e){return this.hasClass(e)?this:this.parents("."+e)},listattr:function(a){var t=[];return this.each(function(){t.push(e(this).attr(a))}),t},style:function(e,a,t){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==e?void 0!==a?(t=void 0!==t?t:"",n.setProperty(e,a,t),this):n.getPropertyValue(e):n}},removeClassPrefix:function(a){return this.each(function(t,n){var s=n.className.split(" ").map(function(e){return e.startsWith(a)?"":e});n.className=e.trim(s.join(" "))}),this}}),void 0===a.MyAMS&&(a.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n=a.MyAMS,s=n;n.baseURL=function(){var a=e('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src");return s.devmode=a.indexOf(".min.js")<0,s.devext=s.devmode?"":".min",a.substring(0,a.lastIndexOf("/")+1)}(),n.log=function(){t&&t.debug&&t.debug(this,arguments)},n.getQueryVar=function(e,a){if(e.indexOf("?")<0)return!1;e.endsWith("&")||(e+="&");var t=new RegExp(".*?[&\\?]"+a+"=(.*?)&.*"),n=e.replace(t,"$1");return n!==e&&n},n.rgb2hex=function(a){return"#"+e.map(a.match(/\b(\d+)\b/g),function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},n.generateId=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()},n.generateUUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===a?t:3&t|8).toString(16)})},n.getObject=function(e,a){if(e){if("string"!=typeof e)return e;var t=e.split(".");a=void 0===a||null===a?window:a;for(var n=0;n").attr("data-ams-id",t).text('@import "'+s.getSource(a)+'";'),n)var l=setInterval(function(){try{o[0].sheet.cssRules;n.call(window,!0,i),clearInterval(l)}catch(e){}},10);o.appendTo(r)}else n&&n.call(window,!1,i)}}(jQuery,this),function(e,a){a.MyAMS.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",LOADING:"Loading...",PROGRESS:"Processing",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",CLIPBOARD_CHARACTER_COPY_OK:"Character copied to clipboard",CLIPBOARD_TEXT_COPY_OK:"Text copied to clipboard",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"}}(jQuery,this),jQuery.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");for(var a="",t=0;t127&&n<2048?(a+=String.fromCharCode(n>>6|192),a+=String.fromCharCode(63&n|128)):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128),a+=String.fromCharCode(63&n|128))}return a},decode:function(e){for(var a="",t=0,n=0,s=0,i=0;t191&&n<224?(s=e.charCodeAt(t+1),a+=String.fromCharCode((31&n)<<6|63&s),t+=2):(s=e.charCodeAt(t+1),i=e.charCodeAt(t+2),a+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),t+=3);return a}},function(e,a){var t=a.MyAMS;e.fn.extend({contextMenu:function(a){function n(t,n,s){var i=e(window)[n](),r=e(a.menuSelector)[n](),o=t;return t+r>i&&r',openedSign:''},a),n=e(this);n.find("LI").each(function(){var a=e(this);if(a.find("UL").size()>0){a.find("A:first").append(""+t.closedSign+"");var n=a.find("A:first");"#"===n.attr("href")&&n.click(function(){return!1})}}),n.find("LI.active").each(function(){var a=e(this).parents("UL"),n=a.parent("LI");a.slideDown(t.speed),n.find("b:first").html(t.openedSign),n.addClass("open")}),n.find("LI A").on("click",function(){var a=e(this);if(!a.hasClass("active")){var s=a.attr("href").replace(/^#/,""),i=a.parent().find("UL");if(t.accordion){var r=a.parent().parents("UL"),o=n.find("UL:visible");o.each(function(a){var n=!0;if(r.each(function(e){if(r[e]===o[a])return n=!1,!1}),n&&i!==o[a]){var l=e(o[a]);!s&&l.hasClass("active")||l.slideUp(t.speed,function(){e(this).parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}var l=a.parent().find("UL:first");s||!l.is(":visible")||l.hasClass("active")?l.slideDown(t.speed,function(){a.parent("LI").addClass("open").find("B:first").delay(t.speed).html(t.openedSign)}):l.slideUp(t.speed,function(){a.parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}})}(jQuery,this),function(e,a){a.MyAMS.event={stop:function(e){e||(e=window.event),e&&"string"!=typeof e&&(e.stopPropagation?(e.stopPropagation(),e.preventDefault()):(e.cancelBubble=!0,e.returnValue=!1))}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var a=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(a)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",t=this.getInternetExplorerVersion();t>-1&&(e=t>=8?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),a.alert&&a.alert(e)},isIE8orlower:function(){var e="0",a=this.getInternetExplorerVersion();return a>-1&&(e=a>=9?0:1),e},copyToClipboard:function(n){function s(n){var s=!1;if(window.clipboardData&&window.clipboardData.setData)s=clipboardData.setData("Text",n);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var i=e("