// source --> https://www.lbaa.lt/wp-content/plugins/favorites/assets/js/simple-favorites.min.js?ver=1.2.3 function favorites_after_button_submit(){}function favorites_after_initial_load(){}jQuery(document).ready(function(){new Favorites});var Favorites=function(){var t=this,a=jQuery;return t.formactions={nonce:"simplefavorites_nonce",favoritesarray:"simplefavorites_array",favorite:"simplefavorites_favorite",clearall:"simplefavorites_clear",favoritelist:"simplefavorites_list"},t.buttons=".simplefavorite-button",t.lists=".favorites-list",t.clear_buttons=".simplefavorites-clear",t.total_favorites=".simplefavorites-user-count",t.ajaxurl=simple_favorites.ajaxurl,t.favorite=simple_favorites.favorite,t.favorited=simple_favorites.favorited,t.include_count=simple_favorites.includecount,t.indicate_loading=simple_favorites.indicate_loading,t.loading_text=simple_favorites.loading_text,t.loading_image_active=simple_favorites.loading_image_active,t.loading_image=simple_favorites.loading_image,t.nonce="",t.userfavorites,t.bindEvents=function(){a(document).on("click",t.buttons,function(e){e.preventDefault(),t.submitFavorite(a(this))}),a(document).on("click",t.clear_buttons,function(e){e.preventDefault(),t.clearFavorites(a(this))})},t.init=function(){t.bindEvents(),t.generateNonce()},t.generateNonce=function(){a.ajax({url:t.ajaxurl,type:"post",datatype:"json",data:{action:t.formactions.nonce},success:function(a){t.nonce=a.nonce,t.setUserFavorites(t.updateAllButtons)}})},t.setUserFavorites=function(e){a.ajax({url:t.ajaxurl,type:"post",datatype:"json",data:{action:t.formactions.favoritesarray},success:function(a){t.userfavorites=a.favorites,t.updateAllLists(),t.updateAllButtons(),t.updateClearButtons(),t.updateTotalFavorites(),e&&e(),favorites_after_initial_load(t.userfavorites)}})},t.updateAllButtons=function(e){for(var i=0;i'+e+""),a},t.submitFavorite=function(e){a(e).attr("disabled","disabled"),a(e).addClass("loading");var i=a(e).attr("data-postid"),o=a(e).attr("data-siteid"),s=parseInt(a(e).attr("data-favoritecount")),r="inactive",n="",d="";a(e).hasClass("active")?(a(e).removeClass("active"),0>s-1&&(s=1),a(e).attr("data-favoritecount",s-1),d=t.addFavoriteCount(t.favorite,s-1)):(r="active",a(e).addClass("active"),a(e).attr("data-favoritecount",s+1),d=t.addFavoriteCount(t.favorited,s+1)),n=t.addButtonLoading(d,r),a(e).html(n),a.ajax({url:t.ajaxurl,type:"post",datatype:"json",data:{action:t.formactions.favorite,nonce:t.nonce,postid:i,siteid:o,status:r},success:function(i){a(e).removeClass("loading"),a(e).html(d),a(e).attr("disabled",!1),t.userfavorites=i.favorites,t.updateAllLists(),t.updateAllButtons(),t.updateClearButtons(),t.updateTotalFavorites(),favorites_after_button_submit(i.favorites)}})},t.addButtonLoading=function(a,e){return"1"!==t.indicate_loading?a:"active"===e?t.loading_text+t.loading_image_active:t.loading_text+t.loading_image},t.updateClearButtons=function(){for(var e=0;e0?a(i).attr("disabled",!1):a(i).attr("disabled","disabled"))},t.clearFavorites=function(e){a(e).addClass("loading"),a(e).attr("disabled","disabled");var i=a(e).attr("data-siteid");a.ajax({url:t.ajaxurl,type:"post",datatype:"json",data:{action:t.formactions.clearall,nonce:t.nonce,siteid:i},success:function(i){t.userfavorites=i.favorites,a(e).removeClass("loading"),t.resetCounts()}})},t.resetCounts=function(){for(var e=a(".simplefavorite-button.active.has-count"),i=0;i0?a(e).find("[data-nofavorites]").remove():(html="
  • "+a(e).attr("data-nofavoritestext")+"
  • ",a(e).empty().append(html));var n=a(e).attr("data-posttype");n=n.split(","),a.each(i,function(t,i){n.length>0&&-1===a.inArray(i.post_type,n)||a(e).find("li[data-postid="+i.post_id+"]").length>0||(html='
  • ',o&&(html+="

    "),s&&(html+=''),html+=i.title,s&&(html+=""),o&&(html+="

    "+i.button+"

    "),html+="
  • ",a(e).append(html))})},t.updateUserList=function(e){var i=a(e).attr("data-userid"),o=a(e).attr("data-siteid"),s=a(e).attr("data-includelinks"),r=a(e).attr("data-includebuttons"),n=a(e).attr("data-posttype");console.log(n),a.ajax({url:t.ajaxurl,type:"post",datatype:"json",data:{action:t.formactions.favoritelist,nonce:t.nonce,userid:i,siteid:o,includelinks:s,includebuttons:r,posttype:n},success:function(t){a(e).replaceWith(t.list)}})},t.removeInvalidListItems=function(e,i){var o=a(e).find("li[data-postid]");a.each(o,function(){var e=a(this).attr("data-postid");t.isFavorite(e,i)||a(this).remove()})},t.updateTotalFavorites=function(){for(var e=0;e https://www.lbaa.lt/wp-content/plugins/file-away/lib/js/alphanum.js?ver=1.0 /******************************************************************** * Limit the characters that may be entered in a text field * Common options: alphanumeric, alphabetic or numeric * Kevin Sheedy, 2012 * http://github.com/KevinSheedy/jquery.alphanum *********************************************************************/ (function( $ ){ // API /////////////////////////////////////////////////////////////////// $.fn.alphanum = function(settings) { var combinedSettings = getCombinedSettingsAlphaNum(settings); var $collection = this; setupEventHandlers($collection, trimAlphaNum, combinedSettings); return this; }; $.fn.alpha = function(settings) { var defaultAlphaSettings = getCombinedSettingsAlphaNum("alpha"); var combinedSettings = getCombinedSettingsAlphaNum(settings, defaultAlphaSettings); var $collection = this; setupEventHandlers($collection, trimAlphaNum, combinedSettings); return this; }; $.fn.numeric = function(settings) { var combinedSettings = getCombinedSettingsNum(settings); var $collection = this; setupEventHandlers($collection, trimNum, combinedSettings); $collection.blur(function(){ numericField_Blur(this, settings); }); return this; }; // End of API ///////////////////////////////////////////////////////////// // Start Settings //////////////////////////////////////////////////////// var DEFAULT_SETTINGS_ALPHANUM = { allow : '', // Allow extra characters disallow : '', // Disallow extra characters allowSpace : true, // Allow the space character allowNumeric : true, // Allow digits 0-9 allowUpper : true, // Allow upper case characters allowLower : true, // Allow lower case characters allowCaseless : true, // Allow characters that don't have both upper & lower variants - eg Arabic or Chinese allowLatin : true, // a-z A-Z allowOtherCharSets : true, // eg é, Á, Arabic, Chinese etc forceUpper : false, // Convert lower case characters to upper case forceLower : false, // Convert upper case characters to lower case maxLength : NaN // eg Max Length } var DEFAULT_SETTINGS_NUM = { allowPlus : false, // Allow the + sign allowMinus : true, // Allow the - sign allowThouSep : true, // Allow the thousands separator, default is the comma eg 12,000 allowDecSep : true, // Allow the decimal separator, default is the fullstop eg 3.141 allowLeadingSpaces : false, maxDigits : NaN, // The max number of digits maxDecimalPlaces : NaN, // The max number of decimal places maxPreDecimalPlaces : NaN, // The max number digits before the decimal point max : NaN, // The max numeric value allowed min : NaN // The min numeric value allowed } // Some pre-defined groups of settings for convenience var CONVENIENCE_SETTINGS_ALPHANUM = { "alpha" : { allowNumeric : false }, "upper" : { allowNumeric : false, allowUpper : true, allowLower : false, allowCaseless : true }, "lower" : { allowNumeric : false, allowUpper : false, allowLower : true, allowCaseless : true } }; // Some pre-defined groups of settings for convenience var CONVENIENCE_SETTINGS_NUMERIC = { "integer" : { allowPlus : false, allowMinus : true, allowThouSep : false, allowDecSep : false }, "positiveInteger" : { allowPlus : false, allowMinus : false, allowThouSep : false, allowDecSep : false } }; var BLACKLIST = getBlacklistAscii() + getBlacklistNonAscii(); var THOU_SEP = ","; var DEC_SEP = "."; var DIGITS = getDigitsMap(); var LATIN_CHARS = getLatinCharsSet(); // Return the blacklisted special chars that are encodable using 7-bit ascii function getBlacklistAscii(){ var blacklist = '!@#$%^&*()+=[]\\\';,/{}|":<>?~`.-_'; blacklist += " "; // 'Space' is on the blacklist but can be enabled using the 'allowSpace' config entry return blacklist; } // Return the blacklisted special chars that are NOT encodable using 7-bit ascii // We want this .js file to be encoded using 7-bit ascii so it can reach the widest possible audience // Higher order chars must be escaped eg "\xAC" // Not too worried about comments containing higher order characters for now (let's wait and see if it becomes a problem) function getBlacklistNonAscii(){ var blacklist = "\xAC" // ¬ + "\u20AC" // € + "\xA3" // £ + "\xA6" // ¦ ; return blacklist; } // End Settings //////////////////////////////////////////////////////// // Implementation details go here //////////////////////////////////////////////////////// function setupEventHandlers($textboxes, trimFunction, settings) { $textboxes.each(function(){ var $textbox = $(this); $textbox.bind("keyup change paste", function(e){ var pastedText = ""; if(e.originalEvent && e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData) pastedText = e.originalEvent.clipboardData.getData("text/plain") // setTimeout is necessary for handling the 'paste' event setTimeout(function(){ trimTextbox($textbox, trimFunction, settings, pastedText); }, 0); }); $textbox.bind("keypress", function(e){ // Determine which key is pressed. // If it's a control key, then allow the event's default action to occur eg backspace, tab var charCode = !e.charCode ? e.which : e.charCode; if(isControlKey(charCode) || e.ctrlKey || e.metaKey ) // cmd on MacOS return; var newChar = String.fromCharCode(charCode); // Determine if some text was selected / highlighted when the key was pressed var selectionObject = $textbox.selection(); var start = selectionObject.start; var end = selectionObject.end; var textBeforeKeypress = $textbox.val(); // The new char may be inserted: // 1) At the start // 2) In the middle // 3) At the end // 4) User highlights some text and then presses a key which would replace the highlighted text // // Here we build the string that would result after the keypress. // If the resulting string is invalid, we cancel the event. // Unfortunately, it isn't enough to just check if the new char is valid because some chars // are position sensitive eg the decimal point '.'' or the minus sign '-'' are only valid in certain positions. var potentialTextAfterKeypress = textBeforeKeypress.substring(0, start) + newChar + textBeforeKeypress.substring(end); var validatedText = trimFunction(potentialTextAfterKeypress, settings); // If the keypress would cause the textbox to contain invalid characters, then cancel the keypress event if(validatedText != potentialTextAfterKeypress) e.preventDefault(); }); }); } // Ensure the text is a valid number when focus leaves the textbox // This catches the case where a user enters '-' or '.' without entering any digits function numericField_Blur(inputBox, settings) { var fieldValueNumeric = parseFloat($(inputBox).val()); var $inputBox = $(inputBox); if(isNaN(fieldValueNumeric)) { $inputBox.val(""); return; } if(isNumeric(settings.min) && fieldValueNumeric < settings.min) $inputBox.val(""); if(isNumeric(settings.max) && fieldValueNumeric > settings.max) $inputBox.val(""); } function isNumeric(value) { return !isNaN(value); } function isControlKey(charCode) { if(charCode >= 32) return false; if(charCode == 10) return false; if(charCode == 13) return false; return true; } // One way to prevent a character being entered is to cancel the keypress event. // However, this gets messy when you have to deal with things like copy paste which isn't a keypress. // Which event gets fired first, keypress or keyup? What about IE6 etc etc? // Instead, it's easier to allow the 'bad' character to be entered and then to delete it immediately after. function trimTextbox($textBox, trimFunction, settings, pastedText){ var inputString = $textBox.val(); if(inputString == "" && pastedText.length > 0) inputString = pastedText; var outputString = trimFunction(inputString, settings); if(inputString == outputString) return; var caretPos = $textBox.alphanum_caret(); $textBox.val(outputString); //Reset the caret position if(inputString.length ==(outputString.length + 1)) $textBox.alphanum_caret(caretPos - 1); else $textBox.alphanum_caret(caretPos); } function getCombinedSettingsAlphaNum(settings, defaultSettings){ if(typeof defaultSettings == "undefined") defaultSettings = DEFAULT_SETTINGS_ALPHANUM; var userSettings, combinedSettings = {}; if(typeof settings === "string") userSettings = CONVENIENCE_SETTINGS_ALPHANUM[settings]; else if(typeof settings == "undefined") userSettings = {}; else userSettings = settings; $.extend(combinedSettings, defaultSettings, userSettings); if(typeof combinedSettings.blacklist == 'undefined') combinedSettings.blacklistSet = getBlacklistSet(combinedSettings.allow, combinedSettings.disallow); return combinedSettings; } function getCombinedSettingsNum(settings){ var userSettings, combinedSettings = {}; if(typeof settings === "string") userSettings = CONVENIENCE_SETTINGS_NUMERIC[settings]; else if(typeof settings == "undefined") userSettings = {}; else userSettings = settings; $.extend(combinedSettings, DEFAULT_SETTINGS_NUM, userSettings); return combinedSettings; } // This is the heart of the algorithm function alphanum_allowChar(validatedStringFragment, Char, settings){ if(settings.maxLength && validatedStringFragment.length >= settings.maxLength) return false; if(settings.allow.indexOf(Char) >=0 ) return true; if(settings.allowSpace && (Char == " ")) return true; if(settings.blacklistSet.contains(Char)) return false; if(!settings.allowNumeric && DIGITS[Char]) return false; if(!settings.allowUpper && isUpper(Char)) return false; if(!settings.allowLower && isLower(Char)) return false; if(!settings.allowCaseless && isCaseless(Char)) return false; if(!settings.allowLatin && LATIN_CHARS.contains(Char)) return false; if(!settings.allowOtherCharSets){ if(DIGITS[Char] || LATIN_CHARS.contains(Char)) return true; else return false; } return true; } function numeric_allowChar(validatedStringFragment, Char, settings){ if(DIGITS[Char]) { if(isMaxDigitsReached(validatedStringFragment, settings)) return false; if(isMaxPreDecimalsReached(validatedStringFragment, settings)) return false; if(isMaxDecimalsReached(validatedStringFragment, settings)) return false; if(isGreaterThanMax(validatedStringFragment + Char, settings)) return false; if(isLessThanMin(validatedStringFragment + Char, settings)) return false; return true; } if(settings.allowPlus && Char == '+' && validatedStringFragment == '') return true; if(settings.allowMinus && Char == '-' && validatedStringFragment == '') return true; if(Char == THOU_SEP && settings.allowThouSep && allowThouSep(validatedStringFragment, Char)) return true; if(Char == DEC_SEP) { // Only one decimal separator allowed if(validatedStringFragment.indexOf(DEC_SEP) >= 0) return false; if(settings.allowDecSep) return true; } return false; } function countDigits(string) { // Error handling, nulls etc string = string + ""; // Count the digits return string.replace(/[^0-9]/g,"").length; } function isMaxDigitsReached(string, settings) { var maxDigits = settings.maxDigits; if(maxDigits == "" || isNaN(maxDigits)) return false; // In this case, there is no maximum var numDigits = countDigits(string); if(numDigits >= maxDigits) return true; return false; } function isMaxDecimalsReached(string, settings) { var maxDecimalPlaces = settings.maxDecimalPlaces; if(maxDecimalPlaces == "" || isNaN(maxDecimalPlaces)) return false; // In this case, there is no maximum var indexOfDecimalPoint = string.indexOf(DEC_SEP); if(indexOfDecimalPoint == -1) return false; var decimalSubstring = string.substring(indexOfDecimalPoint); var numDecimals = countDigits(decimalSubstring); if(numDecimals >= maxDecimalPlaces) return true; return false; } function isMaxPreDecimalsReached(string, settings) { var maxPreDecimalPlaces = settings.maxPreDecimalPlaces; if(maxPreDecimalPlaces == "" || isNaN(maxPreDecimalPlaces)) return false; // In this case, there is no maximum var indexOfDecimalPoint = string.indexOf(DEC_SEP); if(indexOfDecimalPoint >= 0) return false; var numPreDecimalDigits = countDigits(string); if(numPreDecimalDigits >= maxPreDecimalPlaces) return true; return false; } function isGreaterThanMax(numericString, settings) { if(!settings.max || settings.max < 0) return false; var outputNumber = parseFloat(numericString); if(outputNumber > settings.max) return true; return false; } function isLessThanMin(numericString, settings) { if(!settings.min || settings.min > 0) return false; var outputNumber = parseFloat(numericString); if(outputNumber < settings.min) return true; return false; } /******************************** * Trims a string according to the settings provided ********************************/ function trimAlphaNum(inputString, settings){ if(typeof inputString != "string") return inputString; var inChars = inputString.split(""); var outChars = []; var i = 0; var Char; for(i=0; i= 0) return false; var posOfFirstThouSep = currentString.indexOf(THOU_SEP); // Check if this is the first occurrence of a THOU_SEP if(posOfFirstThouSep < 0) return true; var posOfLastThouSep = currentString.lastIndexOf(THOU_SEP); var charsSinceLastThouSep = currentString.length - posOfLastThouSep - 1; // Check if there has been 3 digits since the last THOU_SEP if(charsSinceLastThouSep < 3) return false; var digitsSinceFirstThouSep = countDigits(currentString.substring(posOfFirstThouSep)); // Check if there has been a multiple of 3 digits since the first THOU_SEP if((digitsSinceFirstThouSep % 3) > 0) return false; return true; } //////////////////////////////////////////////////////////////////////////////////// // Implementation of a Set //////////////////////////////////////////////////////////////////////////////////// function Set(elems){ if(typeof elems == "string") this.map = stringToMap(elems); else this.map = {}; } Set.prototype.add = function(set){ var newSet = this.clone(); for(var key in set.map) newSet.map[key] = true; return newSet; } Set.prototype.subtract = function(set){ var newSet = this.clone(); for(var key in set.map) delete newSet.map[key]; return newSet; } Set.prototype.contains = function(key){ if(this.map[key]) return true; else return false; } Set.prototype.clone = function(){ var newSet = new Set(); for(var key in this.map) newSet.map[key] = true; return newSet; } //////////////////////////////////////////////////////////////////////////////////// function stringToMap(string){ var map = {}; var array = string.split(""); var i=0; var Char; for(i=0; i=0){endPos=i.toString().length}else{endPos=startPos+r.toString().length}return{start:startPos,end:endPos}},s=function(t){var n=r(t);if(t.selectionStart!==undefined){if(document.activeElement&&document.activeElement!=t&&t.selectionStart==t.selectionEnd&&t.selectionStart==0){return{start:t.value.length,end:t.value.length}}return{start:t.selectionStart,end:t.selectionEnd}}else if(n.getSelection){return i(t,n)}else{try{if(t.nodeName.toLowerCase()=="input"){var s=r(t).document.selection.createRange(),o=t.createTextRange();o.setEndPoint("EndToStart",s);var u=o.text.length;return{start:u,end:u+s.text.length}}else{var a=i(t,n);if(!a){return a}var f=e.Range.current().clone(),l=f.clone().collapse().range,c=f.clone().collapse(false).range;l.moveStart("character",-1);c.moveStart("character",-1);if(a.startPos!=0&&l.text==""){a.startPos+=2}if(a.endPos!=0&&c.text==""){a.endPos+=2}return a}}catch(h){return{start:t.value.length,end:t.value.length}}}},o=function(e,t,n){var i=r(e);if(e.setSelectionRange){if(n===undefined){e.focus();e.setSelectionRange(t,t)}else{e.select();e.selectionStart=t;e.selectionEnd=n}}else if(e.createTextRange){var s=e.createTextRange();s.moveStart("character",t);n=n||t;s.moveEnd("character",n-e.value.length);s.select()}else if(i.getSelection){var o=i.document,u=i.getSelection(),f=o.createRange(),l=[t,n!==undefined?n:t];a([e],l);f.setStart(l[0].el,l[0].count);f.setEnd(l[1].el,l[1].count);u.removeAllRanges();u.addRange(f)}else if(i.document.body.createTextRange){var f=document.body.createTextRange();f.moveToElementText(e);f.collapse();f.moveStart("character",t);f.moveEnd("character",n!==undefined?n:t);f.select()}},u=function(e,t,n,r){if(typeof n[0]==="number"&&n[0] https://www.lbaa.lt/wp-content/plugins/file-away/lib/js/chosen/chosen.js?ver=1.1.0 /*! Chozed, a Select Box Enhancer for jQuery and Prototype by Patrick Filler for Harvest, http://getharvest.com Version 1.1.0 Full source at https://github.com/harvesthq/chozed Copyright (c) 2011 Harvest http://getharvest.com MIT License, https://github.com/harvesthq/chozed/blob/master/LICENSE.md This file is generated by `grunt build`, do not edit it by hand. */ (function() { var $, AbstractChozed, Chozed, SelectParser, _ref, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; SelectParser = (function() { function SelectParser() { this.options_index = 0; this.parsed = []; } SelectParser.prototype.add_node = function(child) { if (child.nodeName.toUpperCase() === "OPTGROUP") { return this.add_group(child); } else { return this.add_option(child); } }; SelectParser.prototype.add_group = function(group) { var group_position, option, _i, _len, _ref, _results; group_position = this.parsed.length; this.parsed.push({ array_index: group_position, group: true, label: this.escapeExpression(group.label), children: 0, disabled: group.disabled }); _ref = group.childNodes; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { option = _ref[_i]; _results.push(this.add_option(option, group_position, group.disabled)); } return _results; }; SelectParser.prototype.add_option = function(option, group_position, group_disabled) { if (option.nodeName.toUpperCase() === "OPTION") { if (option.text !== "") { if (group_position != null) { this.parsed[group_position].children += 1; } this.parsed.push({ array_index: this.parsed.length, options_index: this.options_index, value: option.value, text: option.text, html: option.innerHTML, selected: option.selected, disabled: group_disabled === true ? group_disabled : option.disabled, group_array_index: group_position, classes: option.className, style: option.style.cssText }); } else { this.parsed.push({ array_index: this.parsed.length, options_index: this.options_index, empty: true }); } return this.options_index += 1; } }; SelectParser.prototype.escapeExpression = function(text) { var map, unsafe_chars; if ((text == null) || text === false) { return ""; } if (!/[\&\<\>\"\'\`]/.test(text)) { return text; } map = { "<": "<", ">": ">", '"': """, "'": "'", "`": "`" }; unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g; return text.replace(unsafe_chars, function(chr) { return map[chr] || "&"; }); }; return SelectParser; })(); SelectParser.select_to_array = function(select) { var child, parser, _i, _len, _ref; parser = new SelectParser(); _ref = select.childNodes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { child = _ref[_i]; parser.add_node(child); } return parser.parsed; }; AbstractChozed = (function() { function AbstractChozed(form_field, options) { this.form_field = form_field; this.options = options != null ? options : {}; if (!AbstractChozed.browser_is_supported()) { return; } this.is_multiple = this.form_field.multiple; this.set_default_text(); this.set_default_values(); this.setup(); this.set_up_html(); this.register_observers(); } AbstractChozed.prototype.set_default_values = function() { var _this = this; this.click_test_action = function(evt) { return _this.test_active_click(evt); }; this.activate_action = function(evt) { return _this.activate_field(evt); }; this.active_field = false; this.mouse_on_container = false; this.results_showing = false; this.result_highlighted = null; this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false; this.disable_search_threshold = this.options.disable_search_threshold || 0; this.disable_search = this.options.disable_search || false; this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true; this.group_search = this.options.group_search != null ? this.options.group_search : true; this.search_contains = this.options.search_contains || false; this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true; this.max_selected_options = this.options.max_selected_options || Infinity; this.inherit_select_classes = this.options.inherit_select_classes || false; this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true; return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true; }; AbstractChozed.prototype.set_default_text = function() { if (this.form_field.getAttribute("data-placeholder")) { this.default_text = this.form_field.getAttribute("data-placeholder"); } else if (this.is_multiple) { this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChozed.default_multiple_text; } else { this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChozed.default_single_text; } return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChozed.default_no_result_text; }; AbstractChozed.prototype.mouse_enter = function() { return this.mouse_on_container = true; }; AbstractChozed.prototype.mouse_leave = function() { return this.mouse_on_container = false; }; AbstractChozed.prototype.input_focus = function(evt) { var _this = this; if (this.is_multiple) { if (!this.active_field) { return setTimeout((function() { return _this.container_mousedown(); }), 50); } } else { if (!this.active_field) { return this.activate_field(); } } }; AbstractChozed.prototype.input_blur = function(evt) { var _this = this; if (!this.mouse_on_container) { this.active_field = false; return setTimeout((function() { return _this.blur_test(); }), 100); } }; AbstractChozed.prototype.results_option_build = function(options) { var content, data, _i, _len, _ref; content = ''; _ref = this.results_data; for (_i = 0, _len = _ref.length; _i < _len; _i++) { data = _ref[_i]; if (data.group) { content += this.result_add_group(data); } else { content += this.result_add_option(data); } if (options != null ? options.first : void 0) { if (data.selected && this.is_multiple) { this.choice_build(data); } else if (data.selected && !this.is_multiple) { this.single_set_selected_text(data.text); } } } return content; }; AbstractChozed.prototype.result_add_option = function(option) { var classes, option_el; if (!option.search_match) { return ''; } if (!this.include_option_in_results(option)) { return ''; } classes = []; if (!option.disabled && !(option.selected && this.is_multiple)) { classes.push("active-result"); } if (option.disabled && !(option.selected && this.is_multiple)) { classes.push("disabled-result"); } if (option.selected) { classes.push("result-selected"); } if (option.group_array_index != null) { classes.push("group-option"); } if (option.classes !== "") { classes.push(option.classes); } option_el = document.createElement("li"); option_el.className = classes.join(" "); option_el.style.cssText = option.style; option_el.setAttribute("data-option-array-index", option.array_index); option_el.innerHTML = option.search_text; return this.outerHTML(option_el); }; AbstractChozed.prototype.result_add_group = function(group) { var group_el; if (!(group.search_match || group.group_match)) { return ''; } if (!(group.active_options > 0)) { return ''; } group_el = document.createElement("li"); group_el.className = "group-result"; group_el.innerHTML = group.search_text; return this.outerHTML(group_el); }; AbstractChozed.prototype.results_update_field = function() { this.set_default_text(); if (!this.is_multiple) { this.results_reset_cleanup(); } this.result_clear_highlight(); this.results_build(); if (this.results_showing) { return this.winnow_results(); } }; AbstractChozed.prototype.reset_single_select_options = function() { var result, _i, _len, _ref, _results; _ref = this.results_data; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { result = _ref[_i]; if (result.selected) { _results.push(result.selected = false); } else { _results.push(void 0); } } return _results; }; AbstractChozed.prototype.results_toggle = function() { if (this.results_showing) { return this.results_hide(); } else { return this.results_show(); } }; AbstractChozed.prototype.results_search = function(evt) { if (this.results_showing) { return this.winnow_results(); } else { return this.results_show(); } }; AbstractChozed.prototype.winnow_results = function() { var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref; this.no_results_clear(); results = 0; searchText = this.get_search_text(); escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); regexAnchor = this.search_contains ? "" : "^"; regex = new RegExp(regexAnchor + escapedSearchText, 'i'); zregex = new RegExp(escapedSearchText, 'i'); _ref = this.results_data; for (_i = 0, _len = _ref.length; _i < _len; _i++) { option = _ref[_i]; option.search_match = false; results_group = null; if (this.include_option_in_results(option)) { if (option.group) { option.group_match = false; option.active_options = 0; } if ((option.group_array_index != null) && this.results_data[option.group_array_index]) { results_group = this.results_data[option.group_array_index]; if (results_group.active_options === 0 && results_group.search_match) { results += 1; } results_group.active_options += 1; } if (!(option.group && !this.group_search)) { option.search_text = option.group ? option.label : option.html; option.search_match = this.search_string_match(option.search_text, regex); if (option.search_match && !option.group) { results += 1; } if (option.search_match) { if (searchText.length) { startpos = option.search_text.search(zregex); text = option.search_text.substr(0, startpos + searchText.length) + '' + option.search_text.substr(startpos + searchText.length); option.search_text = text.substr(0, startpos) + '' + text.substr(startpos); } if (results_group != null) { results_group.group_match = true; } } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) { option.search_match = true; } } } } this.result_clear_highlight(); if (results < 1 && searchText.length) { this.update_results_content(""); return this.no_results(searchText); } else { this.update_results_content(this.results_option_build()); return this.winnow_results_set_highlight(); } }; AbstractChozed.prototype.search_string_match = function(search_string, regex) { var part, parts, _i, _len; if (regex.test(search_string)) { return true; } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) { parts = search_string.replace(/\[|\]/g, "").split(" "); if (parts.length) { for (_i = 0, _len = parts.length; _i < _len; _i++) { part = parts[_i]; if (regex.test(part)) { return true; } } } } }; AbstractChozed.prototype.choices_count = function() { var option, _i, _len, _ref; if (this.selected_option_count != null) { return this.selected_option_count; } this.selected_option_count = 0; _ref = this.form_field.options; for (_i = 0, _len = _ref.length; _i < _len; _i++) { option = _ref[_i]; if (option.selected) { this.selected_option_count += 1; } } return this.selected_option_count; }; AbstractChozed.prototype.choices_click = function(evt) { evt.preventDefault(); if (!(this.results_showing || this.is_disabled)) { return this.results_show(); } }; AbstractChozed.prototype.keyup_checker = function(evt) { var stroke, _ref; stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; this.search_field_scale(); switch (stroke) { case 8: if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) { return this.keydown_backstroke(); } else if (!this.pending_backstroke) { this.result_clear_highlight(); return this.results_search(); } break; case 13: evt.preventDefault(); if (this.results_showing) { return this.result_select(evt); } break; case 27: if (this.results_showing) { this.results_hide(); } return true; case 9: case 38: case 40: case 16: case 91: case 17: break; default: return this.results_search(); } }; AbstractChozed.prototype.clipboard_event_checker = function(evt) { var _this = this; return setTimeout((function() { return _this.results_search(); }), 50); }; AbstractChozed.prototype.container_width = function() { if (this.options.width != null) { return this.options.width; } else { return "" + this.form_field.offsetWidth + "px"; } }; AbstractChozed.prototype.include_option_in_results = function(option) { if (this.is_multiple && (!this.display_selected_options && option.selected)) { return false; } if (!this.display_disabled_options && option.disabled) { return false; } if (option.empty) { return false; } return true; }; AbstractChozed.prototype.search_results_touchstart = function(evt) { this.touch_started = true; return this.search_results_mouseover(evt); }; AbstractChozed.prototype.search_results_touchmove = function(evt) { this.touch_started = false; return this.search_results_mouseout(evt); }; AbstractChozed.prototype.search_results_touchend = function(evt) { if (this.touch_started) { return this.search_results_mouseup(evt); } }; AbstractChozed.prototype.outerHTML = function(element) { var tmp; if (element.outerHTML) { return element.outerHTML; } tmp = document.createElement("div"); tmp.appendChild(element); return tmp.innerHTML; }; AbstractChozed.browser_is_supported = function() { if (window.navigator.appName === "Microsoft Internet Explorer") { return document.documentMode >= 8; } if (/iP(od|hone)/i.test(window.navigator.userAgent)) { return false; } if (/Android/i.test(window.navigator.userAgent)) { if (/Mobile/i.test(window.navigator.userAgent)) { return false; } } return true; }; AbstractChozed.default_multiple_text = "Select Some Options"; AbstractChozed.default_single_text = "Select an Option"; AbstractChozed.default_no_result_text = "No results match"; return AbstractChozed; })(); $ = jQuery; $.fn.extend({ chozed: function(options) { if (!AbstractChozed.browser_is_supported()) { return this; } return this.each(function(input_field) { var $this, chozed; $this = $(this); chozed = $this.data('chozed'); if (options === 'destroy' && chozed) { chozed.destroy(); } else if (!chozed) { $this.data('chozed', new Chozed(this, options)); } }); } }); Chozed = (function(_super) { __extends(Chozed, _super); function Chozed() { _ref = Chozed.__super__.constructor.apply(this, arguments); return _ref; } Chozed.prototype.setup = function() { this.form_field_jq = $(this.form_field); this.current_selectedIndex = this.form_field.selectedIndex; return this.is_rtl = this.form_field_jq.hasClass("chozed-rtl"); }; Chozed.prototype.set_up_html = function() { var container_classes, container_props; container_classes = ["chozed-container"]; container_classes.push("chozed-container-" + (this.is_multiple ? "multi" : "single")); if (this.inherit_select_classes && this.form_field.className) { container_classes.push(this.form_field.className); } if (this.is_rtl) { container_classes.push("chozed-rtl"); } container_props = { 'class': container_classes.join(' '), 'style': "width: " + (this.container_width()) + ";", 'title': this.form_field.title }; if (this.form_field.id.length) { container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chozed"; } this.container = $("
    ", container_props); if (this.is_multiple) { this.container.html('
      '); } else { this.container.html('' + this.default_text + '
        '); } this.form_field_jq.hide().after(this.container); this.dropdown = this.container.find('div.chozed-drop').first(); this.search_field = this.container.find('input').first(); this.search_results = this.container.find('ul.chozed-results').first(); this.search_field_scale(); this.search_no_results = this.container.find('li.no-results').first(); if (this.is_multiple) { this.search_choices = this.container.find('ul.chozed-choices').first(); this.search_container = this.container.find('li.search-field').first(); } else { this.search_container = this.container.find('div.chozed-search').first(); this.selected_item = this.container.find('.chozed-single').first(); } this.results_build(); this.set_tab_index(); this.set_label_behavior(); return this.form_field_jq.trigger("chozed:ready", { chozed: this }); }; Chozed.prototype.register_observers = function() { var _this = this; this.container.bind('mousedown.chozed', function(evt) { _this.container_mousedown(evt); }); this.container.bind('mouseup.chozed', function(evt) { _this.container_mouseup(evt); }); this.container.bind('mouseenter.chozed', function(evt) { _this.mouse_enter(evt); }); this.container.bind('mouseleave.chozed', function(evt) { _this.mouse_leave(evt); }); this.search_results.bind('mouseup.chozed', function(evt) { _this.search_results_mouseup(evt); }); this.search_results.bind('mouseover.chozed', function(evt) { _this.search_results_mouseover(evt); }); this.search_results.bind('mouseout.chozed', function(evt) { _this.search_results_mouseout(evt); }); this.search_results.bind('mousewheel.chozed DOMMouseScroll.chozed', function(evt) { _this.search_results_mousewheel(evt); }); this.search_results.bind('touchstart.chozed', function(evt) { _this.search_results_touchstart(evt); }); this.search_results.bind('touchmove.chozed', function(evt) { _this.search_results_touchmove(evt); }); this.search_results.bind('touchend.chozed', function(evt) { _this.search_results_touchend(evt); }); this.form_field_jq.bind("chozed:updated.chozed", function(evt) { _this.results_update_field(evt); }); this.form_field_jq.bind("chozed:activate.chozed", function(evt) { _this.activate_field(evt); }); this.form_field_jq.bind("chozed:open.chozed", function(evt) { _this.container_mousedown(evt); }); this.form_field_jq.bind("chozed:close.chozed", function(evt) { _this.input_blur(evt); }); this.search_field.bind('blur.chozed', function(evt) { _this.input_blur(evt); }); this.search_field.bind('keyup.chozed', function(evt) { _this.keyup_checker(evt); }); this.search_field.bind('keydown.chozed', function(evt) { _this.keydown_checker(evt); }); this.search_field.bind('focus.chozed', function(evt) { _this.input_focus(evt); }); this.search_field.bind('cut.chozed', function(evt) { _this.clipboard_event_checker(evt); }); this.search_field.bind('paste.chozed', function(evt) { _this.clipboard_event_checker(evt); }); if (this.is_multiple) { return this.search_choices.bind('click.chozed', function(evt) { _this.choices_click(evt); }); } else { return this.container.bind('click.chozed', function(evt) { evt.preventDefault(); }); } }; Chozed.prototype.destroy = function() { $(this.container[0].ownerDocument).unbind("click.chozed", this.click_test_action); if (this.search_field[0].tabIndex) { this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex; } this.container.remove(); this.form_field_jq.removeData('chozed'); return this.form_field_jq.show(); }; Chozed.prototype.search_field_disabled = function() { this.is_disabled = this.form_field_jq[0].disabled; if (this.is_disabled) { this.container.addClass('chozed-disabled'); this.search_field[0].disabled = true; if (!this.is_multiple) { this.selected_item.unbind("focus.chozed", this.activate_action); } return this.close_field(); } else { this.container.removeClass('chozed-disabled'); this.search_field[0].disabled = false; if (!this.is_multiple) { return this.selected_item.bind("focus.chozed", this.activate_action); } } }; Chozed.prototype.container_mousedown = function(evt) { if (!this.is_disabled) { if (evt && evt.type === "mousedown" && !this.results_showing) { evt.preventDefault(); } if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) { if (!this.active_field) { if (this.is_multiple) { this.search_field.val(""); } $(this.container[0].ownerDocument).bind('click.chozed', this.click_test_action); this.results_show(); } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chozed-single").length)) { evt.preventDefault(); this.results_toggle(); } return this.activate_field(); } } }; Chozed.prototype.container_mouseup = function(evt) { if (evt.target.nodeName === "ABBR" && !this.is_disabled) { return this.results_reset(evt); } }; Chozed.prototype.search_results_mousewheel = function(evt) { var delta; if (evt.originalEvent) { delta = -evt.originalEvent.wheelDelta || evt.originalEvent.detail; } if (delta != null) { evt.preventDefault(); if (evt.type === 'DOMMouseScroll') { delta = delta * 40; } return this.search_results.scrollTop(delta + this.search_results.scrollTop()); } }; Chozed.prototype.blur_test = function(evt) { if (!this.active_field && this.container.hasClass("chozed-container-active")) { return this.close_field(); } }; Chozed.prototype.close_field = function() { $(this.container[0].ownerDocument).unbind("click.chozed", this.click_test_action); this.active_field = false; this.results_hide(); this.container.removeClass("chozed-container-active"); this.clear_backstroke(); this.show_search_field_default(); return this.search_field_scale(); }; Chozed.prototype.activate_field = function() { this.container.addClass("chozed-container-active"); this.active_field = true; this.search_field.val(this.search_field.val()); return this.search_field.focus(); }; Chozed.prototype.test_active_click = function(evt) { var active_container; active_container = $(evt.target).closest('.chozed-container'); if (active_container.length && this.container[0] === active_container[0]) { return this.active_field = true; } else { return this.close_field(); } }; Chozed.prototype.results_build = function() { this.parsing = true; this.selected_option_count = null; this.results_data = SelectParser.select_to_array(this.form_field); if (this.is_multiple) { this.search_choices.find("li.search-choice").remove(); } else if (!this.is_multiple) { this.single_set_selected_text(); if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) { this.search_field[0].readOnly = true; this.container.addClass("chozed-container-single-nosearch"); } else { this.search_field[0].readOnly = false; this.container.removeClass("chozed-container-single-nosearch"); } } this.update_results_content(this.results_option_build({ first: true })); this.search_field_disabled(); this.show_search_field_default(); this.search_field_scale(); return this.parsing = false; }; Chozed.prototype.result_do_highlight = function(el) { var high_bottom, high_top, maxHeight, visible_bottom, visible_top; if (el.length) { this.result_clear_highlight(); this.result_highlight = el; this.result_highlight.addClass("highlighted"); maxHeight = parseInt(this.search_results.css("maxHeight"), 10); visible_top = this.search_results.scrollTop(); visible_bottom = maxHeight + visible_top; high_top = this.result_highlight.position().top + this.search_results.scrollTop(); high_bottom = high_top + this.result_highlight.outerHeight(); if (high_bottom >= visible_bottom) { return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0); } else if (high_top < visible_top) { return this.search_results.scrollTop(high_top); } } }; Chozed.prototype.result_clear_highlight = function() { if (this.result_highlight) { this.result_highlight.removeClass("highlighted"); } return this.result_highlight = null; }; Chozed.prototype.results_show = function() { if (this.is_multiple && this.max_selected_options <= this.choices_count()) { this.form_field_jq.trigger("chozed:maxselected", { chozed: this }); return false; } this.container.addClass("chozed-with-drop"); this.results_showing = true; this.search_field.focus(); this.search_field.val(this.search_field.val()); this.winnow_results(); return this.form_field_jq.trigger("chozed:showing_dropdown", { chozed: this }); }; Chozed.prototype.update_results_content = function(content) { return this.search_results.html(content); }; Chozed.prototype.results_hide = function() { if (this.results_showing) { this.result_clear_highlight(); this.container.removeClass("chozed-with-drop"); this.form_field_jq.trigger("chozed:hiding_dropdown", { chozed: this }); } return this.results_showing = false; }; Chozed.prototype.set_tab_index = function(el) { var ti; if (this.form_field.tabIndex) { ti = this.form_field.tabIndex; this.form_field.tabIndex = -1; return this.search_field[0].tabIndex = ti; } }; Chozed.prototype.set_label_behavior = function() { var _this = this; this.form_field_label = this.form_field_jq.parents("label"); if (!this.form_field_label.length && this.form_field.id.length) { this.form_field_label = $("label[for='" + this.form_field.id + "']"); } if (this.form_field_label.length > 0) { return this.form_field_label.bind('click.chozed', function(evt) { if (_this.is_multiple) { return _this.container_mousedown(evt); } else { return _this.activate_field(); } }); } }; Chozed.prototype.show_search_field_default = function() { if (this.is_multiple && this.choices_count() < 1 && !this.active_field) { this.search_field.val(this.default_text); return this.search_field.addClass("default"); } else { this.search_field.val(""); return this.search_field.removeClass("default"); } }; Chozed.prototype.search_results_mouseup = function(evt) { var target; target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); if (target.length) { this.result_highlight = target; this.result_select(evt); return this.search_field.focus(); } }; Chozed.prototype.search_results_mouseover = function(evt) { var target; target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); if (target) { return this.result_do_highlight(target); } }; Chozed.prototype.search_results_mouseout = function(evt) { if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) { return this.result_clear_highlight(); } }; Chozed.prototype.choice_build = function(item) { var choice, close_link, _this = this; choice = $('
      • ', { "class": "search-choice" }).html("" + item.html + ""); if (item.disabled) { choice.addClass('search-choice-disabled'); } else { close_link = $('', { "class": 'search-choice-close', 'data-option-array-index': item.array_index }); close_link.bind('click.chozed', function(evt) { return _this.choice_destroy_link_click(evt); }); choice.append(close_link); } return this.search_container.before(choice); }; Chozed.prototype.choice_destroy_link_click = function(evt) { evt.preventDefault(); evt.stopPropagation(); if (!this.is_disabled) { return this.choice_destroy($(evt.target)); } }; Chozed.prototype.choice_destroy = function(link) { if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) { this.show_search_field_default(); if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) { this.results_hide(); } link.parents('li').first().remove(); return this.search_field_scale(); } }; Chozed.prototype.results_reset = function() { this.reset_single_select_options(); this.form_field.options[0].selected = true; this.single_set_selected_text(); this.show_search_field_default(); this.results_reset_cleanup(); this.form_field_jq.trigger("change"); if (this.active_field) { return this.results_hide(); } }; Chozed.prototype.results_reset_cleanup = function() { this.current_selectedIndex = this.form_field.selectedIndex; return this.selected_item.find("abbr").remove(); }; Chozed.prototype.result_select = function(evt) { var high, item; if (this.result_highlight) { high = this.result_highlight; this.result_clear_highlight(); if (this.is_multiple && this.max_selected_options <= this.choices_count()) { this.form_field_jq.trigger("chozed:maxselected", { chozed: this }); return false; } if (this.is_multiple) { high.removeClass("active-result"); } else { this.reset_single_select_options(); } item = this.results_data[high[0].getAttribute("data-option-array-index")]; item.selected = true; this.form_field.options[item.options_index].selected = true; this.selected_option_count = null; if (this.is_multiple) { this.choice_build(item); } else { this.single_set_selected_text(item.text); } if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) { this.results_hide(); } this.search_field.val(""); if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) { this.form_field_jq.trigger("change", { 'selected': this.form_field.options[item.options_index].value }); } this.current_selectedIndex = this.form_field.selectedIndex; return this.search_field_scale(); } }; Chozed.prototype.single_set_selected_text = function(text) { if (text == null) { text = this.default_text; } if (text === this.default_text) { this.selected_item.addClass("chozed-default"); } else { this.single_deselect_control_build(); this.selected_item.removeClass("chozed-default"); } return this.selected_item.find("span").text(text); }; Chozed.prototype.result_deselect = function(pos) { var result_data; result_data = this.results_data[pos]; if (!this.form_field.options[result_data.options_index].disabled) { result_data.selected = false; this.form_field.options[result_data.options_index].selected = false; this.selected_option_count = null; this.result_clear_highlight(); if (this.results_showing) { this.winnow_results(); } this.form_field_jq.trigger("change", { deselected: this.form_field.options[result_data.options_index].value }); this.search_field_scale(); return true; } else { return false; } }; Chozed.prototype.single_deselect_control_build = function() { if (!this.allow_single_deselect) { return; } if (!this.selected_item.find("abbr").length) { this.selected_item.find("span").first().after(""); } return this.selected_item.addClass("chozed-single-with-deselect"); }; Chozed.prototype.get_search_text = function() { if (this.search_field.val() === this.default_text) { return ""; } else { return $('
        ').text($.trim(this.search_field.val())).html(); } }; Chozed.prototype.winnow_results_set_highlight = function() { var do_high, selected_results; selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : []; do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first(); if (do_high != null) { return this.result_do_highlight(do_high); } }; Chozed.prototype.no_results = function(terms) { var no_results_html; no_results_html = $('
      • ' + this.results_none_found + ' ""
      • '); no_results_html.find("span").first().html(terms); this.search_results.append(no_results_html); return this.form_field_jq.trigger("chozed:no_results", { chozed: this }); }; Chozed.prototype.no_results_clear = function() { return this.search_results.find(".no-results").remove(); }; Chozed.prototype.keydown_arrow = function() { var next_sib; if (this.results_showing && this.result_highlight) { next_sib = this.result_highlight.nextAll("li.active-result").first(); if (next_sib) { return this.result_do_highlight(next_sib); } } else { return this.results_show(); } }; Chozed.prototype.keyup_arrow = function() { var prev_sibs; if (!this.results_showing && !this.is_multiple) { return this.results_show(); } else if (this.result_highlight) { prev_sibs = this.result_highlight.prevAll("li.active-result"); if (prev_sibs.length) { return this.result_do_highlight(prev_sibs.first()); } else { if (this.choices_count() > 0) { this.results_hide(); } return this.result_clear_highlight(); } } }; Chozed.prototype.keydown_backstroke = function() { var next_available_destroy; if (this.pending_backstroke) { this.choice_destroy(this.pending_backstroke.find("a").first()); return this.clear_backstroke(); } else { next_available_destroy = this.search_container.siblings("li.search-choice").last(); if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) { this.pending_backstroke = next_available_destroy; if (this.single_backstroke_delete) { return this.keydown_backstroke(); } else { return this.pending_backstroke.addClass("search-choice-focus"); } } } }; Chozed.prototype.clear_backstroke = function() { if (this.pending_backstroke) { this.pending_backstroke.removeClass("search-choice-focus"); } return this.pending_backstroke = null; }; Chozed.prototype.keydown_checker = function(evt) { var stroke, _ref1; stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode; this.search_field_scale(); if (stroke !== 8 && this.pending_backstroke) { this.clear_backstroke(); } switch (stroke) { case 8: this.backstroke_length = this.search_field.val().length; break; case 9: if (this.results_showing && !this.is_multiple) { this.result_select(evt); } this.mouse_on_container = false; break; case 13: evt.preventDefault(); break; case 38: evt.preventDefault(); this.keyup_arrow(); break; case 40: evt.preventDefault(); this.keydown_arrow(); break; } }; Chozed.prototype.search_field_scale = function() { var div, f_width, h, style, style_block, styles, w, _i, _len; if (this.is_multiple) { h = 0; w = 0; style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"; styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing']; for (_i = 0, _len = styles.length; _i < _len; _i++) { style = styles[_i]; style_block += style + ":" + this.search_field.css(style) + ";"; } div = $('
        ', { 'style': style_block }); div.text(this.search_field.val()); $('body').append(div); w = div.width() + 25; div.remove(); f_width = this.container.outerWidth(); if (w > f_width - 10) { w = f_width - 10; } return this.search_field.css({ 'width': w + 'px' }); } }; return Chozed; })(AbstractChozed); }).call(this); // source --> https://www.lbaa.lt/wp-content/plugins/file-away/lib/js/context/contextmenu.js?ver=3.9.6.1 /** * jQuery.contextMenu - Show a custom context when right clicking something * Jonas Arnklint, http://github.com/arnklint/jquery-contextMenu * Released into the public domain * Date: Jan 14, 2011 * @author Jonas Arnklint * @version 1.7 * */ // Making a local '$' alias of jQuery to support jQuery.noConflict (function($) { jQuery.fn.contextMenu = function ( name, actions, options ) { var me = this, win = $(window), menu = $('
          ').hide().appendTo('body'), activeElement = null, // last clicked element that responds with contextMenu originalEvent = null, // the original contextmenu event hideMenu = function() { $('.ssfa-values-context-menu:visible').each(function() { $(this).trigger("closed"); $(this).hide(); $('body').unbind('click', hideMenu); menu.unbind('closed'); }); }, default_options = { shiftDisable : true, // Allow access to native contextMenu by rightclick + shift disable_native_context_menu: false, // disables the native contextmenu everywhere you click leftClick: false // show menu on left mouse click instead of right }, options = $.extend(default_options, options); $(document).bind('contextmenu', function(e) { if (options.disable_native_context_menu) { e.preventDefault(); } hideMenu(); }); $(window).bind('blur', function () { hideMenu(); }); $.each(actions, function(me, itemOptions) { if (itemOptions.link) { var link = itemOptions.link; } else { var link = '
          '+me+''; } var menuItem = $('
        • ' + link + '
        • '); if (itemOptions.klass) { menuItem.attr("class", itemOptions.klass); } menuItem.appendTo(menu).bind('click', function(e) { itemOptions.click(activeElement, originalEvent); e.preventDefault(); }); }); if (options.leftClick) { var mouseEvent = 'click'; } else { var mouseEvent = 'contextmenu'; } var mouseEventFunc = function(e){ if (options.shiftDisable && e.shiftKey) { return true } // Hide any existing context menus hideMenu(); activeElement = $(this); // set clicked element originalEvent = e; // Store the original context menu event if (options.showMenu) { options.showMenu.call(menu, activeElement); } // Bind to the closed event if there is a hideMenu handler specified if (options.hideMenu) { menu.bind("closed", function() { options.hideMenu.call(menu, activeElement); }); } menu.css({ visibility: 'hidden', position: 'absolute', zIndex: 1000 }); // include margin so it can be used to offset from page border. var mWidth = menu.outerWidth(true), mHeight = menu.outerHeight(true), xPos = ((e.pageX - win.scrollLeft()) + mWidth < win.width()) ? e.pageX : e.pageX - mWidth, yPos = ((e.pageY - win.scrollTop()) + mHeight < win.height()) ? e.pageY : e.pageY - mHeight; menu.show(0, function() { $('body').bind('click', hideMenu); }).css({ visibility: 'visible', top: yPos + 'px', left: xPos + 'px', zIndex: 1000 }); return false; } if (options.delegateEventTo) { return me.on(mouseEvent, options.delegateEventTo, mouseEventFunc) } else { return me.bind(mouseEvent, mouseEventFunc); } } })(jQuery); // source --> https://www.lbaa.lt/wp-content/plugins/file-away/lib/js/footable.js?ver=2.0.1.2 /*! * FooTable - Awesome Responsive Tables * Version : 2.0.1.2 * http://fooplugins.com/plugins/footable-jquery/ * * Requires jQuery - http://jquery.com/ * * Copyright 2013 Steven Usher & Brad Vincent * Released under the MIT license * You are free to use FooTable in commercial projects as long as this copyright header is left intact. * * Date: 21 Sep 2013 */ (function ($, w, undefined) { w.footable = { options: { delay: 100, // The number of millseconds to wait before triggering the react event breakpoints: { // The different screen resolution breakpoints phone: 480, tablet: 1024 }, parsers: { // The default parser to parse the value out of a cell (values are used in building up row detail) alpha: function (cell) { return $(cell).data('value') || $.trim($(cell).text()); }, numeric: function (cell) { var val = $(cell).data('value') || $(cell).text().replace(/[^0-9.\-]/g, ''); val = parseFloat(val); if (isNaN(val)) val = 0; return val; } }, addRowToggle: true, calculateWidthOverride: null, toggleSelector: ' > tbody > tr:not(.footable-row-detail)', //the selector to show/hide the detail row columnDataSelector: '> thead > tr:last-child > th, > thead > tr:last-child > td', //the selector used to find the column data in the thead // columnDataSelector: '> thead > tr > th', //the selector used to find the column data in the thead //columnDataSelector : '> thead > tr:first-child > th', detailSeparator: ':', //the separator character used when building up the detail row toggleHTMLElement: '', // override this if you want to insert a click target rather than use a background image. createGroupedDetail: function (data) { var groups = { '_none': { 'name': null, 'data': [] } }; for (var i = 0; i < data.length; i++) { var groupid = data[i].group; if (groupid !== null) { if (!(groupid in groups)) groups[groupid] = { 'name': data[i].groupName || data[i].group, 'data': [] }; groups[groupid].data.push(data[i]); } else { groups._none.data.push(data[i]); } } return groups; }, createDetail: function (element, data, createGroupedDetail, separatorChar, classes) { /// This function is used by FooTable to generate the detail view seen when expanding a collapsed row. /// This is the div that contains all the detail row information, anything could be added to it. /// /// This is an array of objects containing the cell information for the current row. /// These objects look like the below: /// obj = { /// 'name': String, // The name of the column /// 'value': Object, // The value parsed from the cell using the parsers. This could be a string, a number or whatever the parser outputs. /// 'display': String, // This is the actual HTML from the cell, so if you have images etc you want moved this is the one to use and is the default value used. /// 'group': String, // This is the identifier used in the data-group attribute of the column. /// 'groupName': String // This is the actual name of the group the column belongs to. /// } /// /// The grouping function to group the data /// The separator charactor used /// The array of class names used to build up the detail row var groups = createGroupedDetail(data); for (var group in groups) { if (groups[group].data.length === 0) continue; if (group !== '_none') element.append('
          ' + groups[group].name + '
          '); for (var j = 0; j < groups[group].data.length; j++) { var separator = (groups[group].data[j].name) ? separatorChar : ''; element.append('
          ' + groups[group].data[j].name + separator + '
          ' + groups[group].data[j].display + '
          '); } } }, classes: { main: 'footable', loading: 'footable-loading', loaded: 'footable-loaded', toggle: 'footable-toggle', disabled: 'footable-disabled', detail: 'footable-row-detail', detailCell: 'footable-row-detail-cell', detailInner: 'footable-row-detail-inner', detailInnerRow: 'footable-row-detail-row', detailInnerGroup: 'footable-row-detail-group', detailInnerName: 'footable-row-detail-name', detailInnerValue: 'footable-row-detail-value', detailShow: 'footable-detail-show' }, triggers: { initialize: 'footable_initialize', //trigger this event to force FooTable to reinitialize resize: 'footable_resize', //trigger this event to force FooTable to resize redraw: 'footable_redraw', //trigger this event to force FooTable to redraw toggleRow: 'footable_toggle_row', //trigger this event to force FooTable to toggle a row expandFirstRow: 'footable_expand_first_row', //trigger this event to force FooTable to expand the first row expandAll: 'footable_expand_all', //trigger this event to force FooTable to expand all rows collapseAll: 'footable_collapse_all' //trigger this event to force FooTable to collapse all rows }, events: { alreadyInitialized: 'footable_already_initialized', //fires when the FooTable has already been initialized initializing: 'footable_initializing', //fires before FooTable starts initializing initialized: 'footable_initialized', //fires after FooTable has finished initializing resizing: 'footable_resizing', //fires before FooTable resizes resized: 'footable_resized', //fires after FooTable has resized redrawn: 'footable_redrawn', //fires after FooTable has redrawn breakpoint: 'footable_breakpoint', //fires inside the resize function, when a breakpoint is hit columnData: 'footable_column_data', //fires when setting up column data. Plugins should use this event to capture their own info about a column rowDetailUpdating: 'footable_row_detail_updating', //fires before a detail row is updated rowDetailUpdated: 'footable_row_detail_updated', //fires when a detail row is being updated rowCollapsed: 'footable_row_collapsed', //fires when a row is collapsed rowExpanded: 'footable_row_expanded', //fires when a row is expanded rowRemoved: 'footable_row_removed', //fires when a row is removed reset: 'footable_reset' //fires when FooTable is reset }, debug: false, // Whether or not to log information to the console. log: null }, version: { major: 0, minor: 5, toString: function () { return w.footable.version.major + '.' + w.footable.version.minor; }, parse: function (str) { version = /(\d+)\.?(\d+)?\.?(\d+)?/.exec(str); return { major: parseInt(version[1], 10) || 0, minor: parseInt(version[2], 10) || 0, patch: parseInt(version[3], 10) || 0 }; } }, plugins: { _validate: function (plugin) { ///Simple validation of the to make sure any members called by FooTable actually exist. ///The object defining the plugin, this should implement a string property called "name" and a function called "init". if (!$.isFunction(plugin)) { if (w.footable.options.debug === true) console.error('Validation failed, expected type "function", received type "{0}".', typeof plugin); return false; } var p = new plugin(); if (typeof p['name'] !== 'string') { if (w.footable.options.debug === true) console.error('Validation failed, plugin does not implement a string property called "name".', p); return false; } if (!$.isFunction(p['init'])) { if (w.footable.options.debug === true) console.error('Validation failed, plugin "' + p['name'] + '" does not implement a function called "init".', p); return false; } if (w.footable.options.debug === true) console.log('Validation succeeded for plugin "' + p['name'] + '".', p); return true; }, registered: [], // An array containing all registered plugins. register: function (plugin, options) { ///Registers a and its default with FooTable. ///The plugin that should implement a string property called "name" and a function called "init". ///The default options to merge with the FooTable's base options. if (w.footable.plugins._validate(plugin)) { w.footable.plugins.registered.push(plugin); if (typeof options === 'object') $.extend(true, w.footable.options, options); } }, load: function(instance){ var loaded = [], registered, i; for(i = 0; i < w.footable.plugins.registered.length; i++){ try { registered = w.footable.plugins.registered[i]; loaded.push(new registered(instance)); } catch (err) { if (w.footable.options.debug === true) console.error(err); } } return loaded; }, init: function (instance) { ///Loops through all registered plugins and calls the "init" method supplying the current of the FooTable as the first parameter. ///The current instance of the FooTable that the plugin is being initialized for. for (var i = 0; i < instance.plugins.length; i++) { try { instance.plugins[i]['init'](instance); } catch (err) { if (w.footable.options.debug === true) console.error(err); } } } } }; var instanceCount = 0; $.fn.footable = function (options) { ///The main constructor call to initialize the plugin using the supplied . /// ///A JSON object containing user defined options for the plugin to use. Any options not supplied will have a default value assigned. ///Check the documentation or the default options object above for more information on available options. /// options = options || {}; var o = $.extend(true, {}, w.footable.options, options); //merge user and default options return this.each(function () { instanceCount++; var footable = new Footable(this, o, instanceCount); $(this).data('footable', footable); }); }; //helper for using timeouts function Timer() { ///Simple timer object created around a timeout. var t = this; t.id = null; t.busy = false; t.start = function (code, milliseconds) { ///Starts the timer and waits the specified amount of before executing the supplied . ///The code to execute once the timer runs out. ///The time in milliseconds to wait before executing the supplied . if (t.busy) { return; } t.stop(); t.id = setTimeout(function () { code(); t.id = null; t.busy = false; }, milliseconds); t.busy = true; }; t.stop = function () { ///Stops the timer if its runnning and resets it back to its starting state. if (t.id !== null) { clearTimeout(t.id); t.id = null; t.busy = false; } }; } function Footable(t, o, id) { ///Inits a new instance of the plugin. ///The main table element to apply this plugin to. ///The options supplied to the plugin. Check the defaults object to see all available options. ///The id to assign to this instance of the plugin. var ft = this; ft.id = id; ft.table = t; ft.options = o; ft.breakpoints = []; ft.breakpointNames = ''; ft.columns = {}; ft.plugins = w.footable.plugins.load(ft); var opt = ft.options, cls = opt.classes, evt = opt.events, trg = opt.triggers, indexOffset = 0; // This object simply houses all the timers used in the FooTable. ft.timers = { resize: new Timer(), register: function (name) { ft.timers[name] = new Timer(); return ft.timers[name]; } }; ft.init = function () { var $window = $(w), $table = $(ft.table); w.footable.plugins.init(ft); if ($table.hasClass(cls.loaded)) { //already loaded FooTable for the table, so don't init again ft.raise(evt.alreadyInitialized); return; } //raise the initializing event ft.raise(evt.initializing); $table.addClass(cls.loading); // Get the column data once for the life time of the plugin $table.find(opt.columnDataSelector).each(function () { var data = ft.getColumnData(this); ft.columns[data.index] = data; }); // Create a nice friendly array to work with out of the breakpoints object. for (var name in opt.breakpoints) { ft.breakpoints.push({ 'name': name, 'width': opt.breakpoints[name] }); ft.breakpointNames += (name + ' '); } // Sort the breakpoints so the smallest is checked first ft.breakpoints.sort(function (a, b) { return a['width'] - b['width']; }); $table .unbind(trg.initialize) //bind to FooTable initialize trigger .bind(trg.initialize, function () { //remove previous "state" (to "force" a resize) $table.removeData('footable_info'); $table.data('breakpoint', ''); //trigger the FooTable resize $table.trigger(trg.resize); //remove the loading class $table.removeClass(cls.loading); //add the FooTable and loaded class $table.addClass(cls.loaded).addClass(cls.main); //raise the initialized event ft.raise(evt.initialized); }) .unbind(trg.redraw) //bind to FooTable redraw trigger .bind(trg.redraw, function () { ft.redraw(); }) .unbind(trg.resize) //bind to FooTable resize trigger .bind(trg.resize, function () { ft.resize(); }) .unbind(trg.expandFirstRow) //bind to FooTable expandFirstRow trigger .bind(trg.expandFirstRow, function () { $table.find(opt.toggleSelector).first().not('.' + cls.detailShow).trigger(trg.toggleRow); }) .unbind(trg.expandAll) //bind to FooTable expandFirstRow trigger .bind(trg.expandAll, function () { $table.find(opt.toggleSelector).not('.' + cls.detailShow).trigger(trg.toggleRow); }) .unbind(trg.collapseAll) //bind to FooTable expandFirstRow trigger .bind(trg.collapseAll, function () { $table.find('.' + cls.detailShow).trigger(trg.toggleRow); }); //trigger a FooTable initialize $table.trigger(trg.initialize); //bind to window resize $window .bind('resize.footable', function () { ft.timers.resize.stop(); ft.timers.resize.start(function () { ft.raise(trg.resize); }, opt.delay); }); }; ft.addRowToggle = function () { if (!opt.addRowToggle) return; var $table = $(ft.table), hasToggleColumn = false; //first remove all toggle spans $table.find('span.' + cls.toggle).remove(); for (var c in ft.columns) { var col = ft.columns[c]; if (col.toggle) { hasToggleColumn = true; var selector = '> tbody > tr:not(.' + cls.detail + ',.' + cls.disabled + ') > td:nth-child(' + (parseInt(col.index, 10) + 1) + ')'; $table.find(selector).not('.' + cls.detailCell).prepend($(opt.toggleHTMLElement).addClass(cls.toggle)); return; } } //check if we have an toggle column. If not then add it to the first column just to be safe if (!hasToggleColumn) { $table .find('> tbody > tr:not(.' + cls.detail + ',.' + cls.disabled + ') > td:first-child') .not('.' + cls.detailCell) .prepend($(opt.toggleHTMLElement).addClass(cls.toggle)); } }; ft.setColumnClasses = function () { $table = $(ft.table); for (var c in ft.columns) { var col = ft.columns[c]; if (col.className !== null) { var selector = '', first = true; $.each(col.matches, function (m, match) { //support for colspans if (!first) selector += ', '; selector += '> tbody > tr:not(.' + cls.detail + ') > td:nth-child(' + (parseInt(match, 10) + 1) + ')'; first = false; }); //add the className to the cells specified by data-class="blah" $table.find(selector).not('.' + cls.detailCell).addClass(col.className); } } }; //moved this out into it's own function so that it can be called from other add-ons ft.bindToggleSelectors = function () { var $table = $(ft.table); if (!ft.hasAnyBreakpointColumn()) return; $table.find(opt.toggleSelector).unbind(trg.toggleRow).bind(trg.toggleRow, function (e) { var $row = $(this).is('tr') ? $(this) : $(this).parents('tr:first'); ft.toggleDetail($row); }); $table.find(opt.toggleSelector).unbind('click.footable').bind('click.footable', function (e) { if ($table.is('.breakpoint') && $(e.target).is('td,.'+ cls.toggle)) { $(this).trigger(trg.toggleRow); } }); }; ft.parse = function (cell, column) { var parser = opt.parsers[column.type] || opt.parsers.alpha; return parser(cell); }; ft.getColumnData = function (th) { var $th = $(th), hide = $th.data('hide'), index = $th.index(); hide = hide || ''; hide = jQuery.map(hide.split(','), function (a) { return jQuery.trim(a); }); var data = { 'index': index, 'hide': { }, 'type': $th.data('type') || 'alpha', 'name': $th.data('name') || $.trim($th.text()), 'ignore': $th.data('ignore') || false, 'toggle': $th.data('toggle') || false, 'className': $th.data('class') || null, 'matches': [], 'names': { }, 'group': $th.data('group') || null, 'groupName': null }; if (data.group !== null) { var $group = $(ft.table).find('> thead > tr.footable-group-row > th[data-group="' + data.group + '"], > thead > tr.footable-group-row > td[data-group="' + data.group + '"]').first(); data.groupName = ft.parse($group, { 'type': 'alpha' }); } var pcolspan = parseInt($th.prev().attr('colspan') || 0, 10); indexOffset += pcolspan > 1 ? pcolspan - 1 : 0; var colspan = parseInt($th.attr('colspan') || 0, 10), curindex = data.index + indexOffset; if (colspan > 1) { var names = $th.data('names'); names = names || ''; names = names.split(','); for (var i = 0; i < colspan; i++) { data.matches.push(i + curindex); if (i < names.length) data.names[i + curindex] = names[i]; } } else { data.matches.push(curindex); } data.hide['default'] = ($th.data('hide') === "all") || ($.inArray('default', hide) >= 0); var hasBreakpoint = false; for (var name in opt.breakpoints) { data.hide[name] = ($th.data('hide') === "all") || ($.inArray(name, hide) >= 0); hasBreakpoint = hasBreakpoint || data.hide[name]; } data.hasBreakpoint = hasBreakpoint; var e = ft.raise(evt.columnData, { 'column': { 'data': data, 'th': th } }); return e.column.data; }; ft.getViewportWidth = function () { return window.innerWidth || (document.body ? document.body.offsetWidth : 0); }; ft.calculateWidth = function ($table, info) { if (jQuery.isFunction(opt.calculateWidthOverride)) { return opt.calculateWidthOverride($table, info); } if (info.viewportWidth < info.width) info.width = info.viewportWidth; if (info.parentWidth < info.width) info.width = info.parentWidth; return info; }; ft.hasBreakpointColumn = function (breakpoint) { for (var c in ft.columns) { if (ft.columns[c].hide[breakpoint]) { if (ft.columns[c].ignore) { continue; } return true; } } return false; }; ft.hasAnyBreakpointColumn = function () { for (var c in ft.columns) { if (ft.columns[c].hasBreakpoint) { return true; } } return false; }; ft.resize = function () { var $table = $(ft.table); if (!$table.is(':visible')) { return; } //we only care about FooTables that are visible if (!ft.hasAnyBreakpointColumn()) { return; } //we only care about FooTables that have breakpoints var info = { 'width': $table.width(), //the table width 'viewportWidth': ft.getViewportWidth(), //the width of the viewport 'parentWidth': $table.parent().width() //the width of the parent }; info = ft.calculateWidth($table, info); var pinfo = $table.data('footable_info'); $table.data('footable_info', info); ft.raise(evt.resizing, { 'old': pinfo, 'info': info }); // This (if) statement is here purely to make sure events aren't raised twice as mobile safari seems to do if (!pinfo || (pinfo && pinfo.width && pinfo.width !== info.width)) { var current = null, breakpoint; for (var i = 0; i < ft.breakpoints.length; i++) { breakpoint = ft.breakpoints[i]; if (breakpoint && breakpoint.width && info.width <= breakpoint.width) { current = breakpoint; break; } } var breakpointName = (current === null ? 'default' : current['name']), hasBreakpointFired = ft.hasBreakpointColumn(breakpointName), previousBreakpoint = $table.data('breakpoint'); $table .data('breakpoint', breakpointName) .removeClass('default breakpoint').removeClass(ft.breakpointNames) .addClass(breakpointName + (hasBreakpointFired ? ' breakpoint' : '')); //only do something if the breakpoint has changed if (breakpointName !== previousBreakpoint) { //trigger a redraw $table.trigger(trg.redraw); //raise a breakpoint event ft.raise(evt.breakpoint, { 'breakpoint': breakpointName, 'info': info }); } } ft.raise(evt.resized, { 'old': pinfo, 'info': info }); }; ft.redraw = function () { //add the toggler to each row ft.addRowToggle(); //bind the toggle selector click events ft.bindToggleSelectors(); //set any cell classes defined for the columns ft.setColumnClasses(); var $table = $(ft.table), breakpointName = $table.data('breakpoint'), hasBreakpointFired = ft.hasBreakpointColumn(breakpointName); $table .find('> tbody > tr:not(.' + cls.detail + ')').data('detail_created', false).end() .find('> thead > tr:last-child > th') .each(function () { var data = ft.columns[$(this).index()], selector = '', first = true; $.each(data.matches, function (m, match) { if (!first) { selector += ', '; } var count = match + 1; selector += '> tbody > tr:not(.' + cls.detail + ') > td:nth-child(' + count + ')'; selector += ', > tfoot > tr:not(.' + cls.detail + ') > td:nth-child(' + count + ')'; selector += ', > colgroup > col:nth-child(' + count + ')'; first = false; }); selector += ', > thead > tr[data-group-row="true"] > th[data-group="' + data.group + '"]'; var $column = $table.find(selector).add(this); if (data.hide[breakpointName] === false) $column.show(); else $column.hide(); if ($table.find('> thead > tr.footable-group-row').length === 1) { var $groupcols = $table.find('> thead > tr:last-child > th[data-group="' + data.group + '"]:visible, > thead > tr:last-child > th[data-group="' + data.group + '"]:visible'), $group = $table.find('> thead > tr.footable-group-row > th[data-group="' + data.group + '"], > thead > tr.footable-group-row > td[data-group="' + data.group + '"]'), groupspan = 0; $.each($groupcols, function () { groupspan += parseInt($(this).attr('colspan') || 1, 10); }); if (groupspan > 0) $group.attr('colspan', groupspan).show(); else $group.hide(); } }) .end() .find('> tbody > tr.' + cls.detailShow).each(function () { ft.createOrUpdateDetailRow(this); }); $table.find('> tbody > tr.' + cls.detailShow + ':visible').each(function () { var $next = $(this).next(); if ($next.hasClass(cls.detail)) { if (!hasBreakpointFired) $next.hide(); else $next.show(); } }); // adding .footable-first-column and .footable-last-column to the first and last th and td of each row in order to allow // for styling if the first or last column is hidden (which won't work using :first-child or :last-child) $table.find('> thead > tr > th.footable-last-column, > tbody > tr > td.footable-last-column').removeClass('footable-last-column'); $table.find('> thead > tr > th.footable-first-column, > tbody > tr > td.footable-first-column').removeClass('footable-first-column'); $table.find('> thead > tr, > tbody > tr') .find('> th:visible:last, > td:visible:last') .addClass('footable-last-column') .end() .find('> th:visible:first, > td:visible:first') .addClass('footable-first-column'); ft.raise(evt.redrawn); }; ft.toggleDetail = function (row) { var $row = (row.jquery) ? row : $(row), $next = $row.next(); //check if the row is already expanded if ($row.hasClass(cls.detailShow)) { $row.removeClass(cls.detailShow); //only hide the next row if it's a detail row if ($next.hasClass(cls.detail)) $next.hide(); ft.raise(evt.rowCollapsed, { 'row': $row[0] }); } else { ft.createOrUpdateDetailRow($row[0]); $row.addClass(cls.detailShow) .next().show(); ft.raise(evt.rowExpanded, { 'row': $row[0] }); } }; ft.removeRow = function (row) { var $row = (row.jquery) ? row : $(row); if ($row.hasClass(cls.detail)) { $row = $row.prev(); } var $next = $row.next(); if ($row.data('detail_created') === true) { //remove the detail row $next.remove(); } $row.remove(); //raise event ft.raise(evt.rowRemoved); }; ft.appendRow = function (row) { var $row = (row.jquery) ? row : $(row); $(ft.table).find('tbody').append($row); //redraw the table ft.redraw(); }; ft.getColumnFromTdIndex = function (index) { /// Returns the correct column data for the supplied index taking into account colspans. /// The index to retrieve the column data for. /// A JSON object containing the column data for the supplied index. var result = null; for (var column in ft.columns) { if ($.inArray(index, ft.columns[column].matches) >= 0) { result = ft.columns[column]; break; } } return result; }; ft.createOrUpdateDetailRow = function (actualRow) { var $row = $(actualRow), $next = $row.next(), $detail, values = []; if ($row.data('detail_created') === true) return true; if ($row.is(':hidden')) return false; //if the row is hidden for some reason (perhaps filtered) then get out of here ft.raise(evt.rowDetailUpdating, { 'row': $row, 'detail': $next }); $row.find('> td:hidden').each(function () { var index = $(this).index(), column = ft.getColumnFromTdIndex(index), name = column.name; if (column.ignore === true) return true; if (index in column.names) name = column.names[index]; values.push({ 'name': name, 'value': ft.parse(this, column), 'display': $.trim($(this).html()), 'group': column.group, 'groupName': column.groupName }); return true; }); if (values.length === 0) return false; //return if we don't have any data to show var colspan = $row.find('> td:visible').length; var exists = $next.hasClass(cls.detail); if (!exists) { // Create $next = $('
          '); $row.after($next); } $next.find('> td:first').attr('colspan', colspan); $detail = $next.find('.' + cls.detailInner).empty(); opt.createDetail($detail, values, opt.createGroupedDetail, opt.detailSeparator, cls); $row.data('detail_created', true); ft.raise(evt.rowDetailUpdated, { 'row': $row, 'detail': $next }); return !exists; }; ft.raise = function (eventName, args) { if (ft.options.debug === true && $.isFunction(ft.options.log)) ft.options.log(eventName, 'event'); args = args || { }; var def = { 'ft': ft }; $.extend(true, def, args); var e = $.Event(eventName, def); if (!e.ft) { $.extend(true, e, def); } //pre jQuery 1.6 which did not allow data to be passed to event object constructor $(ft.table).trigger(e); return e; }; //reset the state of FooTable ft.reset = function() { var $table = $(ft.table); $table.removeData('footable_info') .data('breakpoint', '') .removeClass(cls.loading) .removeClass(cls.loaded); $table.find(opt.toggleSelector).unbind(trg.toggleRow).unbind('click.footable'); $table.find('> tbody > tr').removeClass(cls.detailShow); $table.find('> tbody > tr.' + cls.detail).remove(); ft.raise(evt.reset); }; ft.init(); return ft; } })(jQuery, window); /* SORTING */ (function ($, w, undefined) { if (w.footable === undefined || w.footable === null) throw new Error('Please check and make sure footable.js is included in the page and is loaded prior to this script.'); var defaults = { sort: true, sorters: { alpha: function (a, b) { if (a === b) return 0; if (a < b) return -1; return 1; }, numeric: function (a, b) { return a - b; } }, classes: { sort: { sortable: 'footable-sortable', sorted: 'footable-sorted', descending: 'footable-sorted-desc', indicator: 'footable-sort-indicator' } }, events: { sort: { sorting: 'footable_sorting', sorted: 'footable_sorted' } } }; function Sort() { var p = this; p.name = 'Footable Sortable'; p.init = function (ft) { p.footable = ft; if (ft.options.sort === true) { $(ft.table) .unbind('.sorting') .bind({ 'footable_initialized.sorting': function (e) { var $table = $(ft.table), $tbody = $table.find('> tbody'), cls = ft.options.classes.sort, column, $th; if ($table.data('sort') === false) return; $table.find('> thead > tr:last-child > th, > thead > tr:last-child > td').each(function (ec) { $th = $(this), column = ft.columns[$th.index()]; if (column.sort.ignore !== true && !$th.hasClass(cls.sortable)) { $th.addClass(cls.sortable); $('').addClass(cls.indicator).appendTo($th); } }); $table.find('> thead > tr:last-child > th.' + cls.sortable + ', > thead > tr:last-child > td.' + cls.sortable).unbind('click.footable').bind('click.footable', function (ec) { ec.preventDefault(); $th = $(this); var ascending = !$th.hasClass(cls.sorted); p.doSort($th.index(), ascending); return false; }); var didSomeSorting = false; for (var c in ft.columns) { column = ft.columns[c]; if (column.sort.initial) { var ascending = (column.sort.initial !== 'descending'); p.doSort(column.index, ascending); break; } } if (didSomeSorting) { ft.bindToggleSelectors(); } }, 'footable_redrawn.sorting': function(e) { var $table = $(ft.table), cls = ft.options.classes.sort; if ($table.data('sorted') >= 0) { $table.find('> thead > tr:last-child > th').each(function(i){ var $th = $(this); if ($th.hasClass(cls.sorted) || $th.hasClass(cls.descending)) { p.doSort(i); return; } }); } }, 'footable_column_data.sorting': function (e) { var $th = $(e.column.th); e.column.data.sort = e.column.data.sort || {}; e.column.data.sort.initial = $th.data('sort-initial') || false; e.column.data.sort.ignore = $th.data('sort-ignore') || false; e.column.data.sort.selector = $th.data('sort-selector') || null; var match = $th.data('sort-match') || 0; if (match >= e.column.data.matches.length) match = 0; e.column.data.sort.match = e.column.data.matches[match]; } }) //save the sort object onto the table so we can access it later .data('footable-sort', p); } }; p.doSort = function(columnIndex, ascending) { var ft = p.footable; if ($(ft.table).data('sort') === false) return; var $table = $(ft.table), $tbody = $table.find('> tbody'), column = ft.columns[columnIndex], $th = $table.find('> thead > tr:last-child > th:eq(' + columnIndex + ')'), cls = ft.options.classes.sort, evt = ft.options.events.sort; ascending = (ascending === undefined) ? $th.hasClass(cls.sorted) : (ascending === 'toggle') ? !$th.hasClass(cls.sorted) : ascending; if (column.sort.ignore === true) return true; //raise a pre-sorting event so that we can cancel the sorting if needed var event = ft.raise(evt.sorting, { column: column, direction: ascending ? 'ASC' : 'DESC' }); if (event && event.result === false) return; $table.data('sorted', column.index); $table.find('> thead > tr:last-child > th, > thead > tr:last-child > td').not($th).removeClass(cls.sorted + ' ' + cls.descending); if (ascending === undefined) { ascending = $th.hasClass(cls.sorted); } if (ascending) { $th.removeClass(cls.descending).addClass(cls.sorted); } else { $th.removeClass(cls.sorted).addClass(cls.descending); } p.sort(ft, $tbody, column, ascending); ft.bindToggleSelectors(); ft.raise(evt.sorted, { column: column, direction: ascending ? 'ASC' : 'DESC' }); }; p.rows = function (ft, tbody, column) { var rows = []; tbody.find('> tr').each(function () { var $row = $(this), $next = null; if ($row.hasClass(ft.options.classes.detail)) return true; if ($row.next().hasClass(ft.options.classes.detail)) { $next = $row.next().get(0); } var row = { 'row': $row, 'detail': $next }; if (column !== undefined) { row.value = ft.parse(this.cells[column.sort.match], column); } rows.push(row); return true; }).detach(); return rows; }; p.sort = function (ft, tbody, column, ascending) { var rows = p.rows(ft, tbody, column); var sorter = ft.options.sorters[column.type] || ft.options.sorters.alpha; rows.sort(function (a, b) { if (ascending) { return sorter(a.value, b.value); } else { return sorter(b.value, a.value); } }); for (var j = 0; j < rows.length; j++) { tbody.append(rows[j].row); if (rows[j].detail !== null) { tbody.append(rows[j].detail); } } }; } w.footable.plugins.register(Sort, defaults); })(jQuery, window); /* FILTERING */ (function ($, w, undefined) { if (w.footable === undefined || w.footable === null) throw new Error('Please check and make sure footable.js is included in the page and is loaded prior to this script.'); var defaults = { filter: { enabled: true, input: '.footable-filter', timeout: 300, minimum: 2, disableEnter: false, filterFunction: function(index) { var $t = $(this), $table = $t.parents('table:first'), filter = $table.data('current-filter').toUpperCase(), text = $t.find('td').text(); if (!$table.data('filter-text-only')) { $t.find('td[data-value]').each(function () { text += $(this).data('value'); }); } return text.toUpperCase().indexOf(filter) >= 0; } } }; function Filter() { var p = this; p.name = 'Footable Filter'; p.init = function (ft) { p.footable = ft; if (ft.options.filter.enabled === true) { if ($(ft.table).data('filter') === false) return; ft.timers.register('filter'); $(ft.table) .unbind('.filtering') .bind({ 'footable_initialized.filtering': function (e) { var $table = $(ft.table); var data = { 'input': $table.data('filter') || ft.options.filter.input, 'timeout': $table.data('filter-timeout') || ft.options.filter.timeout, 'minimum': $table.data('filter-minimum') || ft.options.filter.minimum, 'disableEnter': $table.data('filter-disable-enter') || ft.options.filter.disableEnter }; if (data.disableEnter) { $(data.input).keypress(function (event) { if (window.event) return (window.event.keyCode !== 13); else return (event.which !== 13); }); } $table.bind('footable_clear_filter', function () { $(data.input).val(''); p.clearFilter(); }); $table.bind('footable_filter', function (event, args) { p.filter(args.filter); }); $(data.input).keyup(function (eve) { ft.timers.filter.stop(); if (eve.which === 27) { $(data.input).val(''); } ft.timers.filter.start(function () { var val = $(data.input).val() || ''; p.filter(val); }, data.timeout); }); }, 'footable_redrawn.filtering': function (e) { var $table = $(ft.table), filter = $table.data('filter-string'); if (filter) { p.filter(filter); } } }) //save the filter object onto the table so we can access it later .data('footable-filter', p); } }; p.filter = function (filterString) { var ft = p.footable, $table = $(ft.table), minimum = $table.data('filter-minimum') || ft.options.filter.minimum, clear = !filterString; //raise a pre-filter event so that we can cancel the filtering if needed var event = ft.raise('footable_filtering', { filter: filterString, clear: clear }); if (event && event.result === false) return; if (event.filter && event.filter.length < minimum) { return; //if we do not have the minimum chars then do nothing } if (event.clear) { p.clearFilter(); } else { var filters = event.filter.split(' '); $table.find('> tbody > tr').hide().addClass('footable-filtered'); var rows = $table.find('> tbody > tr:not(.footable-row-detail)'); $.each(filters, function (i, f) { if (f && f.length > 0) { $table.data('current-filter', f); rows = rows.filter(ft.options.filter.filterFunction); } }); rows.each(function () { p.showRow(this, ft); $(this).removeClass('footable-filtered'); }); $table.data('filter-string', event.filter); ft.raise('footable_filtered', { filter: event.filter, clear: false }); } }; p.clearFilter = function () { var ft = p.footable, $table = $(ft.table); $table.find('> tbody > tr:not(.footable-row-detail)').removeClass('footable-filtered').each(function () { p.showRow(this, ft); }); $table.removeData('filter-string'); ft.raise('footable_filtered', { clear: true }); }; p.showRow = function (row, ft) { var $row = $(row), $next = $row.next(), $table = $(ft.table); if ($row.is(':visible')) return; //already visible - do nothing if ($table.hasClass('breakpoint') && $row.hasClass('footable-detail-show') && $next.hasClass('footable-row-detail')) { $row.add($next).show(); ft.createOrUpdateDetailRow(row); } else $row.show(); }; } w.footable.plugins.register(Filter, defaults); })(jQuery, window); /* PAGINATION */ (function ($, w, undefined) { if (w.footable === undefined || w.footable === null) throw new Error('Please check and make sure footable.js is included in the page and is loaded prior to this script.'); var defaults = { paginate: true, pageSize: 10, pageNavigation: '.ssfa-pagination', firstText: '«', previousText: '‹', nextText: '›', lastText: '»' }; function pageInfo(ft) { var $table = $(ft.table), $tbody = $table.find('> tbody'); this.pageNavigation = $table.data('page-navigation') || ft.options.pageNavigation; this.pageSize = $table.data('page-size') || ft.options.pageSize; this.firstText = $table.data('page-first-text') || ft.options.firstText; this.previousText = $table.data('page-previous-text') || ft.options.previousText; this.nextText = $table.data('page-next-text') || ft.options.nextText; this.lastText = $table.data('page-last-text') || ft.options.lastText; this.currentPage = 0; this.pages = []; this.control = false; } function Paginate() { var p = this; p.name = 'Footable Paginate'; p.init = function (ft) { if (ft.options.paginate === true) { if ($(ft.table).data('page') === false) return; p.footable = ft; $(ft.table) .unbind('.paging') .bind({ 'footable_initialized.paging footable_row_removed.paging footable_redrawn.paging footable_sorted.paging footable_filtered.paging': function () { p.setupPaging(); } }) //save the filter object onto the table so we can access it later .data('footable-paging', p); } }; p.setupPaging = function () { var ft = p.footable, $tbody = $(ft.table).find('> tbody'); if (!ft.pageInfo) { ft.pageInfo = new pageInfo(ft); } p.createPages(ft, $tbody); p.createNavigation(ft, $tbody); p.fillPage(ft, $tbody, ft.pageInfo.currentPage); }; p.createPages = function (ft, tbody) { var pages = 1; var info = ft.pageInfo; var pageCount = pages * info.pageSize; var page = []; var lastPage = []; info.pages = []; var rows = tbody.find('> tr:not(.footable-filtered,.footable-row-detail)'); rows.each(function (i, row) { page.push(row); if (i === pageCount - 1) { info.pages.push(page); pages++; pageCount = pages * info.pageSize; page = []; } else if (i >= rows.length - (rows.length % info.pageSize)) { lastPage.push(row); } }); if (lastPage.length > 0) info.pages.push(lastPage); if (info.currentPage >= info.pages.length) info.currentPage = info.pages.length - 1; if (info.currentPage < 0) info.currentPage = 0; if (info.pages.length === 1) { //we only have a single page $(ft.table).addClass('no-paging'); } else { $(ft.table).removeClass('no-paging'); } }; p.createNavigation = function (ft, tbody) { var $nav = $(ft.table).find(ft.pageInfo.pageNavigation); //if we cannot find the navigation control within the table, then try find it outside if ($nav.length === 0) { $nav = $(ft.pageInfo.pageNavigation); //if the navigation control is inside another table, then get out if ($nav.parents('table:first') !== $(ft.table)) return; //if we found more than one navigation control, write error to console if ($nav.length > 1 && ft.options.debug === true) console.error('More than one pagination control was found!'); } //if we still cannot find the control, then don't do anything if ($nav.length === 0) return; //if the nav is not a UL, then find or create a UL if (!$nav.is('ul')) { if ($nav.find('ul:first').length === 0) { $nav.append('
            '); } $nav = $nav.find('ul'); } $nav.find('li').remove(); var info = ft.pageInfo; var total = info.pages.length; info.control = $nav; if (info.pages.length > 0) { $nav.append('
          • ' + ft.pageInfo.firstText + ''); $nav.append('
          • ' + ft.pageInfo.previousText + '
          • '); $.each(info.pages, function (i, page) { if (page.length > 0) { $pagenum = $('
          • ' + (i + 1) + '
          • '); $nav.append($pagenum); if(i>4) $pagenum.hide(); } }); $nav.append('
          • ' + ft.pageInfo.nextText + '
          • '); $nav.append('
          • ' + ft.pageInfo.lastText + '
          • '); } $nav.find('a').click(function (e) { if(window.name !== '' && window.name !== 'new' && window.name !== 'blank' && window.name !== '_new'){ $name = window.name; } else { $name = $(this).parents('div.ssfa-meta-container').attr('id'); } e.preventDefault(); var page = $(this).data('page'); var newPage = info.currentPage; if (page === 'first') { newPage = 0; } else if (page === 'prev') { if (newPage > 0) newPage--; } else if (page === 'next') { if (newPage < info.pages.length - 1) newPage++; } else if (page === 'last') { newPage = info.pages.length - 1; } else { newPage = page; } p.paginate(ft, newPage); $('html, body', window.top.document).animate({ scrollTop: $("div#"+$name, window.top.document).offset().top -75 }, 500); }); p.setPagingClasses($nav, info.currentPage, info.pages.length); }; p.paginate = function (ft, newPage) { var info = ft.pageInfo; if(info.currentPage !== newPage){ $last = info.pages.length-1; $penult = $last-1; $minus = newPage < 3 ? 0 : (newPage == $penult ? newPage-3 : (newPage == $last ? newPage-4 : newPage-2)); $plus = newPage < 3 ? 4 : newPage+2; $('li.footable-page a').each(function(){ $pagenum = $(this).data('page'); if($.isNumeric($pagenum)) { if($pagenum > $plus || $pagenum < $minus) $(this).parents('li').eq(0).hide(); else $(this).parents('li').eq(0).show(); } }); var $tbody = $(ft.table).find('> tbody'); //raise a pre-pagin event so that we can cancel the paging if needed var event = ft.raise('footable_paging', { page: newPage, size: info.pageSize }); if (event && event.result === false) return; p.fillPage(ft, $tbody, newPage); info.control.find('li').removeClass('active disabled'); p.setPagingClasses(info.control, info.currentPage, info.pages.length); } }; p.setPagingClasses = function (nav, currentPage, pageCount) { nav.find('li.footable-page > a[data-page=' + currentPage + ']').parent().addClass('active'); if (currentPage >= pageCount - 1) { nav.find('li.footable-page-arrow > a[data-page="next"]').parent().addClass('disabled'); nav.find('li.footable-page-arrow > a[data-page="last"]').parent().addClass('disabled'); } if (currentPage < 1) { nav.find('li.footable-page-arrow > a[data-page="first"]').parent().addClass('disabled'); nav.find('li.footable-page-arrow > a[data-page="prev"]').parent().addClass('disabled'); } }; p.fillPage = function (ft, tbody, pageNumber) { ft.pageInfo.currentPage = pageNumber; tbody.find('> tr').hide(); $(ft.pageInfo.pages[pageNumber]).each(function () { p.showRow(this, ft); }); }; p.showRow = function (row, ft) { var $row = $(row), $next = $row.next(), $table = $(ft.table); if ($table.hasClass('breakpoint') && $row.hasClass('footable-detail-show') && $next.hasClass('footable-row-detail')) { $row.add($next).show(); ft.createOrUpdateDetailRow(row); } else $row.show(); }; } w.footable.plugins.register(Paginate, defaults); })(jQuery, window); // source --> https://www.lbaa.lt/wp-content/plugins/file-away/lib/js/filertify.js?ver=0.3.11 /** * alertify * An unobtrusive customizable JavaScript notification system * * @author Fabien Doiron * @copyright Fabien Doiron 2013 * @license MIT * @link http://fabien-d.github.com/alertify.js/ * @module alertify * @version 0.3.11 */ (function (global, undefined) { "use strict"; var document = global.document, Filertify; Filertify = function () { var _filertify = {}, dialogs = {}, isopen = false, keys = { ENTER: 13, ESC: 27, SPACE: 32 }, queue = [], $, btnCancel, btnOK, btnReset, btnResetBack, btnFocus, elCallee, elCover, elDialog, elLog, form, input, getTransitionEvent; /** * Markup pieces * @type {Object} */ dialogs = { buttons : { holder : "", submit : "", ok : "", cancel : "" }, input : "
            ", message : "

            {{message}}

            ", log : "
            {{message}}
            " }; /** * Return the proper transitionend event * @return {String} Transition type string */ getTransitionEvent = function () { var t, type, supported = false, el = document.createElement("fakeelement"), transitions = { "WebkitTransition" : "webkitTransitionEnd", "MozTransition" : "transitionend", "OTransition" : "otransitionend", "transition" : "transitionend" }; for (t in transitions) { if (el.style[t] !== undefined) { type = transitions[t]; supported = true; break; } } return { type : type, supported : supported }; }; /** * Shorthand for document.getElementById() * * @param {String} id A specific element ID * @return {Object} HTML element */ $ = function (id) { return document.getElementById(id) !== 'undefined' && document.getElementById(id) != undefined ? document.getElementById(id) : document.getElementById(id); }; /** * Filertify private object * @type {Object} */ _filertify = { /** * Labels object * @type {Object} */ labels : { ok : "OK", cancel : "Cancel" }, /** * Delay number * @type {Number} */ delay : 5000, /** * Whether buttons are reversed (default is secondary/primary) * @type {Boolean} */ buttonReverse : false, /** * Which button should be focused by default * @type {String} "ok" (default), "cancel", or "none" */ buttonFocus : "ok", /** * Set the transition event on load * @type {[type]} */ transition : undefined, /** * Set the proper button click events * * @param {Function} fn [Optional] Callback function * * @return {undefined} */ addListeners : function (fn) { var hasOK = (typeof btnOK !== "undefined"), hasCancel = (typeof btnCancel !== "undefined"), hasInput = (typeof input !== "undefined"), val = "", self = this, ok, cancel, common, key, reset; // ok event handler ok = function (event) { if (typeof event.preventDefault !== "undefined") event.preventDefault(); common(event); if (typeof input !== "undefined") val = input.value; if (typeof fn === "function") { if (typeof input !== "undefined") { fn(true, val); } else fn(true); } return false; }; // cancel event handler cancel = function (event) { if (typeof event.preventDefault !== "undefined") event.preventDefault(); common(event); if (typeof fn === "function") fn(false); return false; }; // common event handler (keyup, ok and cancel) common = function (event) { self.hide(); self.unbind(document.body, "keyup", key); self.unbind(btnReset, "focus", reset); if (hasOK) self.unbind(btnOK, "click", ok); if (hasCancel) self.unbind(btnCancel, "click", cancel); }; // keyup handler key = function (event) { var keyCode = event.keyCode; if ((keyCode === keys.SPACE && !hasInput) || (hasInput && keyCode === keys.ENTER)) ok(event); if (keyCode === keys.ESC && hasCancel) cancel(event); }; // reset focus to first item in the dialog reset = function (event) { if (hasInput) input.focus(); else if (!hasCancel || self.buttonReverse) btnOK.focus(); else btnCancel.focus(); }; // handle reset focus link // this ensures that the keyboard focus does not // ever leave the dialog box until an action has // been taken this.bind(btnReset, "focus", reset); this.bind(btnResetBack, "focus", reset); // handle OK click if (hasOK) this.bind(btnOK, "click", ok); // handle Cancel click if (hasCancel) this.bind(btnCancel, "click", cancel); // listen for keys, Cancel => ESC this.bind(document.body, "keyup", key); if (!this.transition.supported) { this.setFocus(); } }, /** * Bind events to elements * * @param {Object} el HTML Object * @param {Event} event Event to attach to element * @param {Function} fn Callback function * * @return {undefined} */ bind : function (el, event, fn) { if (typeof el.addEventListener === "function") { el.addEventListener(event, fn, false); } else if (el.attachEvent) { el.attachEvent("on" + event, fn); } }, /** * Use filertify as the global error handler (using window.onerror) * * @return {boolean} success */ handleErrors : function () { if (typeof global.onerror !== "undefined") { var self = this; global.onerror = function (msg, url, line) { self.error("[" + msg + " on line " + line + " of " + url + "]", 0); }; return true; } else { return false; } }, /** * Append button HTML strings * * @param {String} secondary The secondary button HTML string * @param {String} primary The primary button HTML string * * @return {String} The appended button HTML strings */ appendButtons : function (secondary, primary) { return this.buttonReverse ? primary + secondary : secondary + primary; }, /** * Build the proper message box * * @param {Object} item Current object in the queue * * @return {String} An HTML string of the message box */ build : function (item) { var html = "", type = item.type, message = item.message, css = item.cssClass || ""; html += "
            "; html += "Reset Focus"; if (_filertify.buttonFocus === "none") html += ""; // doens't require an actual form if (type === "prompt") html += "
            "; html += "
            "; html += dialogs.message.replace("{{message}}", message); if (type === "prompt") html += dialogs.input; html += dialogs.buttons.holder; html += "
            "; if (type === "prompt") html += "
            "; html += "Reset Focus"; html += "
            "; switch (type) { case "confirm": html = html.replace("{{buttons}}", this.appendButtons(dialogs.buttons.cancel, dialogs.buttons.ok)); html = html.replace("{{ok}}", this.labels.ok).replace("{{cancel}}", this.labels.cancel); break; case "prompt": html = html.replace("{{buttons}}", this.appendButtons(dialogs.buttons.cancel, dialogs.buttons.submit)); html = html.replace("{{ok}}", this.labels.ok).replace("{{cancel}}", this.labels.cancel); break; case "alert": html = html.replace("{{buttons}}", dialogs.buttons.ok); html = html.replace("{{ok}}", this.labels.ok); break; default: break; } elDialog.className = "filertify filertify-" + type + " " + css; elCover.className = "filertify-cover"; return html; }, /** * Close the log messages * * @param {Object} elem HTML Element of log message to close * @param {Number} wait [optional] Time (in ms) to wait before automatically hiding the message, if 0 never hide * * @return {undefined} */ close : function (elem, wait) { // Unary Plus: +"2" === 2 var timer = (wait && !isNaN(wait)) ? +wait : this.delay, self = this, hideElement, transitionDone; // set click event on log messages this.bind(elem, "click", function () { hideElement(elem); }); // Hide the dialog box after transition // This ensure it doens't block any element from being clicked transitionDone = function (event) { event.stopPropagation(); // unbind event so function only gets called once self.unbind(this, self.transition.type, transitionDone); // remove log message elLog.removeChild(this); if (!elLog.hasChildNodes()) elLog.className += " filertify-logs-hidden"; }; // this sets the hide class to transition out // or removes the child if css transitions aren't supported hideElement = function (el) { // ensure element exists if (typeof el !== "undefined" && el.parentNode === elLog) { // whether CSS transition exists if (self.transition.supported) { self.bind(el, self.transition.type, transitionDone); el.className += " filertify-log-hide"; } else { elLog.removeChild(el); if (!elLog.hasChildNodes()) elLog.className += " filertify-logs-hidden"; } } }; // never close (until click) if wait is set to 0 if (wait === 0) return; // set timeout to auto close the log message setTimeout(function () { hideElement(elem); }, timer); }, /** * Create a dialog box * * @param {String} message The message passed from the callee * @param {String} type Type of dialog to create * @param {Function} fn [Optional] Callback function * @param {String} placeholder [Optional] Default value for prompt input field * @param {String} cssClass [Optional] Class(es) to append to dialog box * * @return {Object} */ dialog : function (message, type, fn, placeholder, cssClass) { // set the current active element // this allows the keyboard focus to be resetted // after the dialog box is closed elCallee = document.activeElement; // check to ensure the filertify dialog element // has been successfully created var check = function () { if ((elLog && elLog.scrollTop !== null) && (elCover && elCover.scrollTop !== null)) return; else setTimeout(check, 2500); }; // error catching if (typeof message !== "string") throw new Error("message must be a string"); if (typeof type !== "string") throw new Error("type must be a string"); if (typeof fn !== "undefined" && typeof fn !== "function") throw new Error("fn must be a function"); // initialize filertify if it hasn't already been done this.init(); check(); queue.push({ type: type, message: message, callback: fn, placeholder: placeholder, cssClass: cssClass }); if (!isopen) this.setup(); return this; }, /** * Extend the log method to create custom methods * * @param {String} type Custom method name * * @return {Function} */ extend : function (type) { if (typeof type !== "string") throw new Error("extend method must have exactly one paramter"); return function (message, wait) { this.log(message, type, wait); return this; }; }, /** * Hide the dialog and rest to defaults * * @return {undefined} */ hide : function () { var transitionDone, self = this; // remove reference from queue queue.splice(0,1); // if items remaining in the queue if (queue.length > 0) this.setup(true); else { isopen = false; // Hide the dialog box after transition // This ensure it doens't block any element from being clicked transitionDone = function (event) { event.stopPropagation(); // unbind event so function only gets called once self.unbind(elDialog, self.transition.type, transitionDone); }; // whether CSS transition exists if (this.transition.supported) { this.bind(elDialog, this.transition.type, transitionDone); elDialog.className = "filertify filertify-hide filertify-hidden"; } else { elDialog.className = "filertify filertify-hide filertify-hidden filertify-isHidden"; } elCover.className = "filertify-cover filertify-cover-hidden"; // set focus to the last element or body // after the dialog is closed elCallee.focus(); } }, /** * Initialize Filertify * Create the 2 main elements * * @return {undefined} */ init : function () { // ensure legacy browsers support html5 tags document.createElement("nav"); document.createElement("article"); document.createElement("section"); // cover if ($("filertify-cover") == null) { elCover = document.createElement("div"); elCover.setAttribute("id", "filertify-cover"); elCover.className = "filertify-cover filertify-cover-hidden"; document.body.appendChild(elCover); } // main element if ($("filertify") == null) { isopen = false; queue = []; elDialog = document.createElement("section"); elDialog.setAttribute("id", "filertify"); elDialog.className = "filertify filertify-hidden"; document.body.appendChild(elDialog); } // log element if ($("filertify-logs") == null) { elLog = document.createElement("section"); elLog.setAttribute("id", "filertify-logs"); elLog.className = "filertify-logs filertify-logs-hidden"; document.body.appendChild(elLog); } // set tabindex attribute on body element // this allows script to give it focus // after the dialog is closed document.body.setAttribute("tabindex", "0"); // set transition type this.transition = getTransitionEvent(); }, /** * Show a new log message box * * @param {String} message The message passed from the callee * @param {String} type [Optional] Optional type of log message * @param {Number} wait [Optional] Time (in ms) to wait before auto-hiding the log * * @return {Object} */ log : function (message, type, wait) { // check to ensure the filertify dialog element // has been successfully created var check = function () { if (elLog && elLog.scrollTop !== null) return; else setTimeout(check, 2500); }; // initialize filertify if it hasn't already been done this.init(); check(); elLog.className = "filertify-logs"; this.notify(message, type, wait); return this; }, /** * Add new log message * If a type is passed, a class name "filertify-log-{type}" will get added. * This allows for custom look and feel for various types of notifications. * * @param {String} message The message passed from the callee * @param {String} type [Optional] Type of log message * @param {Number} wait [Optional] Time (in ms) to wait before auto-hiding * * @return {undefined} */ notify : function (message, type, wait) { var log = document.createElement("article"); log.className = "filertify-log" + ((typeof type === "string" && type !== "") ? " filertify-log-" + type : ""); log.innerHTML = message; // append child elLog.appendChild(log); // triggers the CSS animation setTimeout(function() { log.className = log.className + " filertify-log-show"; }, 50); this.close(log, wait); }, /** * Set properties * * @param {Object} args Passing parameters * * @return {undefined} */ set : function (args) { var k; // error catching if (typeof args !== "object" && args instanceof Array) throw new Error("args must be an object"); // set parameters for (k in args) { if (args.hasOwnProperty(k)) { this[k] = args[k]; } } }, /** * Common place to set focus to proper element * * @return {undefined} */ setFocus : function () { if (input) { input.focus(); input.select(); } else btnFocus.focus(); }, /** * Initiate all the required pieces for the dialog box * * @return {undefined} */ setup : function (fromQueue) { var item = queue[0], self = this, transitionDone; // dialog is open isopen = true; // Set button focus after transition transitionDone = function (event) { event.stopPropagation(); self.setFocus(); // unbind event so function only gets called once self.unbind(elDialog, self.transition.type, transitionDone); }; // whether CSS transition exists if (this.transition.supported && !fromQueue) { this.bind(elDialog, this.transition.type, transitionDone); } // build the proper dialog HTML elDialog.innerHTML = this.build(item); // assign all the common elements btnReset = $("filertify-resetFocus"); btnResetBack = $("filertify-resetFocusBack"); btnOK = $("filertify-ok") || undefined; btnCancel = $("filertify-cancel") || undefined; btnFocus = (_filertify.buttonFocus === "cancel") ? btnCancel : ((_filertify.buttonFocus === "none") ? $("filertify-noneFocus") : btnOK), input = $("filertify-text") || undefined; form = $("filertify-form") || undefined; // add placeholder value to the input field if (typeof item.placeholder === "string" && item.placeholder !== "") input.value = item.placeholder; if (fromQueue) this.setFocus(); this.addListeners(item.callback); }, /** * Unbind events to elements * * @param {Object} el HTML Object * @param {Event} event Event to detach to element * @param {Function} fn Callback function * * @return {undefined} */ unbind : function (el, event, fn) { if (typeof el.removeEventListener === "function") { el.removeEventListener(event, fn, false); } else if (el.detachEvent) { el.detachEvent("on" + event, fn); } } }; return { alert : function (message, fn, cssClass) { _filertify.dialog(message, "alert", fn, "", cssClass); return this; }, confirm : function (message, fn, cssClass) { _filertify.dialog(message, "confirm", fn, "", cssClass); return this; }, extend : _filertify.extend, init : _filertify.init, log : function (message, type, wait) { _filertify.log(message, type, wait); return this; }, prompt : function (message, fn, placeholder, cssClass) { _filertify.dialog(message, "prompt", fn, placeholder, cssClass); return this; }, success : function (message, wait) { _filertify.log(message, "success", wait); return this; }, error : function (message, wait) { _filertify.log(message, "error", wait); return this; }, set : function (args) { _filertify.set(args); }, labels : _filertify.labels, debug : _filertify.handleErrors }; }; // AMD and window support if (typeof define === "function") { define([], function () { return new Filertify(); }); } else if (typeof global.filertify === "undefined") { global.filertify = new Filertify(); } }(this)); // source --> https://www.lbaa.lt/wp-content/plugins/file-away/lib/js/soundmanager2.js?ver=2.97a.20130101 /** @license * * SoundManager 2: JavaScript Sound for the Web * ---------------------------------------------- * http://schillmania.com/projects/soundmanager2/ * * Copyright (c) 2007, Scott Schiller. All rights reserved. * Code provided under the BSD License: * http://schillmania.com/projects/soundmanager2/license.txt * * V2.97a.20130101 */ (function(i,g){function R(R,fa){function S(b){return c.preferFlash&&A&&!c.ignoreFlash&&c.flash[b]!==g&&c.flash[b]}function m(b){return function(c){var d=this._s;return!d||!d._a?null:b.call(this,c)}}this.setupOptions={url:R||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1E3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0, html5Test:/^(probably|maybe)$/i,preferFlash:!0,noSWFCache:!1};this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100};this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null}; this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}};this.movieID= "sm2-container";this.id=fa||"sm2movie";this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20130101";this.altURL=this.movieURL=this.version=null;this.enabled=this.swfLoaded=!1;this.oMC=null;this.sounds={};this.soundIDs=[];this.didFlashBlock=this.muted=!1;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={};this.html5={usingFlash:null}; this.flash={};this.ignoreFlash=this.html5Only=!1;var Ga,c=this,Ha=null,h=null,T,q=navigator.userAgent,ga=i.location.href.toString(),l=document,ha,Ia,ia,k,r=[],J=!1,K=!1,j=!1,s=!1,ja=!1,L,t,ka,U,la,B,C,D,Ja,ma,V,na,W,oa,E,pa,M,qa,X,F,Ka,ra,La,sa,Ma,N=null,ta=null,v,ua,G,Y,Z,H,p,O=!1,va=!1,Na,Oa,Pa,$=0,P=null,aa,Qa=[],u=null,Ra,ba,Q,y,wa,xa,Sa,n,db=Array.prototype.slice,w=!1,ya,A,za,Ta,x,ca=q.match(/(ipad|iphone|ipod)/i),Ua=q.match(/android/i),z=q.match(/msie/i),eb=q.match(/webkit/i),Aa=q.match(/safari/i)&& !q.match(/chrome/i),Ba=q.match(/opera/i),Ca=q.match(/(mobile|pre\/|xoom)/i)||ca||Ua,Va=!ga.match(/usehtml5audio/i)&&!ga.match(/sm2\-ignorebadua/i)&&Aa&&!q.match(/silk/i)&&q.match(/OS X 10_6_([3-7])/i),Da=l.hasFocus!==g?l.hasFocus():null,da=Aa&&(l.hasFocus===g||!l.hasFocus()),Wa=!da,Xa=/(mp3|mp4|mpa|m4a|m4b)/i,Ea=l.location?l.location.protocol.match(/http/i):null,Ya=!Ea?"http://":"",Za=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,$a="mpeg4 aac flv mov mp4 m4v f4v m4a m4b mp4v 3gp 3g2".split(" "), fb=RegExp("\\.("+$a.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!Ea;var Fa;try{Fa=Audio!==g&&(Ba&&opera!==g&&10>opera.version()?new Audio(null):new Audio).canPlayType!==g}catch(hb){Fa=!1}this.hasHTML5=Fa;this.setup=function(b){var e=!c.url;b!==g&&(j&&u&&c.ok()&&(b.flashVersion!==g||b.url!==g||b.html5Test!==g))&&H(v("setupLate"));ka(b);e&&(M&&b.url!==g)&&c.beginDelayedInit();!M&&(b.url!==g&&"complete"===l.readyState)&&setTimeout(E,1);return c}; this.supported=this.ok=function(){return u?j&&!s:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(b){return T(b)||l[b]||i[b]};this.createSound=function(b,e){function d(){a=Y(a);c.sounds[a.id]=new Ga(a);c.soundIDs.push(a.id);return c.sounds[a.id]}var a,f=null;if(!j||!c.ok())return H(void 0),!1;e!==g&&(b={id:b,url:e});a=t(b);a.url=aa(a.url);if(p(a.id,!0))return c.sounds[a.id];ba(a)?(f=d(),f._setup_html5(a)):(8=b)return!1;for(b-=1;0<=b;b--)c=j[b],!c.fired&&a.position>=c.position&&(c.fired=!0,n++,c.method.apply(c.scope,[c.position]));return!0};this._resetOnPosition=function(a){var b,c;b=j.length;if(!b)return!1;for(b-=1;0<=b;b--)c=j[b],c.fired&&a<=c.position&&(c.fired=!1,n--);return!0};u=function(){var b=a._iO,c=b.from,e=b.to,d,f;f=function(){a.clearOnPosition(e,f);a.stop()};d=function(){if(null!==e&&!isNaN(e))a.onPosition(e, f)};null!==c&&!isNaN(c)&&(b.position=c,b.multiShot=!1,d());return b};m=function(){var b,c=a._iO.onposition;if(c)for(b in c)if(c.hasOwnProperty(b))a.onPosition(parseInt(b,10),c[b])};s=function(){var b,c=a._iO.onposition;if(c)for(b in c)c.hasOwnProperty(b)&&a.clearOnPosition(parseInt(b,10))};l=function(){a.isHTML5&&Na(a)};I=function(){a.isHTML5&&Oa(a)};f=function(b){b||(j=[],n=0);q=!1;a._hasTimer=null;a._a=null;a._html5_canplay=!1;a.bytesLoaded=null;a.bytesTotal=null;a.duration=a._iO&&a._iO.duration? a._iO.duration:null;a.durationEstimate=null;a.buffered=[];a.eqData=[];a.eqData.left=[];a.eqData.right=[];a.failures=0;a.isBuffering=!1;a.instanceOptions={};a.instanceCount=0;a.loaded=!1;a.metadata={};a.readyState=0;a.muted=!1;a.paused=!1;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.playState=0;a.position=null;a.id3={}};f();this._onTimer=function(b){var c,f=!1,g={};if(a._hasTimer||b){if(a._a&&(b||(0opera.version()?new Audio(null):new Audio,e=a._a,e._called_load=!1,w&&(Ha=e);a.isHTML5=!0;a._a=e;e._s=a;ab();a._apply_loop(e,b.loops);b.autoLoad||b.autoPlay?a.load():(e.autobuffer=!1,e.preload="auto");return e};ab=function(){if(a._a._added_events)return!1;var b;a._a._added_events=!0;for(b in x)x.hasOwnProperty(b)&& a._a&&a._a.addEventListener(b,x[b],!1);return!0};i=function(){var b;a._a._added_events=!1;for(b in x)x.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,x[b],!1)};this._onload=function(b){b=!!b||!a.isHTML5&&8===k&&a.duration;a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0);a._iO.onload&&a._iO.onload.apply(a,[b]);return!0};this._onbufferchange=function(b){if(0===a.playState||b&&a.isBuffering||!b&&!a.isBuffering)return!1;a.isBuffering=1===b;a._iO.onbufferchange&&a._iO.onbufferchange.apply(a);return!0}; this._onsuspend=function(){a._iO.onsuspend&&a._iO.onsuspend.apply(a);return!0};this._onfailure=function(b,c,e){a.failures++;if(a._iO.onfailure&&1===a.failures)a._iO.onfailure(a,b,c,e)};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a._resetOnPosition(0);a.instanceCount&&(a.instanceCount--,a.instanceCount||(s(),a.playState=0,a.paused=!1,a.instanceCount=0,a.instanceOptions={},a._iO={},I(),a.isHTML5&&(a.position=0)),(!a.instanceCount||a._iO.multiShotEvents)&&b&&b.apply(a))};this._whileloading= function(b,c,e,d){var f=a._iO;a.bytesLoaded=b;a.bytesTotal=c;a.duration=Math.floor(e);a.bufferLength=d;a.durationEstimate=!a.isHTML5&&!f.isMovieStar?f.duration?a.duration>f.duration?a.duration:f.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10):a.duration;a.isHTML5||(a.buffered=[{start:0,end:a.duration}]);(3!==a.readyState||a.isHTML5)&&f.whileloading&&f.whileloading.apply(a)};this._whileplaying=function(b,c,e,d,f){var h=a._iO;if(isNaN(b)||null===b)return!1;a.position=Math.max(0,b);a._processOnPosition(); !a.isHTML5&&8opera.version()?new Audio(null):new Audio:null,d,a,f={},h;h=c.audioFormats;for(d in h)if(h.hasOwnProperty(d)&&(a="audio/"+d,f[d]=b(h[d].type),f[a]=f[d],d.match(Xa)?(c.flash[d]=!0,c.flash[a]= !0):(c.flash[d]=!1,c.flash[a]=!1),h[d]&&h[d].related))for(a=h[d].related.length-1;0<=a;a--)f["audio/"+h[d].related[a]]=f[d],c.html5[h[d].related[a]]=f[d],c.flash[h[d].related[a]]=f[d];f.canPlayType=e?b:null;c.html5=t(c.html5,f);return!0};na={};v=function(){};Y=function(b){8===k&&(1k)&&(c.flashVersion=k=9);c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":9===k?" (AS3/Flash 9)":" (AS2/Flash 8)");8'}if(J&&K)return!1;if(c.html5Only)return ma(),c.oMC=T(c.movieID),ia(),K=J=!0,!1;var a=e||c.url,f=c.altURL||a,h=qa(),i=G(),k=null,k=l.getElementsByTagName("html")[0],j,n,m,k=k&&k.dir&&k.dir.match(/rtl/i),b=b===g?c.id:b;ma();c.url=Ma(Ea?a:f);e=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":c.wmode;if(null!==c.wmode&&(q.match(/msie 8/i)||!z&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))Qa.push(na.spcWmode), c.wmode=null;h={name:b,id:b,src:e,quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:Ya+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};c.debugFlash&&(h.FlashVars="debug=1");c.wmode||delete h.wmode;if(z)a=l.createElement("div"),n=['',d("movie",e),d("AllowScriptAccess",c.allowScriptAccess),d("quality",h.quality),c.wmode?d("wmode",c.wmode):"",d("bgcolor",c.bgColor),d("hasPriority","true"),c.debugFlash?d("FlashVars",h.FlashVars):"",""].join("");else for(j in a=l.createElement("embed"),h)h.hasOwnProperty(j)&&a.setAttribute(j,h[j]);ra();i=G();if(h=qa())if(c.oMC=T(c.movieID)||l.createElement("div"),c.oMC.id)m=c.oMC.className,c.oMC.className= (m?m+" ":"movieContainer")+(i?" "+i:""),c.oMC.appendChild(a),z&&(j=c.oMC.appendChild(l.createElement("div")),j.className="sm2-object-box",j.innerHTML=n),K=!0;else{c.oMC.id=c.movieID;c.oMC.className="movieContainer "+i;j=i=null;c.useFlashBlock||(c.useHighPerformance?i={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(i={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},k&&(i.left=Math.abs(parseInt(i.left,10))+"px")));eb&&(c.oMC.style.zIndex= 1E4);if(!c.debugFlash)for(m in i)i.hasOwnProperty(m)&&(c.oMC.style[m]=i[m]);try{z||c.oMC.appendChild(a),h.appendChild(c.oMC),z&&(j=c.oMC.appendChild(l.createElement("div")),j.className="sm2-object-box",j.innerHTML=n),K=!0}catch(p){throw Error(v("domError")+" \n"+p.toString());}}return J=!0};W=function(){if(c.html5Only)return X(),!1;if(h||!c.url)return!1;h=c.getMovie(c.id);h||(N?(z?c.oMC.innerHTML=ta:c.oMC.appendChild(N),N=null,J=!0):X(c.id,c.url),h=c.getMovie(c.id));"function"===typeof c.oninitmovie&& setTimeout(c.oninitmovie,1);return!0};D=function(){setTimeout(Ja,1E3)};Ja=function(){var b,e=!1;if(!c.url||O)return!1;O=!0;n.remove(i,"load",D);if(da&&!Da)return!1;j||(b=c.getMoviePercent(),0b&&(e=!0));setTimeout(function(){b=c.getMoviePercent();if(e)return O=!1,i.setTimeout(D,1),!1;!j&&Wa&&(null===b?c.useFlashBlock||0===c.flashLoadTimeout?c.useFlashBlock&&ua():B({type:"ontimeout",ignoreInit:!0}):0!==c.flashLoadTimeout&&sa(!0))},c.flashLoadTimeout)};V=function(){if(Da||!da)return n.remove(i, "focus",V),!0;Da=Wa=!0;O=!1;D();n.remove(i,"focus",V);return!0};L=function(b){if(j)return!1;if(c.html5Only)return j=!0,C(),!0;var e=!0,d;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())j=!0,s&&(d={type:!A&&u?"NO_FLASH":"INIT_TIMEOUT"});if(s||b)c.useFlashBlock&&c.oMC&&(c.oMC.className=G()+" "+(null===c.getMoviePercent()?"swf_timedout":"swf_error")),B({type:"ontimeout",error:d,ignoreInit:!0}),F(d),e=!1;s||(c.waitForWindowLoad&&!ja?n.add(i,"load",C):C());return e};Ia=function(){var b,e= c.setupOptions;for(b in e)e.hasOwnProperty(b)&&(c[b]===g?c[b]=e[b]:c[b]!==e[b]&&(c.setupOptions[b]=c[b]))};ia=function(){if(j)return!1;if(c.html5Only)return j||(n.remove(i,"load",c.beginDelayedInit),c.enabled=!0,L()),!0;W();try{h._externalInterfaceTest(!1),Ka(!0,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||h._disableDebug(),c.enabled=!0,c.html5Only||n.add(i,"unload",ha)}catch(b){return F({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),sa(!0),L(),!1}L();n.remove(i,"load",c.beginDelayedInit); return!0};E=function(){if(M)return!1;M=!0;Ia();ra();!A&&c.hasHTML5&&c.setup({useHTML5Audio:!0,preferFlash:!1});Sa();c.html5.usingFlash=Ra();u=c.html5.usingFlash;!A&&u&&(Qa.push(na.needFlash),c.setup({flashLoadTimeout:1}));l.removeEventListener&&l.removeEventListener("DOMContentLoaded",E,!1);W();return!0};xa=function(){"complete"===l.readyState&&(E(),l.detachEvent("onreadystatechange",xa));return!0};pa=function(){ja=!0;n.remove(i,"load",pa)};oa=function(){if(Ca&&(c.setupOptions.useHTML5Audio=!0,c.setupOptions.preferFlash= !1,ca||Ua&&!q.match(/android\s2\.3/i)))ca&&(c.ignoreFlash=!0),w=!0};oa();za();n.add(i,"focus",V);n.add(i,"load",D);n.add(i,"load",pa);l.addEventListener?l.addEventListener("DOMContentLoaded",E,!1):l.attachEvent?l.attachEvent("onreadystatechange",xa):F({type:"NO_DOM2_EVENTS",fatal:!0})}var fa=null;if(void 0===i.SM2_DEFER||!SM2_DEFER)fa=new R;i.SoundManager=R;i.soundManager=fa})(window);
            Warning: Cannot modify header information - headers already sent by (output started at /home/lbaa/domains/lbaa.lt/public_html/wp-content/plugins/wp-fastest-cache/wpFastestCache.php:260) in /home/lbaa/domains/lbaa.lt/public_html/wp-content/plugins/participants-database/classes/WP_Session.class.php on line 123