'use strict'; // Decodes a base64 encoded string. Returns false if it can't be decoded. // See https://stackoverflow.com/questions/30106476/using-javascripts-atob-to-decode-base64-doesnt-properly-decode-utf-8-strings function base64Decode(string) { if (typeof TextDecoder === "undefined") { return false; } const text = atob(string); const length = text.length; const bytes = new Uint8Array(length); for (let i = 0; i < length; i++) { bytes[i] = text.charCodeAt(i); } const decoder = new TextDecoder(); // default is utf-8 return decoder.decode(bytes); } function isIos() { return (window.navigator.userAgent.match(/iPad/i) || window.navigator.userAgent.match(/iPhone/i) || /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)); } function isMobile() { return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || isIos()); } $.fn.reverse = [].reverse; $.fn.isHScrollable = function () { if (this.length === 0) { return false; } // 等保修复:空集合保护(未登录页无 dwm_main 时调用会抛 TypeError) return this[0].scrollWidth > this[0].clientWidth; }; $.fn.isVScrollable = function () { if (this.length === 0) { return false; } // 等保修复:空集合保护 return this[0].scrollHeight > this[0].clientHeight; }; jQuery.fn.extend({ into a if we are using tags?] // (b) wraps the select element in a
because in some places, eg in forms, MRBS uses // a table structure and because Select2 adds a sibling element the table structure is // ruined. // (c) adjusts the width of the select2 container because Select2 doesn't always get it right // resulting in a '...' // // Get the best available language $select2_lang = basename(Language::getInstance()->getSelect2LangPath(), '.js'); ?> mrbsSelect: function(tags, useOnMobile) { if (tags || useOnMobile || !isMobile()) { tags = Boolean(tags); $(this).wrap('
') .select2({ dropdownAutoWidth: true, tags: tags, }) .next('.select2-container').each(function() { var container = $(this); container.width(container.width() + 5); }); } return($(this)); } }); function getMaxWidth (selection) { return Math.max.apply(null, selection.map(function() { return $(this).width(); }).get()); } function getErrorList(errors) { var result = {html: '', text: ''}, patternSpan = //gi, patternTags = /<\S[^><]*>/g, str; result.html += "
    "; for (var i=0; i"; result.text += '(' + (i+1).toString() + ') '; and its contents and then all other tags ?> str = errors[i].replace(patternSpan, '').replace(patternTags, ''); result.text += $('
    ').html(str).text(); result.text += " \n"; } result.html += "<\/ul>"; return result; } var visibilityPrefix = function visibilityPrefix() { var prefixes = ['', 'webkit', 'moz', 'ms', 'o']; var testProperty; if (typeof visibilityPrefix.prefix === 'undefined') { visibilityPrefix.prefix = null; for (var i=0; i