1var $j = jQuery.noConflict(); 2window.$ = $j; 3 4/*======================================uniform=====================================*/ 5// tipsy, facebook style tooltips for jquery 6// version 1.0.0a 7// (c) 2008-2010 jason frame [[email protected]] 8// released under the MIT license 9 10!function(t){function i(t,i){return"function"==typeof t?t.call(i):t}function e(i,e){this.$element=t(i),this.options=e,this.enabled=!0,this.fixTitle()}e.prototype={show:function(){var e=this.getTitle();if(e&&this.enabled){var s=this.tip();s.find(".tipsy-inner")[this.options.html?"html":"text"](e),s[0].className="tipsy",s.remove().css({top:0,left:0,visibility:"hidden",display:"block","white-space":"nowrap"}).prependTo(document.body);var o=s.width();o>300&&(o=300),s.width(o),s.css("white-space","normal");var n,l=t.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),a=s[0].offsetWidth,f=s[0].offsetHeight,h=i(this.options.gravity,this.$element[0]);switch(h.charAt(0)){case"n":n={top:l.top+l.height+this.options.offset,left:l.left+l.width/2-a/2};break;case"s":n={top:l.top-f-this.options.offset,left:l.left+l.width/2-a/2};break;case"e":n={top:l.top+l.height/2-f/2,left:l.left-a-this.options.offset};break;case"w":n={top:l.top+l.height/2-f/2,left:l.left+l.width+this.options.offset}}if(2==h.length&&(n.left="w"==h.charAt(1)?l.left+l.width/2-15:l.left+l.width/2-a+15),"absolute"!=s.css("position")&&s.css("position","absolute"),s.css(n).addClass("tipsy-"+h),this.options.fixedPosition){var r=s.offset();s.css("position","fixed"),s.offset(r)}s.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+h.charAt(0),this.options.className&&s.addClass(i(this.options.className,this.$element[0])),this.options.fade?s.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):s.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){t(this).remove()}):this.tip().remove()},fixTitle:function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("original-title"))&&t.attr("original-title",t.attr("title")||"").removeAttr("title")},getTitle:function(){var t,i=this.$element,e=this.options;this.fixTitle();var t,e=this.options;return"string"==typeof e.title?t=i.attr("title"==e.title?"original-title":e.title):"function"==typeof e.title&&(t=e.title.call(i[0])),t=(""+t).replace(/(^\s*|\s*$)/,""),t||""},tip:function(){return this.$tip||(this.$tip=t('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>')),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},t.fn.tipsy=function(i){function s(s){var o=t.data(s,"tipsy");return o||(o=new e(s,t.fn.tipsy.elementOptions(s,i)),t.data(s,"tipsy",o)),o}function o(){var t=s(this);t.hoverState="in",0==i.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn))}function n(){var t=s(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)}if(i===!0)return this.data("tipsy");if("string"==typeof i){var l=this.data("tipsy");return l&&l[i](),this}if(i=t.extend({},t.fn.tipsy.defaults,i),i.live||this.each(function(){s(this)}),"manual"!=i.trigger){var a=i.live?"live":"bind",f="hover"==i.trigger?"mouseenter":"focus",h="hover"==i.trigger?"mouseleave":"blur";this[a](f,o)[a](h,n)}return this},t.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,gravity:"n",html:!1,live:!1,offset:0,opacity:1,title:"title",trigger:"hover"},t.fn.tipsy.elementOptions=function(i,e){return t.metadata?t.extend({},e,t(i).metadata()):e},t.fn.tipsy.autoNS=function(){return t(this).offset().top>t(document).scrollTop()+t(window).height()/2?"s":"n"},t.fn.tipsy.autoWE=function(){return t(this).offset().left>t(document).scrollLeft()+t(window).width()/2?"e":"w"},t.fn.tipsy.autoBounds=function(i,e){return function(){var s={ns:e[0],ew:e.length>1?e[1]:!1},o=t(document).scrollTop()+i,n=t(document).scrollLeft()+i,l=t(this);return l.offset().top<o&&(s.ns="n"),l.offset().left<n&&(s.ew="w"),t(window).width()+t(document).scrollLeft()-l.offset().left<i&&(s.ew="e"),t(window).height()+t(document).scrollTop()-l.offset().top<i&&(s.ns="s"),s.ns+(s.ew?s.ew:"")}}}(jQuery); 11 12/*! 13 * imagesLoaded PACKAGED v4.1.0 14 * JavaScript is all like "You images are done yet or what?" 15 * MIT License 16 */ 17!function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}(this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||[];return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}(window,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){var e=[];
17if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e}function o(t,e,r){return this instanceof o?("string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=n(t),this.options=i({},this.options),"function"==typeof e?r=e:i(this.options,e),r&&this.on("always",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(function(){this.check()}.bind(this))):new o(t,e,r)}function r(t){this.img=t}function s(t,e){this.url=t,this.element=e,this.img=new Image}var h=t.jQuery,a=t.console;o.prototype=Object.create(e.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),this.options.background===!0&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&d[e]){for(var i=t.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=t.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var d={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(t){var e=getComputedStyle(t);if(e)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(e.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,t),n=i.exec(e.backgroundImage)}},o.prototype.addImage=function(t){var e=new r(t);this.images.push(e)},o.prototype.addBackground=function(t,e){var i=new s(t,e);this.images.push(i)},o.prototype.check=function(){function t(t,i,n){setTimeout(function(){e.progress(t,i,n)})}var e=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(e){e.once("progress",t),e.check()}):void this.complete()},o.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log("progress: "+i,t,e)},o.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){var e=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[e](this)}},r.prototype=Object.create(e.prototype),r.prototype.check=function(){var t=this.getIsImageComplete();return t?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},r.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.img,e])},r.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},r.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var t=this.getIsImageComplete();t&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},s.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},o.makeJQueryPlugin=function(e){e=e||t.jQuery,e&&(h=e,h.fn.imagesLoaded=function(t,e){var i=new o(this,t,e);return i.jqDeferred.promise(h(this))})},o.makeJQueryPlugin(),o}); 18 19/*! 20 autosize 4.0.2 21 license: MIT 22 http://www.jacklmoore.com/autosize 23*/ 24!function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);
24else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,function(e,t){"use strict";var n,o,p="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return-1<n.indexOf(e)},get:function(e){return o[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),o.push(t))},del:function(e){var t=n.indexOf(e);-1<t&&(n.splice(t,1),o.splice(t,1))}}),c=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){c=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function r(r){if(r&&r.nodeName&&"TEXTAREA"===r.nodeName&&!p.has(r)){var e,n=null,o=null,i=null,d=function(){r.clientWidth!==o&&a()},l=function(t){window.removeEventListener("resize",d,!1),r.removeEventListener("input",a,!1),r.removeEventListener("keyup",a,!1),r.removeEventListener("autosize:destroy",l,!1),r.removeEventListener("autosize:update",a,!1),Object.keys(t).forEach(function(e){r.style[e]=t[e]}),p.del(r)}.bind(r,{height:r.style.height,resize:r.style.resize,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",l,!1),"onpropertychange"in r&&"oninput"in r&&r.addEventListener("keyup",a,!1),window.addEventListener("resize",d,!1),r.addEventListener("input",a,!1),r.addEventListener("autosize:update",a,!1),r.style.overflowX="hidden",r.style.wordWrap="break-word",p.set(r,{destroy:l,update:a}),"vertical"===(e=window.getComputedStyle(r,null)).resize?r.style.resize="none":"both"===e.resize&&(r.style.resize="horizontal"),n="content-box"===e.boxSizing?-(parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)):parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth),isNaN(n)&&(n=0),a()}function s(e){var t=r.style.width;r.style.width="0px",r.offsetWidth,r.style.width=t,r.style.overflowY=e}function u(){if(0!==r.scrollHeight){var e=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(r),t=document.documentElement&&document.documentElement.scrollTop;r.style.height="",r.style.height=r.scrollHeight+n+"px",o=r.clientWidth,e.forEach(function(e){e.node.scrollTop=e.scrollTop}),t&&(document.documentElement.scrollTop=t)}}function a(){u();var e=Math.round(parseFloat(r.style.height)),t=window.getComputedStyle(r,null),n="content-box"===t.boxSizing?Math.round(parseFloat(t.height)):r.offsetHeight;if(n<e?"hidden"===t.overflowY&&(s("scroll"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight):"hidden"!==t.overflowY&&(s("hidden"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight),i!==n){i=n;var o=c("autosize:resized");try{r.dispatchEvent(o)}catch(e){}}}}function i(e){var t=p.get(e);t&&t.destroy()}function d(e){var t=p.get(e);t&&t.update()}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((l=function(e){return e}).destroy=function(e){return e},l.update=function(e){return e}):((l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return r(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],d),e}),t.default=l,e.exports=t.default}); 25 26/* 27 * [js-sha1]{@link https://github.com/emn178/js-sha1} 28 * 29 * @version 0.6.0 30 * @author Chen, Yi-Cyuan [[email protected]] 31 * @copyright Chen, Yi-Cyuan 2014-2017 32 * @license MIT 33 */ 34!function(){"use strict";function t(t){t?(f[0]=f[16]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=f[8]=f[9]=f[10]=f[11]=f[12]=f[13]=f[14]=f[15]=0,this.blocks=f):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var h="object"==typeof window?window:{},s=!h.JS_SHA1_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;s&&(h=global);var i=!h.JS_SHA1_NO_COMMON_JS&&"object"==typeof module&&module.exports,e="function"==typeof define&&define.amd,r="0123456789abcdef".split(""),o=[-2147483648,8388608,32768,128],n=[24,16,8,0],a=["hex","array","digest","arrayBuffer"],f=[],u=function(h){return function(s){return new t(!0).update(s)[h]()}},c=function(){var h=u("hex");s&&(h=p(h)),h.create=function(){return new t},h.update=function(t){return h.create().update(t)};for(var i=0;i<a.length;++i){var e=a[i];h[e]=u(e)}return h},p=function(t){var h=eval("require('crypto')"),s=eval("require('buffer').Buffer"),i=function(i){if("string"==typeof i)return h.createHash("sha1").update(i,"utf8").digest("hex");
vendor: 4,414 bytes, line 34
34if(i.constructor===ArrayBuffer)i=new Uint8Array(i);else if(void 0===i.length)return t(i);return h.createHash("sha1").update(new s(i)).digest("hex")};return i};t.prototype.update=function(t){if(!this.finalized){var s="string"!=typeof t;s&&t.constructor===h.ArrayBuffer&&(t=new Uint8Array(t));for(var i,e,r=0,o=t.length||0,a=this.blocks;r<o;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),s)for(e=this.start;r<o&&e<64;++r)a[e>>2]|=t[r]<<n[3&e++];else for(e=this.start;r<o&&e<64;++r)(i=t.charCodeAt(r))<128?a[e>>2]|=i<<n[3&e++]:i<2048?(a[e>>2]|=(192|i>>6)<<n[3&e++],a[e>>2]|=(128|63&i)<<n[3&e++]):i<55296||i>=57344?(a[e>>2]|=(224|i>>12)<<n[3&e++],a[e>>2]|=(128|i>>6&63)<<n[3&e++],a[e>>2]|=(128|63&i)<<n[3&e++]):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++r)),a[e>>2]|=(240|i>>18)<<n[3&e++],a[e>>2]|=(128|i>>12&63)<<n[3&e++],a[e>>2]|=(128|i>>6&63)<<n[3&e++],a[e>>2]|=(128|63&i)<<n[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,e>=64?(this.block=a[16],this.start=e-64,this.hash(),this.hashed=!0):this.start=e}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,h=this.lastByteIndex;t[16]=this.block,t[h>>2]|=o[3&h],this.block=t[16],h>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},t.prototype.hash=function(){var t,h,s=this.h0,i=this.h1,e=this.h2,r=this.h3,o=this.h4,n=this.blocks;for(t=16;t<80;++t)h=n[t-3]^n[t-8]^n[t-14]^n[t-16],n[t]=h<<1|h>>>31;for(t=0;t<20;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i&e|~i&r)+o+1518500249+n[t]<<0)<<5|o>>>27)+(s&(i=i<<30|i>>>2)|~s&e)+r+1518500249+n[t+1]<<0)<<5|r>>>27)+(o&(s=s<<30|s>>>2)|~o&i)+e+1518500249+n[t+2]<<0)<<5|e>>>27)+(r&(o=o<<30|o>>>2)|~r&s)+i+1518500249+n[t+3]<<0)<<5|i>>>27)+(e&(r=r<<30|r>>>2)|~e&o)+s+1518500249+n[t+4]<<0,e=e<<30|e>>>2;for(;t<40;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i^e^r)+o+1859775393+n[t]<<0)<<5|o>>>27)+(s^(i=i<<30|i>>>2)^e)+r+1859775393+n[t+1]<<0)<<5|r>>>27)+(o^(s=s<<30|s>>>2)^i)+e+1859775393+n[t+2]<<0)<<5|e>>>27)+(r^(o=o<<30|o>>>2)^s)+i+1859775393+n[t+3]<<0)<<5|i>>>27)+(e^(r=r<<30|r>>>2)^o)+s+1859775393+n[t+4]<<0,e=e<<30|e>>>2;for(;t<60;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i&e|i&r|e&r)+o-1894007588+n[t]<<0)<<5|o>>>27)+(s&(i=i<<30|i>>>2)|s&e|i&e)+r-1894007588+n[t+1]<<0)<<5|r>>>27)+(o&(s=s<<30|s>>>2)|o&i|s&i)+e-1894007588+n[t+2]<<0)<<5|e>>>27)+(r&(o=o<<30|o>>>2)|r&s|o&s)+i-1894007588+n[t+3]<<0)<<5|i>>>27)+(e&(r=r<<30|r>>>2)|e&o|r&o)+s-1894007588+n[t+4]<<0,e=e<<30|e>>>2;for(;t<80;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i^e^r)+o-899497514+n[t]<<0)<<5|o>>>27)+(s^(i=i<<30|i>>>2)^e)+r-899497514+n[t+1]<<0)<<5|r>>>27)+(o^(s=s<<30|s>>>2)^i)+e-899497514+n[t+2]<<0)<<5|e>>>27)+(r^(o=o<<30|o>>>2)^s)+i-899497514+n[t+3]<<0)<<5|i>>>27)+(e^(r=r<<30|r>>>2)^o)+s-899497514+n[t+4]<<0,e=e<<30|e>>>2;this.h0=this.h0+s<<0,this.h1=this.h1+i<<0,this.h2=this.h2+e<<0,this.h3=this.h3+r<<0,this.h4=this.h4+o<<0},t.prototype.hex=function(){this.finalize();var t=this.h0,h=this.h1,s=this.h2,i=this.h3,e=this.h4;return r[t>>28&15]+r[t>>24&15]+r[t>>20&15]+r[t>>16&15]+r[t>>12&15]+r[t>>8&15]+r[t>>4&15]+r[15&t]+r[h>>28&15]+r[h>>24&15]+r[h>>20&15]+r[h>>16&15]+r[h>>12&15]+r[h>>8&15]+r[h>>4&15]+r[15&h]+r[s>>28&15]+r[s>>24&15]+r[s>>20&15]+r[s>>16&15]+r[s>>12&15]+r[s>>8&15]+r[s>>4&15]+r[15&s]+r[i>>28&15]+r[i>>24&15]+r[i>>20&15]+r[i>>16&15]+r[i>>12&15]+r[i>>8&15]+r[i>>4&15]+r[15&i]+r[e>>28&15]+r[e>>24&15]+r[e>>20&15]+r[e>>16&15]+r[e>>12&15]+r[e>>8&15]+r[e>>4&15]+r[15&e]},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var t=this.h0,h=this.h1,s=this.h2,i=this.h3,e=this.h4;return[t>>24&255,t>>16&255,t>>8&255,255&t,h>>24&255,h>>16&255,h>>8&255,255&h,s>>24&255,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,e>>24&255,e>>16&255,e>>8&255,255&e]},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(20),h=new DataView(t);return h.setUint32(0,this.h0),h.setUint32(4,this.h1),h.setUint32(8,this.h2),h.setUint32(12,this.h3),h.setUint32(16,this.h4),t};var y=c();i?module.exports=y:(h.sha1=y,e&&define(function(){return y}
34))}(); 35 36CKEDITOR_BASEPATH = '/global/pics/js/ckeditor/'; 37 38/* ===============================================hover intent ====================================== */ 39 40/*! 41 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+ 42 * http://cherne.net/brian/resources/jquery.hoverIntent.html 43 * 44 * You may use hoverIntent under the terms of the MIT license. 45 * Copyright 2007, 2013 Brian Cherne 46 * 47 * sluzi na otvaranie edubarmenu - aby sa neotvaral, len ked naozaj na nom sme 48 */ 49(function(e){e.fn.hoverIntent=function(t,n,r){var i={interval:100,sensitivity:7,timeout:0};if(typeof t==="object"){i=e.extend(i,t)}else if(e.isFunction(n)){i=e.extend(i,{over:t,out:n,selector:r})}else{i=e.extend(i,{over:t,out:t,selector:n})}var s,o,u,a;var f=function(e){s=e.pageX;o=e.pageY};var l=function(t,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if(Math.abs(u-s)+Math.abs(a-o)<i.sensitivity){e(n).off("mousemove.hoverIntent",f);n.hoverIntent_s=1;return i.over.apply(n,[t])}else{u=s;a=o;n.hoverIntent_t=setTimeout(function(){l(t,n)},i.interval)}};var c=function(e,t){t.hoverIntent_t=clearTimeout(t.hoverIntent_t);t.hoverIntent_s=0;return i.out.apply(t,[e])};var h=function(t){var n=jQuery.extend({},t);var r=this;if(r.hoverIntent_t){r.hoverIntent_t=clearTimeout(r.hoverIntent_t)}if(t.type=="mouseenter"){u=n.pageX;a=n.pageY;e(r).on("mousemove.hoverIntent",f);if(r.hoverIntent_s!=1){r.hoverIntent_t=setTimeout(function(){l(n,r)},i.interval)}}else{e(r).off("mousemove.hoverIntent",f);if(r.hoverIntent_s==1){r.hoverIntent_t=setTimeout(function(){c(n,r)},i.timeout)}}};return this.on({"mouseenter.hoverIntent":h,"mouseleave.hoverIntent":h},i.selector)}})(jQuery) 50 51try { 52 if (parent && parent.barPagePreview) { 53 54 $j('html').toggleClass('edubarHidden',true); 55 } 56} catch (e) { 57 58} 59/* =======================================stranka/patche=======================================*/ 60$j.fn.keypressToClick = function(options) { 61 62 this.each(function() { 63 $(this).attr('tabindex','0'); 64 if ((this.tagName == 'A' || this.tagName == 'DIV'|| this.tagName == 'LI' || this.tagName == 'SPAN') && !$(this).attr('role')) { 65 $(this).attr('role','button'); 66 } 67 $(this).off('keypress.keypressToClick').on('keypress.keypressToClick',function(e) { 68 if (e.which == 32) e.preventDefault(); 69 if (e.which == 32 || e.which == 13) { 70 e.preventDefault(); 71 e.stopImmediatePropagation(); 72 var e0 = jQuery.Event( options && options.eventType ? options.eventType : "click" ); 73 e0.target = e.target; 74 e0.currentTarget = e.currentTarget; 75 e0.originalEvent = e.originalEvent; 76 $(e.currentTarget).trigger(e0); 77 78 } 79 }) 80 }); 81}; 82 83$j(document).ready(function(){ 84 85 setTimeout('barFixYuiDialogs()',1000); 86 barRefreshPage(); 87 88 $j(window).one('load.edubar',function() { 89 barInitPage(); 90 }); 91 $j(window).off('resize.edubar'); 92 $j(window).on('resize.edubar',function() { 93 barWndResize(); 94 }); 95 96 97 var pageWillReload = false; 98 var ajaxErrorDlg = null; 99 $j(window).off('beforeunload.edubar'); 100 $j(window).on('beforeunload.edubar', function() { 101 pageWillReload = true; 102 }); 103 $j(document).ajaxError(function(event, jqxhr, settings, exception) { 104 $('.loadingDiv').hide(); 105 if (exception == 'abort') return; 106 if (pageWillReload) { 107 return; 108 } 109 110 if (jqxhr.isErrorHandled) { 111 return; 112 } 113 114 barShowAjaxErrorDlg(exception.message || exception); 115 }); 116 if ($j.datepicker) { 117 $j.datepicker.setDefaults({ 118 defaultDate: new Date(), 119 dateFormat: 'dd.mm.yy', 120 monthNames: [ls(1711),ls(1712),ls(1713),ls(1714),ls(1715),ls(1716),ls(1717),ls(1718),ls(1719),ls(1720),ls(1721),ls(1722)], 121 dayNames: [ls(1709),ls(1703),ls(1704),ls(1705),ls(1706),ls(1707),ls(1708)], 122 firstDay: 1, 123 dayNamesMin: [ls(1709).substr(0,2),ls(1703).substr(0,2),ls(1704).substr(0,2),ls(1705).substr(0,2),ls(1706).substr(0,2),ls(170
1237).substr(0,2),ls(1708).substr(0,2)] 124 }); 125 } 126}); 127 128function barShowAjaxErrorDlg(msg) { 129 if (window.ajaxErrorDlg) { 130 window.ajaxErrorDlg.find('.exceptions').append('<div>'+et(msg)+'</div>'); 131 return; 132 } 133 134 var s = ''; 135 136 s += '<div style="text-align:center">'; 137 s += '<div style="font-size:32px;opacity:0.5;"><i class="fa fa-fw fa-warning"></i></div>'; 138 s += '<div style="margin:16px 0">'+et(ls(3470))+'</div>'; 139 140 s += '<div class="exceptions">'; 141 s += '<div>'+et(msg)+'</div>'; 142 s += '</div>'; 143 s += '</div>'; 144 s += '<div style="text-align:center;margin-top:10px;clear:both;">'; 145 s += '<input type="button" class="button-green closeBtn" value="'+et(ls(1573))+'" onclick="barCloseDialog(this)">'; 146 s += '</div>'; 147 148 window.ajaxErrorDlg = barNewDialog({ 149 'title': et(ls(2315)), 150 'content': s, 151 'width': 350, 152 'close': function() { 153 window.ajaxErrorDlg = null; 154 } 155 }); 156} 157 158/*** 159 * Patch for dialog focus trap vs. widgets rendered outside the dialog. 160 * - CKEditor (ticket #4727): http://dev.jqueryui.com/ticket/4727 161 * - ASC combo/context menu (.asc.dropDown): since menus attach to document.body, 162 * dialog must allow focus there so letter-jump keyboard search keeps working. 163 */ 164if ($j.ui && $j.widget) { 165 $j.widget("ui.dialog", $j.ui.dialog, { 166 _allowInteraction: function( event ) { 167 168 var $t = $j( event.target ); 169 var ret = !!$t.closest( ".cke_dialog_body" ).length || !!$t.closest( ".cke_skin_office2003" ).length || !!$t.closest( ".cke" ).length || !!$t.closest( ".asc.dropDown" ).length || this._super( event ); 170 return ret; 171 } 172 }); 173 $j.widget("ui.dialog", $j.ui.dialog, { 174 _moveToTop: function (event, silent) 175 { 176 177 if (!event || !this.options.modal) 178 { 179 this._super(event, silent); 180 } 181 } 182 }); 183} 184 185$j.fn.selectText = function() { 186 var range, selection; 187 return this.each(function() { 188 if (document.body.createTextRange) { 189 range = document.body.createTextRange(); 190 range.moveToElementText(this); 191 range.select(); 192 } else if (window.getSelection) { 193 selection = window.getSelection(); 194 range = document.createRange(); 195 range.selectNodeContents(this); 196 selection.removeAllRanges(); 197 selection.addRange(range); 198 } 199 }); 200}; 201 202if ( typeof MobileAppData == 'undefined' && !window.AscMobileAppVersion) {//true) { 203 $j.origPost = $j.post; 204 205 var maxEqav = 7; 206 window.maxEqav = maxEqav; 207 $j.post = function(url, data, success, dataType, eqav) { 208 209 if (!eqav) { 210 eqav = 1; 211 } 212 213 var url0 = url; 214 var data0 = data; 215 var success0 = success; 216 var dataType0 = dataType; 217 218 url += (url.indexOf('?') >= 0 ? '&' : '?')+'eqav='+eqav+'&maxEqav='+maxEqav 219 220 221 var ret; 222 223 var wrongData = false; 224 var doneFunc0 = []; 225 var failFunc0 = []; 226 var alwaysFunc0 = []; 227 228 if (eqav == maxEqav) { 229 return $j.origPost(url, data, success, dataType); 230 } else { 231 var useEncryption = !MobileAppBridge.isActive();//true; 232 var useZip = eqav % 2 == 1;//true; 233 234 235 var cs = ''; 236 if (typeof data == "function") { 237 cs = ''; 238 success = data; 239 } else 240 if (typeof data == 'string') { 241 cs = data; 242 } else { 243 cs = $.param(data); 244 } 245 246 var cs0 = ''; 247 if (useZip) { 248 try { 249 var encoder = new TextEncoder() 250 var gz = new Zlib.RawDeflate(encoder.encode(cs)); 251 var compressed = gz.compress(); 252 var cs1 = ''; 253 254 for (var i=0;i<compressed.length;i += 10000) { 255 cs1 += String.fromCharCode.apply(null, compressed.subarray(i, i+10000)); 256 } 257 cs0 = 'dz:'+btoa(cs1); 258 } catch (e) { 259 cs0 = Base64.encode(cs,true); 260 } 261 262 } else { 263 cs0 = Base64.encode(cs,true); 264 } 265 266 var obj = { 267 eqap: cs0, 268 eqacs: sha1(cs0), 269 eqaz: useEncryption ? '1' : '0', 270 } 271 272 273 ret = $j.ajax({ 274 type: "POST", 275 url: url, 276 data: obj, 277 success: function(data, textStatus, jqXHR) { 278 if (!wrongData && success) { 279 success(data, textStatus, jqXHR); 280 } 281 }, 282 dataType: dataType, 283 //timeout: 5000, 284 dataFilter: function(data, type) { 285 if (data.substr(0,5) == 'eqwd:') { 286 data = data.substr(5); 287 wrongData = true; 288 } 289 if (!useEncryption) return data; 290 if (data.substr(0,4) != 'eqz:') return data; 291 return Base64.decode(data.substr(4), true);// false); 292 }, 293 complete: function(jqXHR, status) { 294 if (wrongData) { 295 296 eqav++; 297 var ret2 = $j.post(url0, data0, success0, dataType0, eqav); 298 ret2.always(function(p1, p2, p3) { 299 executeFuncs(alwaysFunc0, p1, p2, p3); 300 });
301 ret2.fail(function(p1, p2, p3) { 302 executeFuncs(failFunc0, p1, p2, p3); 303 304 }); 305 ret2.done(function(p1, p2, p3) { 306 executeFuncs(doneFunc0, p1, p2, p3); 307 }); 308 309 barShowMessage(lset(9555)+'<div><u>'+lset(1553)+'</u></div>', 30000, 'connectionError', function() { 310 311 barNewDialog({ 312 'source': '/customize/helpus.php?cmd=HelpusHelpDialog&helpid=3117' 313 }); 314 }); 315 } 316 }/*, 317 error: function(jqXHR, status) { 318 if (status == 'timeout') { 319 jqXHR.isErrorHandled = true; 320 321 eqav++; 322 var ret2 = $j.post(url0, data0, success0, dataType0, eqav); 323 ret2.always(function(p1, p2, p3) { 324 executeFuncs(alwaysFunc0, p1, p2, p3); 325 }); 326 ret2.fail(function(p1, p2, p3) { 327 executeFuncs(failFunc0, p1, p2, p3); 328 329 }); 330 ret2.done(function(p1, p2, p3) { 331 executeFuncs(doneFunc0, p1, p2, p3); 332 }); 333 } 334 }*/ 335 }); 336 } 337 338 ret.always0 = ret.always; 339 ret.fail0 = ret.fail; 340 ret.done0 = ret.done; 341 342 343 ret.done = function(doneFunc){ 344 345 doneFunc0.push(doneFunc); 346 return ret.done0(function(p1, p2, p3) { 347 if (!wrongData) { 348 if (doneFunc) doneFunc(p1, p2, p3); 349 } 350 }); 351 352 } 353 354 ret.fail = function(failFunc) { 355 356 failFunc0.push(failFunc); 357 return ret.fail0(function(p1, p2, p3) { 358 if (!wrongData) { 359 if (failFunc) failFunc(p1, p2, p3); 360 } 361 }); 362 363 } 364 365 ret.always = function(alwaysFunc) { 366 367 alwaysFunc0.push(alwaysFunc); 368 return ret.always0(function(p1, p2, p3) { 369 if (!wrongData) { 370 //executeFuncs(alwaysFunc0, p1, p2, p3); 371 if (alwaysFunc) alwaysFunc(p1, p2, p3); 372 //return; 373 } 374 }); 375 } 376 377 378 function executeFuncs(funcs, p1, p2, p3) { 379 for (var i=0;i<funcs.length;i++) { 380 if (funcs[i]) { 381 funcs[i](p1, p2, p3); 382 } 383 } 384 } 385 386 return ret; 387 //return $j.origPost(url, obj, success, dataType); 388 } 389} 390 391function barFixYuiDialogs() { 392 $j('.yui-dialog').each(function() { 393 if ($j(this).css('z-index')<100) { 394 $j(this).css('z-index',$j(this).css('z-index')*1+100); 395 } 396 }); 397 /*setTimeout('barFixYuiDialogs()',1000);*/ 398} 399 400function barHideAllDropDowns() { 401 if (typeof ASC != 'undefined' && ASC.hidePopups) { 402 ASC.hidePopups(); 403 } else { 404 $j('.dropDown').fadeOut(150).trigger('closed'); 405 $j('.dropDownBtn').not('.asc').children('a').removeClass('icon-button-active'); 406 $j('.dropDownBtn').not('.asc').removeClass('btnSelected'); 407 } 408} 409 410function barRefreshPage(elem0) { 411 elem = elem0; 412 if (!elem) elem = $j('body'); 413 $j('.tipsy').remove(); 414 elem.find('.tips').tipsy({gravity: 's',html: true, delayIn: 200}); 415 elem.find('.tips-fade').tipsy({gravity: 's',html: true, delayIn: 500, fade: false}); 416 elem.find('.tips-right').tipsy({gravity: 'w',html: true, delayIn: 200}); 417 elem.find('.tips-left').tipsy({gravity: 'e',html: true, delayIn: 200}); 418 elem.find('.tips-bottom').tipsy({gravity: 'n',html: true, delayIn: 200}); 419 elem.find('.tips-se').tipsy({gravity: 'se',html: true, delayIn: 500}); 420 421 elem.find('.tipsy').css('position','fixed'); 422 /* 423 $j(document).off('click.dropDown'); 424 $j(document).on('click.dropDown', 425 function(event) { 426 427 if ($j(event.target).closest('.dropDownBtn').length==0 && $j(event.target).closest('.dropDown').length==0) { 428 barHideAllDropDowns(); 429 } 430 } 431 );*/ 432 433 434 elem.find('.dropDownBtn').off('click.dropDownBtn'); 435 436 elem.find('.dropDownBtn').attr('tabindex','0').on('click.dropDownBtn', function(event) { 437 if ($j(this).hasClass('disabled')) return; 438 var pos = false; 439 var dropDown = $j(this).children('.dropDown'); 440 if (this.dataDropDown) { 441 // dropDown = this.dataDropDown; 442 } else { 443 pos = true; 444 } 445 this.dataDropDown = dropDown; 446 var that = this; 447 if ($j(this).children('.dropDown').length > 0 448 && !$j(this).children('.dropDown').is(':visible') && !$j(this).children('a').hasClass('button-disabled')) { 449 $j('.dropDown').fadeOut(150).trigger('closed'); 450 $j('.dropDownBtn').removeClass('btnSelected'); 451 if (dropDown.css('position') == 'fixed') { 452 var pos = $j(that).offset(); 453 if (!dropDown.data('positioned') 454 || dropDown.data('oldpos').top != pos.top 455 || dropDown.data('oldpos').left != pos.left) { 456 457 var apos = {top: $j(window).scrollTop(),left: $j(window).scrollLeft()}; 458 dropDown.css('top',(pos.top+$j(that).outerHeight()-apos.top)+'px'); 459 dropDown.css('left',(pos.left-apos.left)+'px'); 460 461 dropDown.data('positioned',true); 462 dropDown.data('oldpos',pos); 463 } 464 } 465 dropDown.fadeIn(150,function() { 466 $j(this).scrollTop(0); 467 468 if (dropDown.width()+dropDown.offset().left > $j(document).width()) { 469 dropDown.css('left',($j(document).width() - dropDown.width() - dropDown.offset().left)+'px'); 470 } 471 if (dropDown.css('overflow-y') == 'auto' && (dropDown.css('max-height') == 'none' || dropDown.data('autoheight'))) { 472 var h = Math.max(200,$j(window).height() - (dropDown.offset().top - $j(window).scrollTop())-15); 473 dropDown.css('max-height', h+'px'); 474 dropDown.data('autoheight',true); 475 } 476 var pos = $j(this).find('.dropDownPanel li.marked').position(); 477 if (pos && pos.top) { 478 $j(this).scrollTop(Math.max(0,pos.top-($j(this).height()/2))); 479 } 480 }); 481 $j(this).addClass('btnSelected'); 482 $j(this).trigger('dropDownOpened',{}); 483 if (typeof YAHOO != 'undefined' && YAHOO) 484 event.stopPropagation(); 485 } else if ($j(this).children('.dropDown').length > 0 486 && $j(event.target).closest('.dropDown').length==0) { 487 $j('.dropDown').fadeOut(150).trigger('closed');; 488 $j('.dropDownBtn').removeClass('btnSelected'); 489 $j(this).trigger('dropDownClosed',{}); 490 } 491 }).off('keypress.dropdownbtn').on('keypress.dropdownbtn', function(e) { 492 if (e.which == 32) e.preventDefault(); 493 if (e.which == 32 || e.which == 13) { 494 $(e.target).click(); 495 } 496 }); 497 elem.find('.ui-dialog-content form input[type="text"]').off('keydown.preventEnter'); 498 elem.find('.ui-dialog-content form input[type="text"]').on('keydown.preventEnter',function(e) { 499 if (e.which == 13) e.preventDefault(); 500 return e.which !== 13; 501 }); 502 elem.find(".simple-tips .close").off('click.simpletips'); 503 elem.find(".simple-tips .close").on('click.simpletips',function(){ 504 elem.find(".simple-tips").slideToggle(); 505 });
506 507 if (edubar && edubar.initSmartLinks) { 508 edubar.initSmartLinks(elem0 ? elem : $j('#bar_mainDiv')); 509 } 510 511 if (edubar && edubar.initFixedRightPos) { 512 edubar.initFixedRightPos(); 513 } 514 515 elem.find('a.messageDangerousUrl').off('click.messageDangerousUrl').on('click.messageDangerousUrl',function(e) { 516 517 var url = $(e.target).attr('href') || ""; 518 if (url.match(/^https?:\/\/help.edupage.org\/.*$/)) { 519 return; 520 } 521 522 if (url.match(/^(https?:\/\/)?www.link.asc.sk\/.*$/)) { 523 return; 524 } 525 if (url.match(new RegExp('^(https?:\/\/)?'+EdubarUtils.getEdupage()+'.edupage.org\/.*$'))) { 526 return; 527 } 528 529 e.preventDefault(); 530 barShowMessageBox(ls(12035),'fa-warning',{ 531 confirm: function() { 532 try { 533 if (!window.open(url, '_blank')) { 534 location.href = url; 535 } 536 } catch (e) { 537 538 } 539 } 540 }); 541 }); 542} 543 544function barWndSize() { 545 var bh = $j('#edubar .edubarHeader').outerHeight(); 546 var bw = $j('#edubar .edubarSidebar').width(); 547 var h = $j(window).height() - (bh ? bh : 0); 548 var w = $j(window).width().w - (bw ? bw: 0); 549 return {width: w, height: h}; 550} 551 552function barWndResize() { 553 var h = Math.floor(barWndSize().height); 554 if (document.getElementById('bar_mainDiv')) { 555 var elem = document.getElementById('bar_mainDiv'); 556 //if ($j(elem).height() < h) { 557 $j(elem).css('min-height',h+'px'); 558 //} 559 } 560 if (document.getElementById('fitheight') != null) { 561 if ($j('#fitheight').height() != h) { 562 $j('#fitheight').css('min-height',h+'px'); 563 } 564 } 565 566 if ($j('#edubar div.edubarHeaderTitle').length > 0) { 567 var w = $j('#edubar .edubarHeaderRight').width(); 568 $j('#edubar div.edubarHeaderTitle').css('right',(w+10)+'px'); 569 } 570} 571 572function wndResize() { 573 barWndResize(); 574} 575 576function wndSize() { 577 return barWndSize(); 578} 579 580function barInitPage() { 581 582 barRefreshPage(); 583 barWndResize(); 584 barHandleHashAction(); 585 $j(window).off('resize.edubar'); 586 $j(window).on('resize.edubar',function() { 587 barWndResize(); 588 }); 589} 590 591function ertl(ltr, rtl) { 592 if (window.rtlMode) { 593 return window.rtlMode == 'rtl' ? rtl : ltr; 594 } 595 596 if (!window.eduRtl) { 597 window.eduRtl = $('body').hasClass('eduRtl') ? 'rtl' : 'ltr'; 598 } 599 if (window.eduRtl == 'rtl') { 600 return rtl; 601 } 602 603 if (edubar && edubar.options.rtl) { 604 return rtl; 605 } 606 607 return ltr; 608} 609 610/* ================================= edubar funkcie ======================================= */ 611 612function barRemoveDomElem(elem, sebaNie, level) { 613 if (!level) level = 0; 614 if (level == 0 && typeof ASC != 'undefined' && ASC && ASC.unmountReactChildren) { 615 ASC.unmountReactChildren($j(elem).get(0)); 616 } 617 var children = $j(elem).children(); 618 for (var i=0;i<children.length;i++) { 619 barRemoveDomElem(children.get(i), false, level+1); 620 } 621 if (!sebaNie) { 622 $j(elem).remove(); 623 624 delete elem; 625 } 626} 627 628var barSrcLoading = {}; 629var barSrcLoading2 = {}; 630var barSrcLoadFuncs = {}; 631var barSrcReadyTriggered = false; 632var barReadyFuncs = null; 633var barReadyHandler = null; 634var barWasReady = false; 635var barJsIsLoading = false; 636var barHoldingReady = false; 637function barJsLibraryIsLoaded(src) { 638 var pom = src.split('?'); 639 var usrc = pom[0]; 640 if (!window.barLoadedJsLibraries) { 641 window.barLoadedJsLibraries = {}; 642 } 643 if (window.barLoadedJsLibraries[src]) return true; 644 if (window.barLoadedJsLibraries[usrc]) return true; 645 return false; 646} 647 648function barInitializeJsLoad() { 649 if (barJsIsLoading) return; 650 651 652 barWasReady = $j.isReady; 653 if (!barHoldingReady) { 654 $j.holdReady(true); 655 barHoldingReady = true; 656 } 657 $j.isReady = false; 658 if (!barReadyFuncs) barReadyFuncs = []; 659 barReadyHandler = jQuery.fn.ready; 660 661 jQuery.fn.ready = function( fn ) { 662 if (!barReadyFuncs) barReadyFuncs = []; 663 barReadyFuncs.push(fn); 664 }; 665 666 barJsIsLoading = true; 667} 668 669function barJsLoadingDone() { 670 if (!barJsIsLoading) return; 671 672 var allDone = true; 673 var allDoneOrError = true; 674 var errors = []; 675 for (var x in barSrcLoading) { 676 if (barSrcLoading[x] != 'done') { 677 allDone = false; 678 } 679 680 if (barSrcLoading[x] != 'done' && barSrcLoading[x] != 'error') { 681 allDoneOrError = false; 682 } 683 if (barSrcLoading[x] == 'error') { 684 errors.push(x); 685 } 686 } 687 if (!allDone) { 688 if (allDoneOrError) { 689 690 barShowAjaxErrorDlg(errors.join('<br>')); 691 } 692 return; 693 } 694 695 $j.isReady = barWasReady; 696 jQuery.fn.ready = barReadyHandler; 697 698 699 barHoldingReady = false; 700 $j.holdReady(false); 701 702 barJsIsLoading = false; 703 704 if ($j.isReady) { 705 if (barReadyFuncs) { 706 for (var i = 0;i<barReadyFuncs.length;i++) { 707 barReadyFuncs[i]($j); 708 } 709 } 710 barReadyFuncs = null; 711 } else { 712 $j(document).ready(function() { 713 if (barReadyFuncs) { 714 for (var i = 0;i<barReadyFuncs.length;i++) { 715 barReadyFuncs[i]($j); 716 } 717 } 718 barReadyFuncs = null; 719 }); 720 } 721} 722 723 724function barRequireJs(srcs, onload) { 725 if (!$j.isArray(srcs)) srcs = [srcs]; 726 var numLoaded = 0; 727 for (var i=0;i<srcs.length;i++) { 728 var src = srcs[i]; 729 730 var pom = src.split('?'); 731 var usrc = pom[0]; 732 733 barJsLibraryLoad(src, function() { 734 numLoaded++; 735 if (numLoaded>=srcs.length) { 736 if (onload) onload(); 737 } 738 }); 739 } 740} 741 742var barYoutubeReadyFunc = []; 743function barLoadYoutubeApi(doneFunc) { 744 745 if (window.isYoutubePlayerReady) { 746 doneFunc(); 747 } else { 748 barJsLibraryLoad('https://www.youtube.com/iframe_api',function() { 749 if (window.isYoutubePlayerReady) { 750 doneFunc(); 751 } else { 752 barYoutubeReadyFunc.push(doneFunc); 753 } 754 }); 755 } 756} 757 758function onYouTubePlayerAPIReady() { 759 window.isYoutubePlayerReady = true; 760 for (var i=0;i<barYoutubeReadyFunc.length;i++) { 761 barYoutubeReadyFunc[i]();
762 } 763 barYoutubeReadyFunc = []; 764} 765 766function barGetAscSrcVer(src) { 767 var srcl = (src || "").toString().toLowerCase(); 768 if (typeof window == 'undefined') return ''; 769 var ver = window.ascSrcVer && window.ascSrcVer[srcl] ? window.ascSrcVer[srcl] : ''; 770 if (ver) return ver; 771 772 srcl = sha1(srcl).substr(0,2); 773 var ver = window.ascSrcVer && window.ascSrcVer[srcl] ? window.ascSrcVer[srcl] : ''; 774 return ver; 775} 776 777function barJsLibraryLoad(src, onload, onalreadyloaded, options) { 778 779 780 var pom = src.split('?'); 781 782 if (pom.length == 1) { 783 var ver = barGetAscSrcVer(src); 784 if (ver) src += '?v=' + ver; 785 } 786 787 var usrc = pom[0]; 788 789 if (!barJsLibraryIsLoaded(src)) { 790 791 792 if (src.toLowerCase() == 'https://www.google.com/jsapi' 793 && (((edubar && edubar.options.school_country == 'cn') 794 || (options && options.school_country == 'cn')))) { 795 796 barCssLoad('/global/pics/js/gjsapi/visualization1.css'); 797 barCssLoad('/global/pics/js/gjsapi/static/modules/gviz/1.0/core/tooltip.css'); 798 src = '/global/pics/js/gjsapi/gvis.min.js?v=7'; 799 } 800 801 $j.ajaxSetup({cache: true}); 802 if (onload) { 803 if (barSrcLoading2[usrc] != 'loading') { 804 barSrcLoading2[usrc] = 'loading'; 805 if (src[0]=='/') { 806 var h = new XMLHttpRequest(); 807 h.open("GET", src); 808 h.setRequestHeader("Accept", "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"); 809 h.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 810 h.onload = function () { 811 if (h.status == '404') { 812 console.log('error loading 404: '+src); 813 //window.barLoadedJsLibraries[usrc] = true; 814 barSrcLoading2[usrc] = 'error'; 815 816 barShowAjaxErrorDlg(src+': 404 not found'); 817 return; 818 } 819 820 var js = h.responseText; 821 js = js.replace("var ASC;", ";"); 822 js += "\n//@ sourceURL=" + src; 823 eval.call(null, js); 824 barSrcLoading2[usrc] = 'done'; 825 window.barLoadedJsLibraries[usrc] = true; 826 onload(); 827 if (barSrcLoadFuncs[usrc]) { 828 829 for (var i=0;i<barSrcLoadFuncs[usrc].length;i++) { 830 barSrcLoadFuncs[usrc][i](); 831 } 832 barSrcLoadFuncs[usrc] = []; 833 } 834 }; 835 h.onerror = function (err) { 836 837 console.log('error loading '+src+';'+err); 838 //window.barLoadedJsLibraries[usrc] = true; 839 barSrcLoading2[usrc] = 'error'; 840 barShowAjaxErrorDlg(usrc+': '+err); 841 842 } 843 h.send(); 844 } else { 845 $j.ajax({ 846 dataType: "script", 847 url: src, 848 success: function() { 849 barSrcLoading2[usrc] = 'done'; 850 window.barLoadedJsLibraries[usrc] = true; 851 onload(); 852 if (barSrcLoadFuncs[usrc]) { 853 854 for (var i=0;i<barSrcLoadFuncs[usrc].length;i++) { 855 barSrcLoadFuncs[usrc][i](); 856 } 857 barSrcLoadFuncs[usrc] = []; 858 } 859 }, 860 error: function(a,b,err) { 861 console.log('error loading '+src+';'+err); 862 //window.barLoadedJsLibraries[usrc] = true; 863 barSrcLoading2[usrc] = 'error'; 864 barShowAjaxErrorDlg(src+': '+err); 865 } 866 }); 867 } 868 } else { 869 870 if (!barSrcLoadFuncs[usrc]) barSrcLoadFuncs[usrc] = []; 871 barSrcLoadFuncs[usrc].push(onload); 872 } 873 } else { 874 if (barSrcLoading[usrc] != 'loading') { 875 barSrcLoading[usrc] = 'loading'; 876 barInitializeJsLoad(); 877 878 if (src[0]=='/') { 879 880 var h = new XMLHttpRequest(); 881 h.open("GET", src); 882 h.onload = function () { 883 if (h.status == '404') { 884 console.log('error loading 404: '+src); 885 //window.barLoadedJsLibraries[usrc] = true; 886 barSrcLoading[usrc] = 'error'; 887 barJsLoadingDone(); 888 return; 889 } 890 var js = h.responseText; 891 js = js.replace("var ASC;", ";"); 892 js += "\n//@ sourceURL=" + src; 893 try { 894 eval.call(null, js); 895 } catch (e) { 896 console.log('error loading: '+src); 897 console.log(e); 898 } 899 window.barLoadedJsLibraries[usrc] = true; 900 barSrcLoading[usrc] = 'done'; 901 barJsLoadingDone(); 902 }; 903 h.onerror = function (err) { 904 905 console.log('error loading '+src+';'+err); 906 //window.barLoadedJsLibraries[usrc] = true; 907 barSrcLoading[usrc] = 'error'; 908 barJsLoadingDone(); 909 } 910 h.send(); 911 } else { 912 $j.ajax({ 913 dataType: "script", 914 url: src, 915 success: function() { 916 window.barLoadedJsLibraries[usrc] = true; 917 barSrcLoading[usrc] = 'done'; 918 barJsLoadingDone(); 919 }, 920 error: function(a,b,err) { 921 922 console.log('error loading '+src+';'+err); 923 //window.barLoadedJsLibraries[usrc] = true; 924 barSrcLoading[usrc] = 'error'; 925 barJsLoadingDone(); 926 } 927 });
928 } 929 } 930 } 931 932 } else { 933 if (onload) { 934 onload(); 935 } 936 if (onalreadyloaded) { 937 onalreadyloaded(); 938 } 939 } 940} 941 942function barCssLoad(src, media, onloadFunc) { 943 if (!media) media = 'all'; 944 var pom = (src || "").toString().split('?'); 945 var usrc = pom[0]; 946 if (!barJsLibraryIsLoaded(src) && !barJsLibraryIsLoaded(usrc)) { 947 $j.ajaxSetup({cache: true}); 948 var isLoaded = false; 949 $j('head').find('link[rel="stylesheet"]').each(function() { 950 var href = $(this).attr('href'); 951 if (href == src || href.split('?')[0] == usrc) { 952 isLoaded = true; 953 return false; 954 } 955 }); 956 if (isLoaded) { 957 window.barLoadedJsLibraries[src] = true; 958 window.barLoadedJsLibraries[usrc] = true; 959 return; 960 } 961 962 barSrcLoading[src] = 'loading'; 963 barInitializeJsLoad(); 964 var elem = jQuery( document.createElement('link') ).attr({ 965 href: src, 966 media: media, 967 type: 'text/css', 968 rel: 'stylesheet' 969 }); 970 971 elem.on('load',function() { 972 barSrcLoading[src] = 'done'; 973 barJsLoadingDone(); 974 if (onloadFunc) onLoadFunc(); 975 }).on('error', function() { 976 barSrcLoading[src] = 'error'; 977 barJsLoadingDone(); 978 }); 979 980 if ($('#appdarkModeCss').length >0) { 981 elem.insertBefore($('#appdarkModeCss')); 982 } else { 983 elem.appendTo('head'); 984 } 985 window.barLoadedJsLibraries[src] = true; 986 window.barLoadedJsLibraries[usrc] = true; 987 } 988} 989 990function barRegisterSmartLeaveFunc(leavefunc) { 991 if (edubar) { 992 edubar.smartLeaveFunc = leavefunc; 993 } 994} 995 996function barRegisterPopstateHandler(elem, func, url, state, autoUnregister) { 997 if (!edubar) return; 998 999 if (!edubar.popStateHandlers) edubar.popStateHandlers = []; 1000 1001 1002 barUnregisterPopstateHandler(elem); 1003 1004 edubar.popStateHandlers.push({ 1005 elem: elem, 1006 func: typeof elem === 'function' && !func ? elem : func, 1007 state: state ? state : window.history.state, 1008 url: url ? url : window.location.href 1009 }); 1010 1011 window.history.pushState(state ? state : window.history.state, '', url ? url : window.location.href); 1012 1013 if (typeof elem === 'function') { 1014 1015 } else if (autoUnregister !== false) { 1016 $j(elem).on('remove.barRegisterPopstateHandler',function() { 1017 barUnregisterPopstateHandler(elem); 1018 }); 1019 } 1020} 1021 1022function barUnregisterPopstateHandler(elem) { 1023 if (!edubar) return; 1024 1025 if (!edubar.popStateHandlers) edubar.popStateHandlers = []; 1026 1027 var pom = []; 1028 for (var i=0;i<edubar.popStateHandlers.length;i++) { 1029 var r = edubar.popStateHandlers[i]; 1030 1031 if (r.elem == elem) continue; 1032 pom.push(r); 1033 } 1034 1035 1036 edubar.popStateHandlers = pom; 1037 1038 if (typeof elem !== 'function') { 1039 $j(elem).off('remove.barRegisterPopstateHandler'); 1040 } 1041} 1042 1043function barGetPreviousSmartLoadState() { 1044 if (!window._edupageSmartLoadStack) return null; 1045 if (window._edupageSmartLoadStack <= 1) return null; 1046 return window._edupageSmartLoadStack[window._edupageSmartLoadStack.length - 2]; 1047} 1048 1049function barSmartLoadPage(src, forceReload, noHideContent, appConfirm, doneFunc) { 1050 if (MobileAppBridge.isV2Active()) { 1051 $(window).trigger("smartLoadPage",[src]); 1052 return; 1053 } 1054 if (MobileAppBridge.isActive() && !noHideContent && !MobileAppBridge.isV2Active()) { 1055 $j('#bar_mainDiv').empty(); 1056 } 1057 if (!edubar) window.location = src; 1058 if (edubar && edubar.options.hasActiveModuleSkin) { 1059 window.location = src; 1060 } else { 1061 if (noHideContent) { 1062 edubar.noHideContent = true; 1063 } 1064 if (noHideContent) { 1065 var st = $(window).scrollTop(); 1066 edubar.smartLoadPage(src, forceReload, forceReload, false, function() { 1067 $(window).scrollTop(st); 1068 if (doneFunc) doneFunc(); 1069 }); 1070 } else { 1071 edubar.smartLoadPage(src, forceReload, forceReload, false, doneFunc); 1072 } 1073 1074 if (MobileAppBridge.isActive() && appConfirm && !MobileAppBridge.isV2Active()) { 1075 1076 window.location = 'https://barsmartloadingpage/'; 1077 } 1078 } 1079 1080} 1081 1082function barSmartEmptyPage() { 1083 $j('#bar_mainDiv').empty(); 1084} 1085 1086function barSmartLoadPageForce(src) { 1087 if (!edubar) window.location = src; 1088 edubar.smartLoadPage(src, false, true); 1089} 1090function barSmartReloadPage(doneFunc) { 1091 if (!edubar) { 1092 document.location.reload(true); 1093 return; 1094 } 1095 if (edubar && edubar.options.hasActiveModuleSkin) { 1096 document.location.reload(true); 1097 return; 1098 } 1099 if (edubar && edubar.smartLoadPage) { 1100 edubar.smartLoadPage(window.location.href, true, true, null, doneFunc); 1101 } 1102 if (MobileAppBridge.isV2Active()) { 1103 $(window).trigger("edupageTablesUpdated", [{}, EdubarUtils.getEdupage(), EdubarUtils.getLoggedUser(), "actionAdded"]); 1104 $(window).trigger("smartReloadPage"); 1105 } 1106} 1107 1108 1109function barSmartLoadScript(src, method) { 1110 if (!edubar) { 1111 src = src + (src.indexOf('?') == -1 ? '?' : '&') + 'barNoSkin=1&barContentOnly=1';
1112 if (!method) method = 'GET'; 1113 $j.ajax({ 1114 type: method, 1115 url: src, 1116 data: {}, 1117 success: function(data) { 1118 $j('body').append('<div class="barSmartLinkDataDiv" style="display:none">'+data+'</div>'); 1119 } 1120 }); 1121 return; 1122 } 1123 edubar.smartLoadScript(src, method); 1124} 1125 1126function barShowSchoolYearSelector() { 1127 $j('#edubarSchoolYear').show(); 1128} 1129 1130function barHideSchoolYearSelector() { 1131 $j('#edubarSchoolYear').hide(); 1132} 1133 1134function barShowMessage(msg, duration, specialClass, clickFunc) { 1135 barShowMessageEx(msg, duration, { 1136 specialClass: specialClass, 1137 clickFunc: clickFunc, 1138 appCloseButton: MobileAppBridge.isV2Active() && specialClass == 'undoMsg' 1139 }); 1140} 1141 1142function barShowMessageEx(msg, duration, options) { 1143 if (!options) options = {}; 1144 if (!duration && duration !== 0) duration = 10000; 1145 var existed = $j('body').children('.barMessageText').length > 0; 1146 $j('body').children('.barMessageText').remove(); 1147 var s = ''; 1148 var left = ''; 1149 var top = ''; 1150 if (options.attachToElem) { 1151 var offset = $j(options.attachToElem).offset(); 1152 left = offset.left+($j(options.attachToElem).outerWidth()/2)+'px'; 1153 top = (offset.top + 3 )+'px'; 1154 1155 if (!options.specialClass) options.specialClass = ''; 1156 options.specialClass += ' barMessageAttached'; 1157 if (options.attachFromBottom) { 1158 top = (offset.top + $j(options.attachToElem).outerHeight() + 3 )+'px'; 1159 options.specialClass += ' barMessageAttachedFromBottom'; 1160 } 1161 } 1162 s += renderS('<div class="barMessageText {specialClass} {withCloseButton}" role="status" aria-atomic="true" style="display:none;left:{left};top: {top};">', { 1163 specialClass: options.specialClass ? options.specialClass : '', 1164 withCloseButton: options.appCloseButton ? 'withCloseButton' :'', 1165 left: left, 1166 top: top 1167 }); 1168 if (options.appCloseButton) { 1169 s += '<div class="barMessageTextCloseButton"><a class="app-link-button inheritColor closeBtn"><i class="material-icons" style="vertical-align:middle">close</i></a></div>'; 1170 } 1171 s += msg; 1172 s += '</div>'; 1173 var elem = $j(s).appendTo($j('body')); 1174 var elemRes = options.noFadeIfExists && existed ? elem.show() : elem.fadeIn('fast'); 1175 if (options.keepOpen) { 1176 1177 } else { 1178 if (duration>0) { 1179 elemRes.delay(duration).fadeOut('fast',function() { 1180 $(window).off('edupageAppViewsChanged.barShowMessageEx'); 1181 $j(this).remove(); 1182 }); 1183 } 1184 1185 $(window).one('edupageAppViewsChanged.barShowMessageEx', function() { 1186 if (!options.keepOnViewChange) { 1187 elem.remove(); 1188 } 1189 }); 1190 elem.on('click',function(e) { 1191 if ($(e.target).closest('.closeBtn').length > 0) return; 1192 if (options.clickFunc) { 1193 var res = options.clickFunc(); 1194 if (res === 'keepOpen') { 1195 return; 1196 } 1197 } 1198 $(window).off('edupageAppViewsChanged.barShowMessageEx'); 1199 $j(this).remove(); 1200 }); 1201 1202 } 1203 1204 elem.find('.closeBtn').on('click',function() { 1205 $(window).off('edupageAppViewsChanged.barShowMessageEx'); 1206 $j(elem).remove(); 1207 }) 1208 1209 return elem; 1210} 1211 1212var barUrlToModule = {}; 1213var edubar = null; 1214if ($j.widget) { 1215$j.widget('edupage.edubar',{ 1216 options: { 1217 edupageUrl: '', 1218 erid: '', 1219 sessionPingInterval:600, 1220 sessionPingUrl: '', 1221 somNaPortali: false, 1222 urlToModule: {}, 1223 chatVisible: false, 1224 loggedUser: '', 1225 lang: '', 1226 hasActiveModuleSkin: false, 1227 syncIntervalMultiplier: 1, 1228 lastSync: '' 1229 }, 1230 menuOpened: null, 1231 defaultHeadHtml: '', 1232 lastLoadedLocation: '', 1233 lastSyncTime: 0, 1234 lastSessionPingTime: 0, 1235 openedChatWindows: {}, 1236 switchAccount: function(edudata) { 1237 window.location = '/login/edupageChange?rid='+encodeURIComponent(edudata); 1238 }, 1239 switchToAdmin: function() { 1240 barNewDialog({ 1241 'source': '/portal/?cmd=SwitchToAdmin' 1242 }); 1243 }, 1244 _create: function() { 1245 var thisObj = this; 1246 edubar = this; 1247 barUrlToModule = this.options.urlToModule; 1248 1249 if (EdubarUtils.getLoggedUser() && $('.edubarSidebar').length>0) { 1250 if (this.options.defNarrow) { 1251 $j('body').toggleClass('edubarSidebarCollapsed', localStorage.getItem('edubarSidebarCollapsed'+sha1(EdubarUtils.getLoggedUser())) !== '0'); 1252 } else { 1253 $j('body').toggleClass('edubarSidebarCollapsed', localStorage.getItem('edubarSidebarCollapsed'+sha1(EdubarUtils.getLoggedUser())) === '1'); 1254 } 1255 } 1256 1257 this.defaultHeadHtml = $j('head').html(); 1258 1259 this.element.find('.edubarFeedbackBtn').on('click',function() { 1260 barNewDialog({source: thisObj.options.edupageUrl+'/znamky/?jwgc=ZnamkyFeedbackDialog'}); 1261 }).keypressToClick(); 1262 1263 this.element.find('.edubarChangeEdurowBtn').on('click',function() { 1264 thisObj.switchAccount($j(this).attr('data-rowid')); 1265 }).keypressToClick();
1266 this.element.find('.switchToAdminBtn').on('click',function() { 1267 thisObj.switchToAdmin(); 1268 }).keypressToClick(); 1269 this.element.find('.edubarChatBtn').on('click',function() { 1270 thisObj.toggleChat(); 1271 }).keypressToClick(); 1272 1273 this.element.find('#edubarBBBtn').on('click',function() { 1274 thisObj.action_openBBPopup(); 1275 }).keypressToClick(); 1276 1277 this.element.find('#edubarAiBtn').on('click',function() { 1278 thisObj.action_openAiPanel(); 1279 }).keypressToClick(); 1280 1281 this.element.find('ul.edubarMenulist.level1').each(function() { 1282 $j(this).width($j(this).children('li').length*70); 1283 }); 1284 1285 this.element.find('ul.edubarMenulist > li').hoverIntent({ 1286 'over': function() { 1287 $j(this).siblings('li').find('ul.edubarMenulist').hide(); 1288 $j(this).children('ul.edubarMenulist').show(); 1289 }, 1290 'out': function() { 1291 $j(this).children('ul.edubarMenulist').hide(); 1292 }, 1293 'timeout': 250 1294 }); 1295 this.element.find('ul.edubarMenulist > li > a').click(function() { 1296 var $li = $j(this).closest('li'); 1297 $li.siblings('li').find('ul.edubarMenulist').hide(); 1298 $li.children('ul.edubarMenulist').show(); 1299 }).keypressToClick(); 1300 1301 this.element.find('.edubarHoverMenu').hover(function() { 1302 if (thisObj.profileBoxTimeout) clearTimeout(thisObj.profileBoxTimeout); 1303 var that = this; 1304 thisObj.profileBoxTimeout = setTimeout(function() { 1305 thisObj.element.find('.edubarHoverMenu').toggleClass('hovered2',false); 1306 $j(that).toggleClass('hovered', true); 1307 thisObj.profileBoxTimeout = null; 1308 },500); 1309 },function() { 1310 if (thisObj.profileBoxTimeout) { 1311 clearTimeout(thisObj.profileBoxTimeout); 1312 } 1313 $j(this).toggleClass('hovered', false); 1314 }).click(function(event) { 1315 if (thisObj.profileBoxTimeout) clearTimeout(thisObj.profileBoxTimeout); 1316 var that = this; 1317 if ($j(event.target).closest('a[href]').length > 0) { 1318 $j(this).toggleClass('hovered2', false); 1319 $j(this).toggleClass('hovered', false); 1320 } else { 1321 $j(this).toggleClass('hovered2', true); 1322 } 1323 1324 if (!thisObj.documentClickEdubarHoverMenuInited) { 1325 $j(document).on('click.edubarHoverMenu',function(event) { 1326 var ce = $j(event.target).closest('.edubarHoverMenu'); 1327 if (ce.length==0 || ce.get(0) != that) { 1328 $j(document).off('click.edubarHoverMenu'); 1329 thisObj.element.find('.edubarHoverMenu').toggleClass('hovered2',false); 1330 thisObj.documentClickEdubarHoverMenuInited = false; 1331 1332 if (ce.length > 0) { 1333 ce.click(); 1334 } 1335 } 1336 }); 1337 thisObj.documentClickEdubarHoverMenuInited = true; 1338 } 1339 }).keypressToClick(); 1340 1341 this.element.find('.edubarHideCalloutBtn').on('click',function() { 1342 $j('#bar_protoUserCallout').fadeOut('fast'); 1343 }); 1344 this.element.find('#edubarNewItemBtn').on('click',function() { 1345 var thisObj = this; 1346 1347 var dialog = barNewDialog({ 1348 title: ls(3278), 1349 source: '/timeline/?cmd=creator', 1350 dialogClass: 'whiteDialog', 1351 height: 518 1352 }); 1353 }).keypressToClick(); 1354 1355 this.element.find('.edubarHideCalloutBtn').on('click',function() { 1356 $j('#bar_protoUserCallout').fadeOut('fast'); 1357 }); 1358 1359 this.element.find('.profilemenu a.switchChildBtn').on('click',function() { 1360 var studentid = $j(this).attr('data-sid'); 1361 $j.get('/login/switchchild?studentid='+studentid, function(data) { 1362 var location = document.location.href; 1363 location = location.replace('&zny=ignore','')+(location.indexOf('?')>=0 ? '&zny=ignore' : ''); 1364 window.location = location; 1365 }); 1366 }).keypressToClick(); 1367 1368 this.element.find('#edubarSchoolYear select').on('change',function() { 1369 thisObj.switchSchoolYear($j(this).val()); 1370 }).each(function() { 1371 thisObj.schoolYearVal = $j(this).val(); 1372 }); 1373 1374 this.hashChange(); 1375 1376 this.initSmartLinks(this.element); 1377 this.initGlobalEvents(); 1378 if (thisObj.options.sessionPingInterval > 0 && !thisObj.options.somNaPortali) { 1379 setTimeout(function() { 1380 thisObj.sessionPing(); 1381 },thisObj.options.sessionPingInterval*1000); 1382 } 1383 this.initCheckTimer(); 1384 1385 if (this.options.syncIntervalMultiplier) { 1386 this.syncIntervalMultiplier = Math.min(5,Math.max(0.5,parseFloat(this.options.syncIntervalMultiplier))); 1387 } 1388 1389 this.lastLoadedLocation = window.location.pathname+window.location.search; 1390 $j(window).on('load',function() { 1391 thisObj.initSmartLinks($j('#bar_mainDiv')); 1392 1393 thisObj.initSyncInterval(); 1394 1395 if (sessionStorage && sessionStorage.getItem('chatOpened') == '1' && !EdubarUtils.isAdmin()) { 1396 thisObj.openChat(); 1397 } 1398 1399 if (sessionStorage && sessionStorage.getItem('bbPanelOpened') == '1' && window.location.href.indexOf('/bb/') == -1) { 1400 thisObj.action_openBBPopup(); 1401 } 1402 1403 if (sessionStorage && sessionStorage.getItem('aipanelOpened') == '1') { 1404 var isTimetableOnline = window.location.pathname.indexOf('/timetable/online.php') >= 0; 1405 if (!isTimetableOnline) {
1406 thisObj.action_openAiPanel(); 1407 } 1408 } 1409 }); 1410 1411 var pom = {}; 1412 for (var x in this.options.urlToModule) { 1413 if (!pom[x]) pom[x] = {}; 1414 for (var url in this.options.urlToModule[x]) { 1415 pom[x][barEncLink(url)] = 1; 1416 } 1417 } 1418 for (var x in pom) { 1419 for (var url in pom[x]) { 1420 this.options.urlToModule[x][url] = 1; 1421 } 1422 } 1423 1424 this.selectModule([window.location.pathname+window.location.search]); 1425 1426 1427 if (this.options.ascspl || this.options.ascspl === false) { 1428 var s = ''; 1429 if (this.options.ascspl) { 1430 s += '<a class="ascSupportLnk" style="">'; 1431 s += '<i class="fa fa-fw fa-'+et(this.options.ascsploff ? '' : 'bell')+'" style="color: #FF5722"></i>'; 1432 s += '</a>'; 1433 } else { 1434 s += '<a class="ascSupportLnk" style="">'; 1435 s += '<i class="fa fa-fw fa-'+et(this.options.ascsploff ? '' : 'bell-o')+'" style="color: #FFEB3B"></i>'; 1436 s += '</a>'; 1437 } 1438 1439 var btn = $j(s).appendTo(this.element.find('.profilemenu')); 1440 btn.on('click',function() { 1441 var location = window.location.href; 1442 var pom = location.split('#'); 1443 location = pom[0]; 1444 location += (location.indexOf('?') != -1 ? '&' : '?')+'extendedSupport='+(thisObj.options.ascspl ? '1' : '0'); 1445 window.location = location; 1446 }); 1447 btn.on('contextmenu', function(e) { 1448 e.preventDefault(); 1449 ASC.requireAsync('/asc/support.js').then(function(m){m.showSwitchSupportUser()}); 1450 }); 1451 1452 s = ''; 1453 s += '<a class="ascSupportOff" style="position: absolute;right:40px;top: 5px;opacity:0.4" title="Turn off is_aSc">'; 1454 s += '<i class="fa fa-fw fa-'+et(this.options.ascsploff ? '' : 'bell-slash-o')+'" style="color: inherit"></i>'; 1455 s += '</a>'; 1456 var btn = $j(s).appendTo(this.element.find('.profilemenu')); 1457 btn.on('click',function() { 1458 var location = window.location.href; 1459 var pom = location.split('#'); 1460 location = pom[0].replace('asc_support_off=1','').replace('asc_support_off=0', ''); 1461 location += (location.indexOf('?') != -1 ? '&' : '?')+'asc_support_off='+(thisObj.options.ascsploff ? '0' : '1'); 1462 window.location = location; 1463 }); 1464 } 1465 1466 1467 if (this.options.ecourseenabled) { 1468 var s = '<div class="edubarSidebarCollapseDiv" title="Collapse menu">'; 1469 s += '<i class="fa fa-angle-'+ertl('left','right')+'"></i>'; 1470 s += '</div>'; 1471 1472 var collapseElem = $j(s).appendTo(this.element.find('.edubarSidebar')); 1473 collapseElem.on('click', function() { 1474 $j('body').toggleClass('edubarSidebarCollapsed'); 1475 var val = $j('body').hasClass('edubarSidebarCollapsed'); 1476 localStorage.setItem('edubarSidebarCollapsed'+sha1(EdubarUtils.getLoggedUser()),val ? '1' : '0'); 1477 $j(window).resize(); 1478 }); 1479 } 1480 1481 $j('#edubarStartButton').click(function() { 1482 thisObj.toggleStartButton(); 1483 }).hover(function() { 1484 $j('#edubarStartContainer').find('.edubarStartNotifier').fadeOut(200, function() { 1485 $(this).remove(); 1486 }).find('.eb-anim-move-left').toggleClass('eb-anim-move-left',false); 1487 }).each(function() { 1488 setTimeout(function() { 1489 $j('#edubarStartContainer').find('.edubarStartNotifier').fadeOut(200, function() { 1490 $(this).remove(); 1491 }).find('.eb-anim-move-left').toggleClass('eb-anim-move-left',false); 1492 }, 8000); 1493 }).keypressToClick(); 1494 1495 if (EdubarUtils.isUcitel()) { 1496 this.initCoursesToolbar(); 1497 } 1498 if (EdubarUtils.isUcitelOrAdmin()) { 1499 this.initSearchBox(); 1500 } 1501 }, 1502 toggleStartButton: function(val, selectTab) { 1503 var self = this; 1504 if (typeof val === 'undefined') { 1505 val = this.startButtonBox && this.startButtonBox.is(':visible') ? false : true; 1506 } 1507 1508 if (!val && !this.startButtonBox) return; 1509 1510 1511 1512 if (!this.startButtonBox) { 1513 this.initStartButtonBox(); 1514 } 1515 1516 $j(document).off('click.edubarStartButton') 1517 if (val) { 1518 $j('#edubarStartContainer').find('.edubarStartNotifier').remove(); 1519 if (selectTab) { 1520 1521 this.startButtonBox.find('.edubarstart-tab-button[data-id="'+et(selectTab)+'"]').click(); 1522 } 1523 this.startButtonBox.css('margin-left','-30px').css('opacity',0).show().animate({ 1524 'margin-left': 0, 1525 'opacity': 1 1526 }, 100, 'swing', function() { 1527 1528 $j(document).on('click.edubarStartButton', function(event) { 1529 if ($j(event.target).closest('.edubarStartButtonBox').length > 0 && $j(event.target).closest('.edubarSmartLink,.qintro-btn').length == 0) { 1530 return; 1531 } 1532 1533 self.toggleStartButton(false); 1534 $j(document).off('click.edubarStartButton') 1535 }); 1536 }); 1537 } else { 1538 this.startButtonBox.animate({ 1539 'margin-left': -30, 1540 'opacity': 0 1541 }, 100, 'swing', function() { 1542 self.startButtonBox.hide(); 1543 }); 1544 } 1545 1546 1547 self.startButtonBox.find('.estart-pageEditBtn').toggle(!!self.options.isEditablePage).find('.estart-editableModuleName').text(self.options.editableModuleName); 1548 self.startButtonBox.find('.estart-cancelEditBtn').toggle(!!self.options.isEditing); 1549 $j('#edubarStartButton').toggleClass('opened',val); 1550 1551 }, 1552 initStartButtonBox: function() { 1553 var self = this; 1554 var s = ''; 1555 s += '<div class="edubarStartButtonBox fixedLeft" style="display:none">'; 1556 s += '<div class="" style="padding: 25px;text-align:center;opacity:0.5;color: #000;position: absolute;top: 50%;left:0;right:0;transform: translateY(-50%);">'; 1557 s += '<i class="fa fa-spinner fa-spin" style="font-size: 64px;color: #aaa"></i>'; 1558 1559 s += '</div>'; 1560 s += '</div>'; 1561 1562 this.startButtonBox = $(s).appendTo('#edubarStartContainer'); 1563 1564 $j.post('/user/?cmd=StartButton&akcia=getContent', {}, function(data) { 1565 self.startButtonBox.html(data); 1566 1567 self.startButtonBox.find('.estart-cancelEditBtn').toggle(!!self.options.isEditing); 1568 self.startButtonBox.find('.estart-pageEditBtn').toggle(!!self.options.isEditablePage).find('.estart-editableModuleName').text(self.options.editableModuleName); 1569 }); 1570 1571 }, 1572 1573 iniCoursesListBox: function() { 1574 var self = this; 1575 var s = ''; 1576 s += '<div style="position: fixed;left:0;right:0;top:0;bottom:0;background-color: rgba(0,0,0,0.2);display:none" class="edubarCourseListBoxOuter">'; 1577 s += '<div class="edubarCourseListBox fixedLeft" >'; 1578 s += '<div class="" style="padding: 25px;text-align:center;opacity:0.5;color: #000;position: absolute;top: 50%;left:0;right:0;transform: translateY(-50%);">'; 1579 s += '<i class="fa fa-spinner fa-spin" style="font-size: 64px;color: #aaa"></i>'; 1580 1581 s += '</div>'; 1582 s += '</div>'; 1583 s += '</div>'; 1584 this.coursesToolbar.find('.edubarCourseListBoxOuter').remove(); 1585 this.coursesListBoxOuter = $(s).appendTo(this.coursesToolbar); 1586 this.coursesListBox = this.coursesListBoxOuter.find('.edubarCourseListBox'); 1587 1588 1589 var meditorMain = $('.etest-meditor-topmain'); 1590 var ed = meditorMain.length > 0 ? meditorMain.attr('data-searcherpohlad') : 'last'; 1591 1592 var postData = {ed: ed, edubar: '1', skipDp: (typeof DailyPlan != 'undefined' && DailyPlan.isCachedDate((new Date()).format('Y-m-d')) ? '1' : '0')} 1593 $j.post('/elearning/?cmd=Standards&akcia=getContent', postData, function(data) { 1594 self.coursesListBox.html(data); 1595 }); 1596 }, 1597 toggleCoursesListBox: function(val) { 1598 1599 var self = this; 1600 if (typeof val === 'undefined') { 1601 val = this.coursesListBox && this.coursesListBox.is(':visible') ? false : true; 1602 } 1603 1604 if (!val && !this.coursesListBox) return; 1605 1606 if (!this.coursesListBox) { 1607 this.iniCoursesListBox(); 1608 } 1609 1610 //$j(document).off('click.edubarStartButton') 1611 if (val) { 1612 this.coursesListBoxOuter.show(); 1613 this.coursesListBox.css('margin-left','-30px').css('opacity',0).show().animate({ 1614 'margin-left': 0, 1615 'opacity': 1 1616 }, 100, 'swing', function() { 1617 1618 self.coursesListBoxOuter.on('click',function(event) { 1619 if ($j(event.target).closest('.edubarCourseListBox').length > 0) { 1620 return; 1621 } 1622 self.toggleCoursesListBox(false); 1623 }); 1624 /*$j(document).on('click.edubarStartButton', function(event) { 1625 if ($j(event.target).closest('.coursesListBox').length > 0) { 1626 return; 1627 } 1628 1629 self.toggleCoursesListBox(false); 1630 $j(document).off('click.edubarStartButton') 1631 });*/ 1632 }); 1633 } else { 1634 this.coursesListBox.animate({ 1635 'margin-left': -30, 1636 'opacity': 0 1637 }, 100, 'swing', function() { 1638 if (self.coursesListBox) { 1639 self.coursesListBox.hide(); 1640 self.coursesListBoxOuter.hide(); 1641 } 1642 }); 1643 } 1644 1645 }, 1646 clearCoursesListBox: function() { 1647 this.coursesListBox = null; 1648 this.coursesToolbar.find('.edubarCourseListBoxOuter').remove(); 1649 1650 this.coursesListBoxOuter = null; 1651 }, 1652 clearCoursesToolbar: function() { 1653 this.coursesListBox = null; 1654 if (this.coursesToolbar) { 1655 this.coursesToolbar.html(''); 1656 } 1657 }, 1658 initSearchBox: function() { 1659 if ($('#edubarHeaderSearch').length == 0) return;
1660 barRenderReactComponent($('#edubarHeaderSearch').get(0), '/user/pics/jsw/edusearchbox.js', 'EduSearchBox', {}); 1661 }, 1662 initCoursesToolbar: function(opts) { 1663 if (this.options.isRestrictedEdupage) return; 1664 if (EdubarUtils.isOrbit()) return; 1665 this.coursesListBox = null; 1666 1667 if (opts) { 1668 for (var x in opts) { 1669 this.options[x] = opts[x]; 1670 } 1671 } 1672 1673 var self = this; 1674 var s = ''; 1675 var cr = this.options.courserow 1676 ? this.options.courserow 1677 : {name: ls(7879), edubarCls: 'notSelectedCourse'}; 1678 var asAdmin = false; 1679 if (opts && opts.asAdmin) { 1680 asAdmin = true; 1681 } 1682 1683 if (EdubarUtils.isUcitel() && cr && cr.ucitelids && EdubarUtils.indexOf(cr.ucitelids, EdubarUtils.isUcitel()) == -1 && !cr.isKompetenciePlan) { 1684 asAdmin = true; 1685 } 1686 1687 s += renderS('<a class="edubarCourseListBtn {invalidPlan} edubarCourseModuleLink {edubarCls}" data-module="courses" tabindex="0">', { 1688 invalidPlan: cr && cr.valid ? '' : 'invalidPlan', 1689 edubarCls: cr.edubarCls ? cr.edubarCls : '' 1690 });
1691 var ss = ''; 1692 ss += '<div class="edubar-course-image" style="background-image:url(\'{img}\')">'; 1693 ss += '</div>'; 1694 s += renderS(ss, { 1695 img: cr && cr.img 1696 ? cr.img 1697 : '/elearning/pics/icons/subjectDefault2.jpg', 1698 1699 }); 1700 1701 1702 s += '<span style="display: inline-block;vertical-align: middle;">'; 1703 //s += '<span style="display:block;opacity:0.5;">select course:</span>'; 1704 s += '<b>'; 1705 var pom = cr.name.split(/[·-]/); 1706 if (pom.length == 2) { 1707 s += et(pom[0]); 1708 s += '<br>'; 1709 s += et(pom[1]); 1710 } else { 1711 s += cr.name.naDvaRiadky(); 1712 } 1713 1714 if (cr.rok_nazov && cr.rok != this.options.autoYear) { 1715 s += ' <span style="font-weight:normal;opacity:0.7">('+et(cr.rok_nazov)+')</span>'; 1716 } 1717 s += '</b>'; 1718 s += '</span>'; 1719 s += ' <i class="fa fa-caret-down fa-fw" style="padding:0;font-size:16px;"></i>'; 1720 s += '</a>'; 1721 1722 1723 var modules = []; 1724 if (EdubarUtils.isAdmin() || EdubarUtils.isStudentOrParent() || asAdmin || EdubarUtils.isOrbit()) { 1725 1726 } else { 1727 if (!EdubarUtils.isStudentOrParent()) { 1728 modules.push({id:'preparations', title: ls(7878), href: barEncLink('/elearning/?cmd=EtestCreator&cspohladStart=classPlan'), sidebarTab: 'classPlan'}); 1729 modules.push({id:'standards', title: ls(7876), href: barEncLink('/elearning/?cmd=EtestCreator&cspohladStart=globalPlan'), sidebarTab: 'globalPlan'}); 1730 } 1731 if (EdubarUtils.isUcitel()) { 1732 modules.push({id:'activity', title: ls(7880), href: barEncLink('/elearning/?cmd=EtestCreator&cspohladStart=library'), sidebarTab: 'library'}); 1733 } 1734 if (EdubarUtils.isStudentOrParent()) { 1735 modules.push({id:'curriculum', title: ls(3367), href: barEncLink('/elearning/?cmd=PlanBrowser'), sidebarTab: 'curriculum'}); 1736 } 1737 1738 modules.push({id:'results', title: ls(2133), href: barEncLink('/elearning/?cmd=EtestCreator&cspohladStart=tests'), sidebarTab: 'tests'}); 1739 1740 modules.push({id:'znamky', title: ls(1131), href: barEncLink(EdubarUtils.isAdmin() ? '/znamky/?what=zobraztriedu' : '/znamky/') }); 1741 1742 if ((EdubarUtils.isUcitel() || EdubarUtils.isAdmin())) { 1743 modules.push({id:'students', title: ls(1006) , href: barEncLink('/elearning/?cmd=Students') }); 1744 } 1745 if (EdubarUtils.isUcitel() && this.options.bbenabled && false) { 1746 modules.push({id: 'bb', title: 'Blackboards', action: 'openBBPopup'}); 1747 } 1748 1749 } 1750 1751 for (var i=0;i<modules.length;i++) { 1752 var r = modules[i]; 1753 var ss = ''; 1754 ss += '<a '+(r.href ? 'href="{r.href}"' : '')+' class="edubarCourseModuleLink edubarCourseModuleLink0" data-module="{r.id}" data-stab="{r.sidebarTab}" title="{title}" data-action="{r.action}">'; 1755 ss += '<div class="ebicon ebicon-module-{r.id}"></div>'; 1756 if (EdubarUtils.isUcitel() || EdubarUtils.isStudentOrParent()) { 1757 ss += '<span>{r.title}</span>'; 1758 } 1759 if (r.action == 'openBBPopup') { 1760 ss += '<i class="fa fa-fw fa-caret-down" style="opacity:0.5"></i>'; 1761 } 1762 ss += '</a>'; 1763 1764 s += renderS(ss, { 1765 r: r, 1766 selectd: '', 1767 title: EdubarUtils.isUcitel() ? '' : r.title 1768 }); 1769 } 1770 1771 this.coursesToolbar = this.element.find(".edubarHeaderCourses") 1772 this.coursesToolbar.html(s); 1773 this.initSmartLinks(this.coursesToolbar); 1774 1775 if (EdubarUtils.isUcitel()) { 1776 $('#edubarHeaderSearch').insertAfter(this.coursesToolbar.find('.edubarCourseListBtn')); 1777 1778 } 1779 1780 this.coursesToolbar.find('.edubarCourseListBtn').click(function(event) { 1781 if (asAdmin) { 1782 barSmartLoadPage(barEncLink('/plany/?cmd=planyadmin')); 1783 } else 1784 if (EdubarUtils.isAdmin()) { 1785 barSmartLoadPage(barEncLink('/elearning/?cmd=Standards&ed=last')); 1786 } else { 1787 self.toggleCoursesListBox(); 1788 } 1789 }).keypressToClick(); 1790 this.coursesToolbar.find('.edubarCourseModuleLink0').click(function(event) { 1791 1792 if (event.which != 1) return; 1793 if (event.isDefaultPrevented()) return; 1794 1795 1796 var src = $j(this).attr('href'); 1797 if (!src) { 1798 var action = $j(this).attr('data-action'); 1799 if (action && self['action_'+action]) { 1800 self['action_'+action](); 1801 } 1802 return; 1803 } 1804 var tab = $j(this).attr('data-stab'); 1805 1806 event.preventDefault(); 1807 1808 if (tab && self.options.courserow) { 1809 var tabElem = $j('#etest-sidebar-tab-btn-g-'+et(tab)); 1810 if (tabElem.length > 0) { 1811 tabElem.click(); 1812 return; 1813 } 1814 } 1815 if (self.options.hasActiveModuleSkin) { 1816 window.location = src; 1817 } else { 1818 self.smartLoadPage(src); 1819 } 1820 }).keypressToClick(); 1821 }, 1822 toggleAIPanel: function(val) { 1823 this.aiPanel = $('#edubarAiPanel'); 1824 if (val === true && this.aiPanel.length>0) return; 1825 if (val === false && this.aiPanel.length == 0) return;
1826 this.action_openAiPanel(); 1827 }, 1828 action_openAiPanel: function() { 1829 this.aiPanel = $('#edubarAiPanel'); 1830 if (this.aiPanel.length > 0) { 1831 this.aiPanel.remove(); 1832 $('body').toggleClass('aipanelOpened',false); 1833 sessionStorage.setItem('aipanelOpened','0'); 1834 return; 1835 } 1836 1837 this.closeChat(); 1838 this.toggleBBPopup(false); 1839 1840 var self = this; 1841 1842 $('body').toggleClass('aipanelOpened',true); 1843 var s = ''; 1844 s += '<div id="edubarAiPanel" class="smartPreservedDiv">'; 1845 s += '<div id="edubarAiPanelW" >'; 1846 s += '<div class="" style="padding: 25px;text-align:center;opacity:0.5;color: #000;position: absolute;top: 50%;left:0;right:0;transform: translateY(-50%);">'; 1847 s += '<i class="fa fa-spinner fa-spin" style="font-size: 64px;color: #aaa"></i>'; 1848 1849 s += '</div>'; 1850 s += '</div>'; 1851 s += '</div>'; 1852 1853 1854 this.aiPanel = $(s).appendTo('body'); 1855 1856 sessionStorage.setItem('aipanelOpened','1'); 1857 1858 barRenderReactComponent($('#edubarAiPanelW').get(0), '/ai/pics/jsw/aipanel.js', 'AIPanel', {}); 1859 $(window).resize(); 1860 }, 1861 toggleBBPopup: function(val) { 1862 this.bbPanel = $('#edubarBbPanel'); 1863 if (val === true && this.bbPanel.length>0) return; 1864 if (val === false && this.bbPanel.length == 0) return; 1865 1866 this.action_openBBPopup(); 1867 }, 1868 1869 action_openBBPopup: function() { 1870 this.bbPanel = $('#edubarBbPanel'); 1871 if (this.bbPanel.length > 0) { 1872 this.bbPanel.remove(); 1873 $('body').toggleClass('bbpanelOpened',false); 1874 sessionStorage.setItem('bbPanelOpened','0'); 1875 return; 1876 } 1877 1878 this.closeChat(); 1879 this.toggleAIPanel(false); 1880 var self = this; 1881 1882 $('body').toggleClass('bbpanelOpened',true); 1883 var s = ''; 1884 s += '<div id="edubarBbPanel" class="smartPreservedDiv">'; 1885 s += '<div class=" bbListBox" >'; 1886 s += '<div class="" style="padding: 25px;text-align:center;opacity:0.5;color: #000;position: absolute;top: 50%;left:0;right:0;transform: translateY(-50%);">'; 1887 s += '<i class="fa fa-spinner fa-spin" style="font-size: 64px;color: #aaa"></i>'; 1888 1889 s += '</div>'; 1890 s += '</div>'; 1891 s += '</div>'; 1892 1893 1894 this.bbPanel = $(s).appendTo('body'); 1895 this.bblistBox = this.bbPanel.find('.bbListBox'); 1896 1897 sessionStorage.setItem('bbPanelOpened','1'); 1898 1899 var meditorMain = $('.etest-meditor-topmain'); 1900 var searchWidget = $('.etest-search-container').data('publicActions'); 1901 var ed = meditorMain.length > 0 ? meditorMain.attr('data-searcherpohlad') : 'last'; 1902 1903 var temaid = this.editorState && meditorMain.length > 0 ? this.editorState.getCurrentPlanTopic() : ''; 1904 var cardids = searchWidget ? searchWidget.getSelectedCardids() : []; 1905 var postData = { 1906 ed: ed, 1907 edubar: '1', 1908 temaid: temaid, 1909 cardids: cardids.join(';') 1910 } 1911 //this.coursesToolbar.find('.edubarCourseModuleLink0[data-module="bb"]').toggleClass('selected',true); 1912 $j.post('/bb/?cmd=BBMain', postData, function(data) { 1913 1914 self.bblistBox.html(data); 1915 }); 1916 /* 1917 this.bblistBoxOuter.show(); 1918 this.bblistBox.css('margin-left','-30px').css('opacity',0).show().animate({ 1919 'margin-left': 0, 1920 'opacity': 1 1921 }, 100, 'swing', function() { 1922 1923 self.bblistBoxOuter.on('click',function(event) { 1924 if ($j(event.target).closest('.edubarCourseListBox').length > 0) { 1925 return; 1926 } 1927 self.bblistBox.animate({ 1928 'margin-left': -30, 1929 'opacity': 0 1930 }, 100, 'swing', function() { 1931 if (self.bblistBox) { 1932 self.bblistBox.hide(); 1933 self.bblistBoxOuter.hide(); 1934 self.bblistBoxOuter.remove(); 1935 self.coursesToolbar.find('.edubarCourseModuleLink0[data-module="bb"]').toggleClass('selected',false); 1936 } 1937 }); 1938 }); 1939 }); */ 1940 }, 1941 checkTimeoutId: null, 1942 initCheckTimer: function() { 1943 1944 var self = this; 1945 this.lastSessionPingTime = (new Date()).getTime(); 1946 this.checkTimerId = setTimeout(function() { 1947 self.checkTimer(); 1948 }, 1000); 1949 }, 1950 switchSchoolYear: function(year) { 1951 var self = this; 1952 if (year == 'more') { 1953 if (this.schoolYearVal) { 1954 this.element.find('#edubarSchoolYear select').val(this.schoolYearVal); 1955 } 1956 1957 barNewDialog({source: '/znamky/?what=SwitchYear'}); 1958 1959 } else {
1960 this.element.find('#edubarSchoolYear').css('opacity','0.5'); 1961 $j.post('/znamky/?what=setyear',{znamky_yearid: year}, function(data) { 1962 self.element.find('#edubarSchoolYear').css('opacity','1'); 1963 self.element.find('#edubarSchoolYear select').val(data); 1964 self.options.selectedYear = parseInt(data, 10); 1965 self.clearCoursesToolbar(); 1966 barSmartReloadPage(); 1967 if (EdubarUtils.isUcitel()) { 1968 self.initCoursesToolbar(); 1969 } 1970 }); 1971 } 1972 }, 1973 checkTimer: function() { 1974 var self = this; 1975 if ((new Date()).getTime() - this.lastSessionPingTime > this.options.sessionPingInterval*1000*1.3) { 1976 1977 this.sessionPing(true); 1978 } 1979 this.checkTimerId = setTimeout(function() { 1980 self.checkTimer(); 1981 }, 1000); 1982 }, 1983 initSmartLinks: function(elem) { 1984 var thisObj = this; 1985 elem.find('.edubarSmartLink').off('click.smartlink'); 1986 elem.find('.edubarSmartLink').on('click.smartlink',function(event) { 1987 1988 if (event.which != 1) return; 1989 if (event.isDefaultPrevented()) return; 1990 var src = $j(this).attr('href'); 1991 if (!src) return; 1992 if (src == '/dashboard/eb.php?mode=reports') { 1993 event.preventDefault(); 1994 thisObj.smartLoadScript(src); 1995 return; 1996 } 1997 if ($j(this).hasClass('edubarLinkToSkin')) return; 1998 if (!$j(this).hasClass('edubarLinkToSkin') && thisObj.options.hasActiveModuleSkin) return; 1999 event.preventDefault(); 2000 2001 thisObj.smartLoadPage(src); 2002 }); 2003 2004 2005 elem.find('form.edubarSmartLoadFrm').off('submit.smartlink'); 2006 elem.find('form.edubarSmartLoadFrm').on('submit.smartlink',function(event) { 2007 event.preventDefault(); 2008 var src = $j(this).attr('action'); 2009 src += (src.indexOf('?') == -1 ? '?' : '&')+$j(this).serialize(); 2010 thisObj.smartLoadPage(barEncLink(src)); 2011 return false; 2012 }); 2013 }, 2014 initGlobalEvents: function() { 2015 var thisObj = this; 2016 $j(document).off('click.edubar'); 2017 $j(document).on('click.edubar',function(event) { 2018 if ($j(event.target).closest('ul.edubarMenulist').length == 0) { 2019 thisObj.element.find('ul.edubarMenulist.level1').hide(); 2020 } 2021 }); 2022 2023 $j(window).off('hashchange.edubar'); 2024 $j(window).on('hashchange.edubar',function(e) { 2025 thisObj.hashChange(); 2026 }); 2027 2028 $j(window).off('popstate.edubar'); 2029 $j(window).on('popstate.edubar',function(e) { 2030 2031 if (edubar.popStateHandlers && edubar.popStateHandlers.length > 0) { 2032 2033 var r = edubar.popStateHandlers[edubar.popStateHandlers.length-1]; 2034 if (r.func && r.elem && $(r.elem).closest('body').length > 0) { 2035 var pom = []; 2036 for (var i=0;i<edubar.popStateHandlers.length;i++) { 2037 if (edubar.popStateHandlers[i] == r) continue; 2038 pom.push(edubar.popStateHandlers[i] ); 2039 } 2040 2041 edubar.popStateHandlers = pom; 2042 if (r.func(e) === false ) { 2043 window.history.pushState(r.state, '', r.url); 2044 edubar.popStateHandlers.push(r); 2045 e.stopPropagation(); 2046 } 2047 e.preventDefault(); 2048 return; 2049 } 2050 2051 2052 } 2053 2054 if (thisObj.smartLinksHashChanged) { 2055 thisObj.smartLinksHashChanged = false; 2056 return; 2057 } 2058 2059 if (!e.originalEvent.state || !e.originalEvent.state.eduSmartHref) { 2060 setTimeout(function() { 2061 if (thisObj.smartLinksHashChanged) { 2062 thisObj.smartLinksHashChanged = false; 2063 return; 2064 } 2065 if (!e.cancelBarHandler) { 2066 thisObj.smartLoadPage(window.location.pathname+window.location.search, true); 2067 e.stopImmediatePropagation(); 2068 } else { 2069 thisObj.lastLoadedLocation = window.location.pathname+window.location.search; 2070 } 2071 },100); 2072 return; 2073 } 2074 2075 var href = e.originalEvent.state.eduSmartHref; 2076 var eduSmartScroll = e.originalEvent.state.eduSmartScroll; 2077 2078 if (window._edupageSmartLoadStack) { 2079 window._edupageSmartLoadStack.pop(); 2080 } 2081 thisObj.smartLoadPage(href, true, null, null, function() { 2082 if (eduSmartScroll) { 2083 $(window).scrollTop(eduSmartScroll.top); 2084 $(window).scrollLeft(eduSmartScroll.left); 2085 } 2086 }); 2087 e.stopImmediatePropagation(); 2088 2089 }); 2090 2091 $j(window).off('storage.edubar'); 2092 $j(window).on('storage.edubar',function(event) { 2093 thisObj.handleStorageEvent(event); 2094 }); 2095 }, 2096 smartLoadPage: function(href, doNotStoreState, forceReaload, forceLeave, doneFunc) { 2097 2098 var startTime = new Date(); 2099 var thisObj = this; 2100 2101 if (thisObj.smartLeaveFunc && !forceLeave) { 2102 thisObj.smartLeaveFunc(function() { 2103 thisObj.smartLoadPage(href, doNotStoreState, forceReaload, true); 2104 }); 2105 return; 2106 } 2107 2108 //if (this.lastLoadedLocation == href && !forceReaload) return; 2109 var buevent = jQuery.Event( "beforeunload" ); 2110 buevent.originalEvent = {'returnValue': ''}; 2111 $j(window).trigger(buevent); 2112 if (buevent.isDefaultPrevented()) return; 2113 if (buevent.originalEvent.returnValue != '') { 2114 if (!confirm(buevent.originalEvent.returnValue)) { 2115 return; 2116 } 2117 } 2118 if (MobileAppBridge.isV2Active()) { 2119 $(window).trigger("smartLoadPage",[href]); 2120 return; 2121 } 2122 2123 2124 2125 2126 var state = window.history.state || {}; 2127 var chref = window.location.href; 2128 state['eduSmartHref'] = chref; 2129 state['eduSmartScroll'] = {top: $(window).scrollTop(), left: $(window).scrollLeft()}; 2130 if (window.history.replaceState) { 2131 window.history.replaceState(state, null, chref); 2132 } 2133 2134 2135 if (!window._edupageSmartLoadStack) window._edupageSmartLoadStack = []; 2136 if (window._edupageSmartLoadStack.length > 0) {window._edupageSmartLoadStack.pop();} 2137 window._edupageSmartLoadStack.push(state); 2138 2139 2140 2141 if (MobileAppBridge.isActive() && !thisObj.noHideContent) { 2142 $j('#bar_mainDiv').hide(); 2143 } 2144 2145 thisObj.noHideContent = false; 2146 2147 $j('#edubar').find('#quickIntroBtn').remove(); 2148 2149 var hashPos = href.indexOf('#'); 2150 var hash = ''; 2151 if (hashPos != -1) { 2152 hash = href.substr(hashPos+1); 2153 href = href.substr(0,hashPos);//+'?'+hash; 2154 } 2155 2156 src = href + (href.indexOf('?') == -1 ? '?' : '&') + 'barNoSkin=1&ebuid='+this.options.loggedUser; 2157 $j('#edubarLogo').fadeOut('fast'); 2158 barHideSchoolYearSelector(); 2159 2160 if (this.options.ecourseenabled) { 2161 var sl = ''; 2162 sl += '<div class="edubar-loading-indicator" id="barSmartLinkLoadingDiv">'; 2163 sl += '<div class="edubar-loading-line"></div>'; 2164 sl += '<div class="edubar-loading-subline edubar-loading-inc"></div>'; 2165 sl += '<div class="edubar-loading-subline edubar-loading-dec"></div>'; 2166 sl += '</div>'; 2167 $j('body').append(sl); 2168 } else { 2169 $j('body').append('<div id="barSmartLinkLoadingDiv"></div>'); 2170 } 2171 2172 2173 //$j('body').append('<div id="barSmartLinkLoadingText">'+ls(3358)+'</div>'); 2174 2175 this.planSlowSync(); 2176 2177 this.toggleCoursesListBox(false); 2178 2179 if (src.substr(0,'/dashboard/eb.php'.length) == '/dashboard/eb.php') { 2180 if (typeof DailyPlan != 'undefined') { 2181 DailyPlan.clearCache(); 2182 } 2183 } 2184 2185 $j.get(src, function(data) { 2186 if (data && $j.trim(data) == 'ebcmd_need_reload') { 2187 if (MobileAppBridge.isActive()) { 2188 window.location = 'https://checklogin/'; 2189 } else { 2190 window.location = href; 2191 } 2192 return; 2193 } 2194 if (!EdubarUtils.isUcitel()) { 2195 thisObj.clearCoursesToolbar(); 2196 } 2197 barTrackTiming('EdubarPageLoad', 'data downloaded', ((new Date()).getTime()-startTime.getTime()), src); 2198 var hstart = data.indexOf('%%%head%%%'); 2199 var hend = hstart == -1 ? -1 : data.indexOf('%%%head%%%', hstart+10); 2200 var headCnt = ''; 2201 if (hstart != -1 && hend != -1) { 2202 var headCnt = data.substr(hstart+10, hend == -1 ? 0 : hend-hstart-10); 2203 data = data.substr(0,hstart)+data.substr(hend+10); 2204 $j('head').html(thisObj.defaultHeadHtml+headCnt); 2205 } 2206 2207 if (!doNotStoreState) { 2208 if (window.history.pushState) { 2209 var hhref = href; 2210 if (hash) { 2211 hhref = href+'#'+hash; 2212 } 2213 window.history.pushState({'eduSmartHref': hhref}, null, hhref); 2214 window._edupageSmartLoadStack.push({'eduSmartHref': hhref}); 2215 } 2216 2217 } 2218 thisObj.selectModule([href]); 2219 2220 //$j(document).off(); //kvoli tomu blblo jquery draggable 2221 $j(window).off(); 2222 2223 $j('body').off('keypress'); 2224 $j('body').off('keydown'); 2225 2226 2227 var bodyElems = $j('body').children();
2228 var children = $j('#bar_mainDiv').children(); 2229 if (ASC && ASC.unmountReactChildren) { 2230 ASC.unmountReactChildren($j('#bar_mainDiv').get(0)); 2231 } 2232 2233 for (var i=0;i<bodyElems.length;i++) { 2234 if ($j(bodyElems.get(i)).hasClass('topDiv')) continue; 2235 if ($j(bodyElems.get(i)).hasClass('smartPreservedDiv')) continue; 2236 2237 barRemoveDomElem(bodyElems.get(i)); 2238 } 2239 2240 2241 $j('#bar_mainDiv').empty(); 2242 2243 thisObj.smartLeaveFunc = null; 2244 barToggleSideBar(true); 2245 barToggleEdubarHeader(true); 2246 barToggleEdubarBorder(true); 2247 barToggleEdubarLogo(true); 2248 $j('#bar_mainDiv').css('padding-'+ertl('right','left'),'0'); 2249 thisObj.element.find('.edubarHeader').css(ertl('right','left'),'0px'); 2250 $j('#bar_mainDiv').html(data).show(); 2251 2252 2253 thisObj.initGlobalEvents(); 2254 thisObj.lastLoadedLocation = href; 2255 2256 for (var i=0;i<children.length;i++) { 2257 barRemoveDomElem(children.get(i)); 2258 } 2259 $(window).scrollTop(0); 2260 $j(document).ready(function() { 2261 $j('#barSmartLinkLoadingDiv').remove(); 2262 $j('#barSmartLinkLoadingText').remove(); 2263 $j('#edubarLogo').fadeIn('fast'); 2264 $j(window).load(); 2265 2266 2267 barInitPage(); 2268 barTrackTiming('EdubarPageLoad', 'page finished', ((new Date()).getTime()-startTime.getTime()), src); 2269 2270 $j('body').trigger('smartLoaded',[thisObj]); 2271 2272 if (doneFunc) doneFunc(); 2273 }); 2274 }); 2275 }, 2276 smartLoadScript: function(src, method) { 2277 $j('#edubarLogo').fadeOut('fast'); 2278 $j('body').append('<div id="barSmartLinkLoadingDiv"></div>'); 2279 $j('body').append('<div id="barSmartLinkLoadingText">'+ls(3358)+'</div>'); 2280 src = src + (src.indexOf('?') == -1 ? '?' : '&') + 'barNoSkin=1&barContentOnly=1'; 2281 if (!method) method = 'GET'; 2282 $j.ajax({ 2283 type: method, 2284 url: src, 2285 data: {}, 2286 success: function(data) { 2287 $j('#barSmartLinkLoadingDiv').remove(); 2288 $j('#barSmartLinkLoadingText').remove(); 2289 $j('#edubarLogo').fadeIn('fast'); 2290 $j('body').append('<div class="barSmartLinkDataDiv" style="display:none">'+data+'</div>'); 2291 } 2292 }); 2293 }, 2294 smartLinksHashChanged: false, 2295 oldHash: '', 2296 hashChange: function() { 2297 var thisObj = this; 2298 var hash = window.location.hash; 2299 if (hash != '#' && hash != '' || (this.oldHash && this.oldHash != hash)) thisObj.smartLinksHashChanged = true; 2300 this.oldHash = hash; 2301 return; 2302 }, 2303 selectModule: function(modUrls) { 2304 var self = this; 2305 var currentModule = ''; 2306 var selectedMods = {}; 2307 2308 for (var m in this.options.urlToModule) { 2309 var url = this.options.urlToModule[m]; 2310 if (!url) continue; 2311 2312 for (var x in url) { 2313 var y = x.replace(/(&|\?)eqts=[^&#]+/,''); 2314 url[y] = url[x]; 2315 } 2316 2317 var jeSelected = false; 2318 for (var i=0;i<modUrls.length;i++) { 2319 modUrls[i] = modUrls[i].replace(/(&|\?)eqts=[^&#]+/,''); 2320 if (url[modUrls[i]] && url[modUrls[i]] == 1) { 2321 jeSelected = true; 2322 break; 2323 } 2324 2325 var request = EdubarUtils.getQueryParameters(modUrls[i]); 2326 var module = request.module; 2327 var params = request.params; 2328 2329 if (module == 'elearning' && m == 'elearningUvod' && (params["cmd"] == 'Intro' || !params["cmd"])) jeSelected = true; 2330 if (module == 'elearning' && m == 'moje' && (params["cmd"] == 'MojeTesty')) jeSelected = true; 2331 if (module == 'elearning' && m == 'mnouPridelene' && params["cmd"] == 'MnouPridelene') jeSelected = true; 2332 if (module == 'elearning' && m == 'mnePridelene' && params["cmd"] == 'MnePridelene') jeSelected = true; 2333 if (module == 'elearning' && m == 'skolske' && (params["cmd"] == 'SkolskePredmety' || params["cmd"] == 'SkolskeTesty')) jeSelected = true; 2334 if (module == 'elearning' && m == 'zosity' && (params["cmd"] == 'ZosityPredmety' || params["cmd"] == 'ZosityPredmet' || params["cmd"] == 'ZosityZosit')) jeSelected = true; 2335 2336 2337 if (m == 'noticeboard' && module == 'timeline' && (params["cmd"]
2337== 'noticeboard')) jeSelected = true; 2338 2339 if (m.substr(0,6) == 'orbit_') { 2340 var cmd = m.substr(6); 2341 if (module == 'orbit' && params["cmd"] == cmd) { 2342 jeSelected = true; 2343 break; 2344 } 2345 if (module == 'orbit' && params["cmd"] == 'schooldetail' && cmd == 'Schools') jeSelected = true; 2346 } 2347 2348 if (m == 'teachers' && module == 'text') { 2349 var parts = params["text"] ? params.text.split('/') : ['','']; 2350 if (parts[0] == 'teachers') jeSelected = true; 2351 } 2352 if (m == 'anketa' && module == 'anketa') jeSelected = true; 2353 if (m == 'timeline' && module == 'timeline') jeSelected = true; 2354 if (m == 'konzulatcie' && module == 'calendar' && params["cmd"] == 'KonzultacneHodinyScheduler') jeSelected = true; 2355 if (m == 'exam' && module == 'exam') jeSelected = true; 2356 if (module == 'znamky') { 2357 var what = params["what"] ? params["what"] : ''; 2358 if (what.toLowerCase().substr(0,11) == 'kompetencie') { 2359 jeSelected = jeSelected || m == 'kompetencie'; 2360 } else if (what.toLowerCase().substr(0,11) == 'prihlaskass') { 2361 jeSelected = jeSelected || m == 'prihlaskass'; 2362 } else if ((what == 'dochadzka' || what == 'prichody' || what == 'dochadzkastart')) { 2363 jeSelected = jeSelected || m == 'attendance'; 2364 } else if (m == 'znamky') { 2365 jeSelected = true; 2366 } 2367 } 2368 if (module == 'plany') { 2369 if (params["cmd"] == 'vysledky' || params["pohlad"] == 'kurz') { 2370 jeSelected = jeSelected || m == 'pripravy'; 2371 2372 } else if (m == 'plany') { 2373 jeSelected = true; 2374 } 2375 } 2376 2377 if (m == 'timeline' && module == 'timeline' && (params["cmd"] == 'noticeboard')) jeSelected = false; 2378 2379 } 2380 2381 this.element.find('ul.edubarMenulist > li[data-module="'+et(m)+'"]').toggleClass('active',jeSelected); 2382 2383 if (jeSelected) { 2384 selectedMods[m] = true; 2385 } 2386 } 2387 for (var i=0;i<modUrls.length;i++) { 2388 var request = EdubarUtils.getQueryParameters(modUrls[i]); 2389 var module = request.module; 2390 var params = request.params; 2391 if (module == 'znamky' || module == 'plany') { 2392 barShowSchoolYearSelector(); 2393 } 2394 } 2395 2396 this.element.find('ul.edubarMenulist .edubarMenuitem.withSubmenu').each(function() { 2397 if ($j(this).find('.edubarMenuitem.active').length > 0 && $j(this).siblings('.edubarMenuitem.active').length == 0) { 2398 $j(this).toggleClass('active',true); 2399 } 2400 }); 2401 2402 if (this.coursesToolbar) { 2403 this.coursesToolbar.find('.edubarCourseModuleLink').each(function() { 2404 $j(this).toggleClass('selected',!!selectedMods[$(this).attr('data-module')]); 2405 }); 2406 } 2407 2408 }, 2409 selectModuleById: function(m) { 2410 this.element.find('ul.edubarMenulist > li').each(function() { 2411 $j(this).toggleClass('active',$j(this).attr('data-module') == m); 2412 }); 2413 2414 if (m == 'znamky' || m == 'plany') { 2415 barShowSchoolYearSelector(); 2416 } 2417 2418 this.element.find('ul.edubarMenulist .edubarMenuitem.withSubmenu').each(function() { 2419 if ($j(this).find('.edubarMenuitem.active').length > 0 && $j(this).siblings('.edubarMenuitem.active').length == 0) { 2420 $j(this).toggleClass('active',true); 2421 } 2422 }); 2423 2424 if (this.coursesToolbar) { 2425 this.coursesToolbar.find('.edubarCourseModuleLink').each(function() { 2426 $j(this).toggleClass('selected',$(this).attr('data-module') == m); 2427 }); 2428 } 2429 }, 2430 sessionPing: function(doNotCreateTimeout) { 2431 var thisObj = this; 2432 var url = this.options.sessionPingUrl; 2433 if (this.options && this.options.doSessionPing === false) return; 2434 this.lastSessionPingTime = (new Date()).getTime(); 2435 2436 var gpids = []; 2437 2438 $j('.asc-gadget-jsc').each(function() { 2439 var gjsc = this.ASC_gjsc; 2440 if (gjsc && gjsc.ASC_gpid) { 2441 gpids.push(gjsc.ASC_gpid); 2442 } 2443 }); 2444 2445 $j.ajax({ 2446 type: 'post', 2447 url: url, 2448 data: {'gpids': gpids.join(';')}, 2449 success: function(data) { 2450 if (thisObj.options.createNotLogged) return; 2451 if (data == 'notlogged') { 2452 thisObj.sessionNotLogged(); 2453 //document.barLogoutForm.submit(); 2454 return; 2455 } else if (data == 'OK') { 2456 return; 2457 } 2458 obj = $j.parseJSON(data); 2459 if (obj.status == 'notlogged') { 2460 thisObj.sessionNotLogged(); 2461 //document.barLogoutForm.submit(); 2462 return; 2463 } 2464 }, 2465 global: false 2466 });
2467 2468 if (thisObj.options.sessionPingInterval > 0 && !doNotCreateTimeout) { 2469 setTimeout(function() { 2470 thisObj.sessionPing(); 2471 },thisObj.options.sessionPingInterval*1000); 2472 } 2473 }, 2474 sessionNotLoggedDlg: null, 2475 sessionNotLogged: function() { 2476 if (MobileAppBridge.isActive()) { 2477 window.location = 'https://checklogin/'; 2478 return; 2479 } 2480 2481 if (this.sessionNotLoggedDlg) return; 2482 2483 var self = this; 2484 var s = ''; 2485 s += '<img src="/global/pics/bar/door_lock_64.png" alt="" style="float:left;margin:10px;">'; 2486 s += '<p>'+et(ls(4111))+'</p>'; 2487 s += '<div style="text-align:center;margin-top:10px;clear:both;">'; 2488 s += '<input type="button" class="button-blue closeBtn" value="'+et(ls(1573))+'" onclick="barCloseDialog(this)">'; 2489 s += '</div>'; 2490 2491 this.sessionNotLoggedDlg = barNewDialog({ 2492 'title': ls(1017), 2493 'content': s, 2494 'width': 350, 2495 'close': function() { 2496 self.sessionNotLoggedDlg = null; 2497 document.barLogoutForm.submit(); 2498 } 2499 }); 2500 2501 var yuidlg = this.sessionNotLoggedDlg.data('yuiDialog'); 2502 if (yuidlg) { 2503 this.sessionNotLoggedDlg.closest('.yui-panel').find('a.container-close').remove();//css('display','none !important');//remove(); 2504 this.sessionNotLoggedDlg.find('.closeBtn').on('click',function() { 2505 self.sessionNotLoggedDlg = null; 2506 document.barLogoutForm.submit(); 2507 }); 2508 } 2509 }, 2510 toggleChat: function() { 2511 var elem = $j('#bar_chatPanel'); 2512 if (elem.length == 0) { 2513 this.openChat(); 2514 } else { 2515 this.closeChat(); 2516 } 2517 }, 2518 openChat: function() { 2519 var self = this; 2520 this.toggleBBPopup(false); 2521 this.toggleAIPanel(false); 2522 var s = '<div id="bar_chatPanel" class="loading-background" style="display:none"></div>'; 2523 var parentElem = $j('#bar_mainDiv').parent(); 2524 var chatElem = $j(s).appendTo(parentElem).fadeIn('fast'); 2525 2526 //$j('#bar_mainDiv').css('margin-'+ertl('right','left'),'240px'); 2527 $j.post('/chat/?cmd=ChatList', function(data) { 2528 chatElem.html(data); 2529 chatElem.removeClass('loading-background'); 2530 self.initSmartLinks($j('#bar_chatPanel')); 2531 }); 2532 $('body').toggleClass('chatPanelOpened', true); 2533 //$j('head').append('<style id="fixedRightCss" type="text/css">.fixed-right { '+ertl('right','left')+': 240px !important;}</style>'); 2534 if (sessionStorage) sessionStorage.setItem('chatOpened','1'); 2535 2536 this.initFixedRightPos(); 2537 }, 2538 closeChat: function() { 2539 var self = this; 2540 $j('#bar_chatPanel').remove(); 2541 $('body').toggleClass('chatPanelOpened', false); 2542 /* 2543 $j('#bar_mainDiv').css('margin-right','0'); 2544 $j('#fixedRightCss').remove();*/ 2545 2546 self.initFixedRightPos(); 2547 if (sessionStorage) sessionStorage.removeItem('chatOpened'); 2548 }, 2549 initFixedRightPos: function() { 2550 var elem = $j('#bar_chatPanel'); 2551 if (elem.length == 0) { 2552 $j('.chatMarginRight').toggleClass('chatMarginRight',false); 2553 } else { 2554 $('body').find('*').each(function() { 2555 var $this = $(this); 2556 if ($this.css('position') == 'fixed' && $this.attr('id') != 'bar_chatPanel' && !$this.hasClass('edubarHeader') && !$this.hasClass('fixed-right')&& !$this.hasClass('fixedRight')) { 2557 $this.toggleClass('chatMarginRight',true); 2558 } 2559 }) 2560 } 2561 }, 2562 registerChatWindow: function(chatid, wnd) { 2563 this.openedChatWindows[chatid] = wnd; 2564 2565 this.initSyncInterval(); 2566 2567 this._trigger('chatopened', null, {'chatid': chatid, 'wnd': wnd}); 2568 }, 2569 unregisterChatWindow: function(chatid) { 2570 delete this.openedChatWindows[chatid]; 2571 2572 this._trigger('chatclosed', null, {'chatid': chatid}); 2573 }, 2574 isOpenedChatWindow: function(chatid) { 2575 return !!this.openedChatWindows[chatid]; 2576 }, 2577 openedChatWindowsCount: function(chatid) { 2578 var count = 0; 2579 for (var x in this.openedChatWindows) { 2580 count++; 2581 } 2582 return count; 2583 }, 2584 openChatWindow: function(chatid) { 2585 if ($j('#barChatWindow'+chatid).length > 0) { 2586 $j('#barChatWindow'+chatid).find('.textInput').focus(); 2587 return; 2588 } 2589 var parentElem = $('#barChatWindowsParent'); 2590 if (parentElem.length == 0) { 2591 parentElem = $('<div id="barChatWindowsParent"></div>').appendTo($j('#bar_mainDiv').parent()); 2592 } 2593 var self = this; 2594 2595 var s = '<div id="barChatWindow'+et(chatid)+'" class="chatWindow loading-background" style="display:none"></div>'; 2596 2597 //var parentElem = $j('#bar_mainDiv').parent(); 2598 var windowElem = $j(s).appendTo(parentElem); 2599 windowElem.css('bottom',10); 2600 2601 windowElem.css('left',$j(window).width()-240-410*(edubar.openedChatWindowsCount()+1)); 2602 2603 windowElem.fadeIn('fast'); 2604
2605 $j.post('/chat/?cmd=ChatWindow&chatid='+chatid, function(data) { 2606 windowElem.html(data); 2607 windowElem.removeClass('loading-background'); 2608 windowElem.data('chat-list',self); 2609 }); 2610 }, 2611 currentSync: 0, 2612 currentTimeoutID: null, 2613 syncInterval: 90000, 2614 syncIntervalMultiplier: 1, 2615 initSyncInterval: function() { 2616 if (!EdubarUtils.getLoggedUser()) return; 2617 var self = this; 2618 if (this.currentTimeoutID) { 2619 clearTimeout(this.currentTimeoutID); 2620 } 2621 var interval = 30000; 2622 var chatujem = false; 2623 for (var x in this.openedChatWindows) { 2624 var wnd = this.openedChatWindows[x]; 2625 interval = 16000; 2626 if (wnd.element.find('.textInput').is(':focus') || wnd.element.is(':focus')) { 2627 interval = 8000; 2628 chatujem = true; 2629 break; 2630 } 2631 } 2632 2633 if (!chatujem) { 2634 interval = interval*self.syncIntervalMultiplier; 2635 } 2636 interval += Math.round(Math.random()*(interval/2)-(interval/4)); 2637 this.getGlobalOpenedChats(true); 2638 2639 this.syncInterval = interval; 2640 2641 self.currentSync++; 2642 var index = self.currentSync; 2643 2644 this.currentTimeoutID = setTimeout(function() { 2645 self.dataSyncTimer(index); 2646 }, interval); 2647 }, 2648 dataSyncTimer: function(index) { 2649 if (this.currentSync != index) return; 2650 this.currentTimeoutID = null; 2651 this.dataSync(); 2652 }, 2653 slowSyncPlanned: false, 2654 lastSlowSync: new Date(), 2655 planSlowSync: function() { 2656 this.slowSyncPlanned = true; 2657 }, 2658 actionsToSync: {}, 2659 dataSync: function(actions, doneFunc, forceSlow) { 2660 var self = this; 2661 var chats = []; 2662 for (var chatid in this.openedChats) { 2663 chats.push(this.openedChats[chatid]); 2664 } 2665 2666 2667 var postData = { 2668 'akcia': 'sync', 2669 'openedChats': chats.join(';'), 2670 'uid': EdubarUtils.getLoggedUser(), 2671 'uidsgn': this.options.uidsgn, 2672 }; 2673 2674 if (actions) { 2675 for (var i=0;i<actions.length;i++) { 2676 if (!actions[i].randid) actions[i].randid = this.getRandomString(10); 2677 if (!actions[i].key) actions[i].key = actions[i].type+'_'+actions[i].randid; 2678 this.actionsToSync[actions[i].key] = actions[i]; 2679 } 2680 2681 } 2682 if (!EdubarUtils.isEmptyObject(this.actionsToSync)) { 2683 postData['actions'] = JSON.stringify(this.actionsToSync); 2684 } 2685 2686 2687 var cd = new Date(); 2688 var syncing = localStorage.getItem('edubarSyncing'); 2689 if (syncing && syncing>=cd.getTime()-this.syncInterval*1.2 && !forceSlow) { 2690 self.initSyncInterval(); 2691 return; 2692 } 2693 2694 this.lastSyncTime = cd.getTime(); 2695 2696 var globalSyncData = this.getLastGlobalSync(); 2697 if (globalSyncData) { 2698 self.dataSyncReceived(globalSyncData); 2699 self.initSyncInterval(); 2700 return; 2701 } 2702 2703 localStorage.setItem('edubarSyncing',cd.getTime()); 2704 var syncType = 'quick'; 2705 if (actions || forceSlow || !EdubarUtils.isEmptyObject(this.actionsToSync)) { 2706 syncType = 'slow'; 2707 } else 2708 if (this.slowSyncPlanned && this.lastSlowSync) { 2709 if ((cd.getTime() - this.lastSlowSync.getTime()) >= 10*1000*60) { 2710 syncType = 'slow'; 2711 this.lastSlowSync = cd; 2712 this.slowSyncPlanned = false; 2713 } 2714 } 2715 2716 $j.ajax({ 2717 type: 'post', 2718 dataType: 'json', 2719 url: '/chat/'+syncType+'?cmd=ChatList&t='+et(self.options.lastSync)+'&e='+et(self.options.edupage), 2720 data: postData, 2721 success: function(data) { 2722 2723 if (data.actionsRes) { 2724 var n = {}; 2725 for (var key in self.actionsToSync) {
2726 var a = self.actionsToSync[key]; 2727 if (data.actionsRes[key]) continue; 2728 n[key] = a; 2729 } 2730 2731 self.actionsToSync = n; 2732 } 2733 2734 if (data.hit) { 2735 self.dataSync(actions, doneFunc, true); 2736 return; 2737 } 2738 if (doneFunc) { 2739 doneFunc(data); 2740 } 2741 if (data.lastSync) { 2742 self.options.lastSync = data.lastSync; 2743 } 2744 if (data.nt) { 2745 self.options.lastSync = data.nt; 2746 } 2747 self.setLastGlobalSync(data); 2748 self.dataSyncReceived(data); 2749 localStorage.removeItem('edubarSyncing'); 2750 2751 if (data.syncIntervalMultiplier) { 2752 self.syncIntervalMultiplier = Math.min(5,Math.max(0.5,parseFloat(data.syncIntervalMultiplier))); 2753 } 2754 2755 self.initSyncInterval(); 2756 2757 }, 2758 global: false, 2759 error: function() { 2760 localStorage.removeItem('edubarSyncing'); 2761 self.initSyncInterval(); 2762 } 2763 }); 2764 }, 2765 getRandomString: function(length) { 2766 2767 if (window.crypto) { 2768 var iv = new Uint8Array(length); 2769 2770 crypto.getRandomValues(iv); 2771 2772 var s = '', h = '0123456789ABCDEF'; 2773 for (var i=0;i<iv.length;i++) { 2774 var v = iv[i]; 2775 s += h[v >> 4] + h[v & 15]; 2776 } 2777 2778 return s; 2779 } 2780 var ret = ""; 2781 var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 2782 var charactersLength = characters.length; 2783 for ( var i = 0; i < length; i++ ) { 2784 ret += characters.charAt(Math.floor(Math.random() * charactersLength)); 2785 } 2786 2787 return ret; 2788 }, 2789 edubarSyncData: null, 2790 edubarLastSync: null, 2791 handleStorageEvent: function(event) { 2792 2793 var self = this; 2794 var origEvent = event.originalEvent; 2795 var newValue = origEvent.newValue; 2796 if (!newValue) return; 2797 if (origEvent.key == 'edubarSyncData') { 2798 self.edubarSyncData = newValue; 2799 } else if (origEvent.key == 'edubarLastSync') { 2800 self.edubarLastSync = newValue; 2801 } else if (origEvent.key == 'edubarGetOpenedChats') { 2802 2803 var chats = {}; 2804 for (var chatid in this.openedChatWindows) { 2805 var wnd = this.openedChatWindows[chatid]; 2806 if (!wnd) continue; 2807 chats[chatid] = chatid+'|'+wnd.options.lastSprava; 2808 } 2809 localStorage.setItem('edubarOpenedChats', JSON.stringify(chats)); 2810 localStorage.removeItem('edubarOpenedChats'); 2811 } else if (origEvent.key == 'edubarOpenedChats') { 2812 var chats = JSON.parse(newValue); 2813 2814 for (var chatid in chats) { 2815 this.openedChats[chatid] = chats[chatid]; 2816 } 2817 } 2818 }, 2819 openedChats: {}, 2820 getGlobalOpenedChats: function(clear) { 2821 if (clear) { 2822 this.openedChats = {}; 2823 } 2824 localStorage.setItem('edubarGetOpenedChats','1'); 2825 localStorage.removeItem('edubarGetOpenedChats'); 2826 for (var chatid in this.openedChatWindows) { 2827 var wnd = this.openedChatWindows[chatid]; 2828 if (!wnd) continue; 2829 this.openedChats[chatid] = chatid+'|'+wnd.options.lastSprava; 2830 } 2831 2832 return this.openedChats; 2833 }, 2834 setLastGlobalSync: function(data) { 2835 var date = new Date(); 2836 localStorage.setItem('edubarLastSync',date.getTime()); 2837 localStorage.setItem('edubarSyncData',JSON.stringify(data)); 2838 2839 localStorage.removeItem('edubarSyncData'); 2840 localStorage.removeItem('edubarLastSync'); 2841 }, 2842 getLastGlobalSync: function(interval) { 2843 var date = new Date(); 2844 var lastSync = this.edubarLastSync ? this.edubarLastSync : localStorage.getItem('edubarLastSync'); 2845 var pom = new Date(); 2846 pom.setTime(lastSync); 2847 2848 if (lastSync && lastSync > date.getTime()-this.syncInterval) { 2849 var data = this.edubarSyncData ? this.edubarSyncData : localStorage.getItem('edubarSyncData'); 2850 2851 return JSON.parse(data); 2852 2853 } 2854 return null; 2855 }, 2856 dataSyncReceived: function(data) { 2857 var thisObj = this; 2858 if (data.timelineCount || data.timelineCount === 0) { 2859 thisObj.element.find('.edubarTimelineBtn .notif').html(data.timelineCount > 0 ? data.timelineCount : '').toggle(data.timelineCount>0); 2860 } 2861 2862 if (data.chatCount || data.chatCount === 0) { 2863 thisObj.element.find('.edubarChatBtn .notif').html(data.chatCount > 0 ? data.chatCount : '').toggle(data.chatCount>0); 2864 } 2865 2866 this._trigger('datasync', null, data); 2867 }, 2868 timelineDataReceived: function(data) { 2869 2870 this._trigger('timelinesync', null, data); 2871 } 2872}); 2873} 2874 2875function barSelectEdubarModule(m) { 2876 if (edubar && edubar.selectModuleById) { 2877 edubar.selectModuleById(m); 2878 } 2879} 2880 2881 2882function barHandleHashAction() { 2883 if (window.location.hash.substr(0,11) != '#edubaract_') return; 2884 2885 var action = window.location.hash.substr(1); 2886 if (typeof window[action] == 'function') { 2887 2888 window.location.hash = ''; 2889 window[action](); 2890 } 2891} 2892 2893function barGotoUrl(url) { 2894 window.location = url; 2895} 2896 2897function barTrackTiming(category, variable, time, label) { 2898 return; 2899 if (typeof _gaq != 'undefined' && _gaq && time >= 0 && time < 3600000) {
2900 _gaq.push(['_trackTiming', category, variable, time, label]); 2901 } 2902} 2903 2904function barTrackEvent(eventObj) { 2905 return; 2906 if (window.noga) return; 2907 if (edubar && edubar.options.school_country == 'de') return 2908 if (!window.gaEventTracker) {
vendor: 353 bytes, lines 2908-2914
2908 2909 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 2910 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 2911 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 2912 })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); 2913 2914 ga('create', '
2914UA-402716-19
vendor: 31 bytes, lines 2914-2915
2914', 'auto', 'eventTracker'); 2915
2915window.gaEventTracker = ga; 2916 } 2917 if (window.gaEventTracker) { 2918 if (!eventObj.hitType) eventObj.hitType = 'event'; 2919 if (!eventObj.transport) eventObj.transport = 'beacon'; 2920 ga('eventTracker.send', eventObj); 2921 } 2922} 2923 2924function showProtoUserCallout() { 2925 zn_showPopup('bar_protoUserCallout',getX(document.getElementById('barKontoBtn'))-120,getY(document.getElementById('barKontoBtn'))+15); 2926} 2927 2928function barEncLink(url) { 2929 var qs = url.indexOf('?'); 2930 //if (qs == -1) return url; 2931 2932 var qe = url.indexOf('#',qs == -1 ? 0 : qs); 2933 2934 if (qs === -1 && qe != -1) qs = qe-1; 2935 2936 var query = qs == -1 ? '' : (qe != -1 ? url.substr(qs+1, qe-qs-1) : url.substr(qs+1)); 2937 2938 var ret = qs == -1 ? url : url.substr(0,qs); 2939 ret += '?'; 2940 if (query) { 2941 ret += 'eqa='+encodeURIComponent(Base64.encode(query,true)); 2942 //ret += '&'; 2943 } 2944 //ret += 'eqts='+Base64.encode(((new Date()).getTime()/1000).toFixed(0)); 2945 if (qe != -1) { 2946 ret += url.substr(qe); 2947 } 2948 return ret; 2949} 2950 2951function barGetPicUrl(fn, prefix) { 2952 if (!fn) return ''; 2953 if (fn.substr(0,'/elearning/ruqjzfpv'.length) == '/elearning/ruqjzfpv') return fn; 2954 var infix = prefix.substr(-1) == '/' || url.substr(0,1) == '/' ? '' : '/'; 2955 2956 return prefix+infix+fn; 2957} 2958 2959function staticUrl(src) { 2960 if (!src) return src; 2961 if (ASC && ASC.ascdevelop) return src; // na develop edupagoch brat obrazky lokalne 2962 if (src.substr(0,4) == 'http' || src.substr(0,2) == '//') return src; 2963 if (src.substr(0,1) != '/') src = '/'+src; 2964 if (src.substr(0,8) == '/elearn/') return src; 2965 if (src.substr(0,7) == '/files/') return src; 2966 if (src.substr(0,8) == '/photos/') return src; 2967 // return '//cloud3.edupage.org'+src; 2968 //return '//static1.edupage.org/files'+src; 2969 return '//static.edupage.org'+src; 2970 return src; 2971} 2972 2973 2974/*=================== znamky komponenty ===============================================*/ 2975 2976function getXYSize() { 2977 var myWidth = 0, myHeight = 0; 2978 if( typeof( window.innerWidth ) == 'number' ) { 2979 //Non-IE 2980 myWidth = window.innerWidth; 2981 myHeight = window.innerHeight; 2982 } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 2983 //IE 6+ in 'standards compliant mode' 2984 myWidth = document.documentElement.clientWidth; 2985 myHeight = document.documentElement.clientHeight; 2986 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { 2987 //IE 4 compatible 2988 myWidth = document.body.clientWidth; 2989 myHeight = document.body.clientHeight; 2990 } 2991 return {y: myHeight, x: myWidth}; 2992} 2993 2994function getYSize() { 2995 return getXYSize().y; 2996} 2997 2998function getXSize() { 2999 return getXYSize().x; 3000} 3001 3002function getDocumentHeight() { 3003 var D = document; 3004 return Math.max( 3005 Math.max(D.body.scrollHeight, D.documentElement.scrollHeight), 3006 Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), 3007 Math.max(D.body.clientHeight, D.documentElement.clientHeight) 3008 ); 3009} 3010function getDocumentWidth() { 3011 var D = document; 3012 return Math.max( 3013 Math.max(D.body.scrollWidth, D.documentElement.scrollWidth), 3014 Math.max(D.body.offsetWidth, D.documentElement.offsetWidth), 3015 Math.max(D.body.clientWidth, D.documentElement.clientWidth) 3016 ); 3017} 3018function getXYScroll() { 3019 var scrOfX = 0, scrOfY = 0; 3020 if( typeof( window.pageYOffset ) == 'number' ) { 3021 //Netscape compliant 3022 scrOfY = window.pageYOffset; 3023 scrOfX = window.pageXOffset; 3024 } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { 3025 //DOM compliant 3026 scrOfY = document.body.scrollTop; 3027 scrOfX = document.body.scrollLeft; 3028 } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { 3029 //IE6 standards compliant mode 3030 scrOfY = document.documentElement.scrollTop; 3031 scrOfX = document.documentElement.scrollLeft; 3032 } 3033 return {x: scrOfX, y: scrOfY}; 3034} 3035function getXScroll() { 3036 return getXYScroll().x; 3037} 3038function getYScroll() { 3039 return getXYScroll().y; 3040} 3041 3042function getY( oElement ) { 3043 var iReturnValue = 0; 3044 while( oElement != null ) { 3045 iReturnValue += oElement.offsetTop; 3046 oElement = oElement.offsetParent; 3047 } 3048 return iReturnValue; 3049} 3050 3051function getX( oElement ) { 3052 var iReturnValue = 0; 3053 while( oElement != null ) { 3054 3055 iReturnValue += oElement.offsetLeft; 3056 oElement = oElement.offsetParent; 3057 } 3058 return iReturnValue; 3059} 3060 3061/*==================== langs ===================================================*/ 3062 3063function ls(id) { 3064 3065 if (typeof CustomLangs != 'undefined' && CustomLangs && CustomLangs[id]) { 3066 return CustomLangs[id]; 3067 } 3068 3069 if (typeof Langs == 'undefined' || !Langs) return id.toString(); 3070 if (!Langs[id]) return id.toString(); 3071 3072 if (edubar && edubar.options && edubar.options.showLangIds) { 3073 return id.toString(); 3074 } 3075 3076 return Langs[id]; 3077} 3078 3079function lsf(i, replace) { 3080 var t = parseInt(i) ? ls(parseInt(i)) : i; 3081 if (replace) { 3082 for (var ri in replace) { 3083 var value = replace[ri]; 3084 t = t.replace('{' + ri + '}', value + ''); 3085 while (true) { 3086 var i0 = t.indexOf('{' + ri + ':'); 3087 if (i0 >= 0) { 3088 var i1 = i0 + 2 + ri.length, i2 = t.indexOf('}', i1);
3089 var ts = t.substring(i1, i2).split('|'), tvar = 1; 3090 switch (EdubarUtils.getLang()) { 3091 case 'sk': 3092 case 'cz': 3093 if (value == 1) 3094 tvar = 1; 3095 else if ((value > 1 && value < 5) || Math.ceil(value) != Math.floor(value)) 3096 tvar = 2; 3097 else 3098 tvar = 3; 3099 break; 3100 default: 3101 if (value == 1) 3102 tvar = 1; 3103 else 3104 tvar = 2; 3105 case 'hr': 3106 var v = Math.abs(parseInt(value + '')); 3107 if (v % 10 == 1 && v % 100 != 11) 3108 tvar = 1; 3109 else if (v % 10 >= 2 && v % 10 < 5 && (v % 100 < 10 || v % 100 >= 20)) 3110 tvar = 2; 3111 else 3112 tvar = 3; 3113 break; 3114 } 3115 if (ts.length == 1) 3116 ts = ['', ts[0], ts[0]]; 3117 if (ts.length == 2) 3118 ts = [ts[0], ts[1], ts[1]]; 3119 t = t.substr(0, i0) + ts[tvar - 1] + t.substr(i2 + 1); 3120 } 3121 else { 3122 break; 3123 } 3124 } 3125 } 3126 } 3127 return t; 3128} 3129 3130function lset(id) { 3131 return et(ls(id)); 3132} 3133 3134function barLangToRtl(lang) { 3135 if (lang == 'il') return 'rtl'; 3136 if (lang == 'rb') return 'rtl'; 3137 return 'ltr'; 3138} 3139 3140/*=================== some functions ===============================================*/ 3141 3142String.prototype.endsWith = function (s) { 3143 return this.length >= s.length && this.substr(this.length - s.length) == s; 3144}; 3145String.prototype.startsWith = function (s) { 3146 return this.length >= s.length && this.substr(0,s.length) == s; 3147}; 3148String.prototype.ucfirst = function () { 3149 return this.substr(0,1).toUpperCase()+this.substr(1); 3150}; 3151 3152String.prototype.naDvaRiadky = function(oddelovac) { 3153 if (!oddelovac) oddelovac = '<br>'; 3154 3155 var pom1 = this.split(' '); 3156 var pom = []; 3157 for (var i=0;i<pom1.length;i++) { 3158 if (pom1[i] == '') continue; 3159 if (pom1[i] == '/') { 3160 pom.push(pom1[i]); 3161 continue; 3162 } 3163 var pom3 = pom1[i].split('/'); 3164 3165 for (var j=0;j<pom3.length;j++) { 3166 if (pom3[j] == '') continue; 3167 if (j < pom3.length -1 && pom3.length>1) { 3168 pom3[j] += ' /'; 3169 } 3170 pom.push(pom3[j]); 3171 } 3172 } 3173 if (pom.length == 1) return this; 3174 var l = this.length; 3175 3176 var minDlzka = l; 3177 var r1 = ''; 3178 var r2 = ''; 3179 var rozbijaciIndex = l; 3180 var ret = ''; 3181 for (i=1;i<pom.length;i++) { 3182 var r1 = ''; 3183 var r2 = ''; 3184 for (j=0;j<pom.length;j++) { 3185 if (j<i) { 3186 if (r1 != '') r1 += ' '; 3187 r1 += pom[j]; 3188 } else { 3189 if (r2 != '') r2 += ' '; 3190 r2 += pom[j]; 3191 } 3192 } 3193 var d = Math.max(r1.length, r2.length); 3194 if (d < minDlzka) { 3195 minDlzka = d; 3196 ret = r1+oddelovac+r2; 3197 } 3198 } 3199 3200 3201 return ret; 3202}; 3203 3204function et(text) { 3205 if (text == null) text = ''; 3206 text += ''; 3207 return text 3208 .replace(/&/g, "&") 3209 .replace(/</g, "<") 3210 .replace(/>/g, ">") 3211 .replace(/"/g, """) 3212 .replace(/'/g, "'"); 3213} 3214 3215function etTexSafe(text) { 3216 if (text == null) text = ''; 3217 text += ''; 3218 return et(text).replace(/\{/g, "@@lbrace@@").replace(/\}/g,"@@rbrace@@"); 3219} 3220 3221 3222function etnl2br(text) { 3223 var ret = et(text); 3224 ret = ret.replace(new RegExp("\n","gi"),"<br>"); 3225 return ret; 3226} 3227 3228function et2(text) { 3229 if (text == null) text = ''; 3230 text += ''; 3231 return text 3232 .replace(/&(?!#?\w+;)/g, '&') // escape all unescaped ampersands 3233 .replace(/</g, "<") 3234 .replace(/>/g, ">") 3235 .replace(/"/g, """) 3236 .replace(/'/g, "'"); 3237} 3238 3239function et2nl2br(text) { 3240 var ret = et2(text); 3241 ret = ret.replace(new RegExp("\n","gi"),"<br>"); 3242 return ret; 3243} 3244 3245function undoet(text) { 3246 if (text == null) text = ''; 3247 text += ''; 3248 return text 3249 .replace(/&/g, "&") 3250 .replace(/ /g, " ") 3251 .replace(/</g, "<") 3252 .replace(/>/g, ">") 3253 .replace(/"/g, '"') 3254 .replace(/'/g, "'"); 3255} 3256
3257function renderS0(s, vars) { 3258 3259 var matches = s.match(new RegExp('\{#?!?[a-z0-9A-Z_\.]+\}','g'));//(?:\([^\)]*\))? 3260 if (!matches) return s; 3261 var trs = {}; 3262 for (var i=0;i<matches.length;i++) { 3263 var match = matches[i] 3264 3265 var field = match.substr(1,matches[i].length-2); 3266 var dangerousNoEscaping = false; 3267 if (field.substr(0,1) == '!') { 3268 field = field.substr(1); 3269 dangerousNoEscaping = true; 3270 } 3271 3272 var val = null; 3273 if (field.substr(0,1) == '#') { 3274 val = ls(field.substr(1)); 3275 } else if (vars) { 3276 var props = field.split('.'); 3277 var cur = vars; 3278 for (var j=0;j<props.length-1;j++) { 3279 3280 if (cur[props[j]]) { 3281 cur = cur[props[j]]; 3282 //cur = val; 3283 } else { 3284 cur = null; 3285 break; 3286 } 3287 } 3288 3289 j = props.length-1; 3290 if (cur) { 3291 3292 var prop = props[j]; 3293 var funcMatches = false;//prop.match(new RegExp('^[a-z0-9A-Z_]+(\([^\)]*\))','g')); 3294 if (funcMatches) { 3295 3296 3297 } else 3298 if (cur[prop] || cur[prop] === 0) { 3299 val = cur[props[j]]; 3300 } else { 3301 val = ''; 3302 } 3303 } 3304 } 3305 3306 if (val === null) continue; 3307 3308 val = val.toString(); 3309 if (!dangerousNoEscaping) { 3310 val = et(val); 3311 } 3312 trs[match] = val; 3313 3314 //s = s.replace(match, val); 3315 } 3316 s = EdubarUtils.strtr(s, trs); 3317 3318 3319 return s; 3320} 3321 3322var renderSnOptions = {skipNotAvailable: true};
3323function renderSn(s, vars) { 3324 return renderS(s, vars, renderSnOptions); 3325} 3326 3327function renderS(s, vars, options) { 3328 if (!window.renderSTime) window.renderSTime = 0; 3329 var st = (new Date()).getTime(); 3330 if (true) { 3331 3332 s = s.replace(/(src=")(\/[a-zA-Z0-9_]+\/pics\/[^"]+)(")/gi,function(match, match0, match1, match2) { 3333 if (match1.indexOf('global/pics/elearn/pics/') >=0) return match0+match1+match2; 3334 if (match1.indexOf('skin/pics/defaultLayouts/') >=0) return match0+match1+match2; 3335 return match0+staticUrl(match1)+match2; 3336 }) 3337 } 3338 3339 s = s.replace(new RegExp('\{!?#?[a-z0-9A-Z_\.]+\}','g'), function(match) { 3340 var origMatch = match; 3341 var field = match.substr(1,origMatch.length-2); 3342 var dangerousNoEscaping = false; 3343 if (field.substr(0,1) == '!') { 3344 field = field.substr(1); 3345 dangerousNoEscaping = true; 3346 } 3347 if (options && options.dangerousNoEscaping) { 3348 dangerousNoEscaping = true; 3349 } 3350 3351 var val = null; 3352 if (field.substr(0,1) == '#') { 3353 val = ls(field.substr(1)); 3354 } else if (vars) { 3355 var props = field.split('.'); 3356 var cur = vars; 3357 for (var j=0;j<props.length-1;j++) { 3358 3359 if (cur[props[j]]) { 3360 cur = cur[props[j]]; 3361 //cur = val; 3362 } else { 3363 cur = null; 3364 break; 3365 } 3366 } 3367 3368 j = props.length-1; 3369 if (cur) { 3370 3371 var prop = props[j]; 3372 var funcMatches = false;//prop.match(new RegExp('^[a-z0-9A-Z_]+(\([^\)]*\))','g')); 3373 if (funcMatches) { 3374 3375 3376 } else 3377 if (cur[prop] || cur[prop] === 0 || cur[prop] === '') { 3378 val = cur[props[j]]; 3379 } else { 3380 val = options && options.skipNotAvailable ? null : ''; 3381 } 3382 } 3383 } 3384 3385 if (val === null) { 3386 return origMatch; 3387 } 3388 3389 val = val.toString(); 3390 if (!dangerousNoEscaping) { 3391 val = options && options.nl2br ? etnl2br(val) : et(val); 3392 } 3393 return val; 3394 }); 3395 3396 3397 window.renderSTime += (new Date()).getTime()-st; 3398 3399 return s; 3400} 3401 3402function esortth(nazov, field, sortParams, noescape) { 3403 var s = ''; 3404 s += '<a class="sortLnk" data-sortby="'+et(field)+'" data-action="sortTh">'; 3405 s += noescape ? nazov : et(nazov); 3406 if (sortParams["sortBy"] == field) { 3407 s += ' <span class="sortDir">'+(sortParams["sortDir"] == 'desc' ? 'â¼' : 'â²')+'</span>'; 3408 } 3409 s += '</a>'; 3410 return s; 3411} 3412 3413 3414function esandbox(iframe, content) { 3415 var doc = iframe[0].contentDocument; 3416 doc.write(content); 3417 3418 var oHead = doc.getElementsByTagName("head")[0]; 3419 var arrStyleSheets = document.getElementsByTagName("style"); 3420 for (var i = 0; i < arrStyleSheets.length; i++) { 3421 oHead.appendChild(arrStyleSheets[i].cloneNode(true)); 3422 } 3423 3424 var arrStyleSheets = document.getElementsByTagName("link"); 3425 for (var i = 0; i < arrStyleSheets.length; i++) { 3426 oHead.appendChild(arrStyleSheets[i].cloneNode(true)); 3427 } 3428 $j(oHead).append('<style type="text/css">html, body {min-height: auto;}</style>'); 3429 $j(iframe).height($j(doc).outerHeight()); 3430 setTimeout(function() { 3431 $j(iframe).height($j(doc).outerHeight()); 3432 },100); 3433} 3434 3435var Latinise={}; 3436Latinise.latin_map={"Ã":"A","Ä":"A","Ắ":"A","Ặ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ç":"A","Ã":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ã":"A","Ç":"A","Ȧ":"A","Ç ":"A","Ạ":"A","È":"A","Ã":"A","Ả":"A","È":"A","Ä":"A","Ä":"A","à ":"A","Ǻ":"A","á¸":"A","Ⱥ":"A","Ã":"A","ê²":"AA","Ã":"AE","Ǽ":"AE","Ç¢":"AE","ê´":"AO","ê¶":"AU","ê¸":"AV","êº":"AV","ê¼":"AY","á¸":"B","á¸":"B","Æ":"B","á¸":"B","É":"B","Æ":"B","Ä":"C","Ä":"C","Ã":"C","á¸":"C","Ä":"C","Ä":"C","Æ":"C","È»":"C","Ä":"D","á¸":"D","á¸":"D","á¸":"D","á¸":"D","Æ":"D","á¸":"D","Dz":"D","Ç ":"D","Ä":"D","Æ":"D","DZ":"DZ","Ç":"DZ","Ã":"E","Ä":"E","Ä":"E","Ȩ":"E","á¸":"E","Ã":"E","Ế":"E","á»":"E","á»":"E","á»":"E","á»":"E","á¸":"E","Ã":"E","Ä":"E","Ẹ":"E","È":"E","Ã":"E","Ẻ":"E","È":"E","Ä":"E","á¸":"E","á¸":"E","Ä":"E","É":"E","Ẽ":"E","á¸":"E","êª":"ET","á¸":"F","Æ":"F","Ç´":"G","Ä":"G","Ǧ":"G","Ä¢":"G","Ä":"G","Ä ":"G","Æ":"G","Ḡ":"G","Ǥ":"G","Ḫ":"H","È":"H","Ḩ":"H","Ĥ":"H","â±§":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","Ħ":"H","Ã":"I","Ĭ":"I","Ç":"I","Ã":"I","Ã":"I","Ḯ":"I","İ":"I","á»":"I","È":"I","Ã":"I","á»":"I","È":"I","Ī":"I","Ä®":"I","Æ":"I","Ĩ":"I","Ḭ":"I","ê¹":"D","ê»":"F","ê½":"G","ê":"R","ê":"S","ê":"T","ê¬":"IS","Ä´":"J","É":"J","Ḱ":"K","Ǩ":"K","Ķ":"K","Ⱪ":"K","ê":"K","Ḳ":"K","Æ":"K","Ḵ":"K","ê":"K","ê":"K","Ĺ":"L","Ƚ":"L","Ľ":"L","Ä»":"L","Ḽ":"L","Ḷ":"L","Ḹ":"L","â± ":"L","ê":"L","Ḻ":"L","Ä¿":"L","â±¢":"L","Ç":"L","Å":"L","Ç":"LJ","Ḿ":"M","á¹":"M","á¹":"M","â±®":"M","Å":"N","Å":"N","Å ":"N","á¹":"N","á¹":"N","á¹":"N","Ǹ":"N","Æ":"N","á¹":"N","È ":"N","Ç":"N","Ã":"N","Ç":"NJ","Ã":"O","Å":"O","Ç":"O","Ã":"O","á»":"O","á»":"O","á»":"O","á»":"O","á»":"O","Ã":"O","Ȫ":"O","È®":"O","Ȱ":"O","á»":"O","Å":"O","È":"O","Ã":"O","á»":"O","Æ ":"O","á»":"O","Ợ":"O","á»":"O","á»":"O","á» ":"O","È":"O","ê":"O","ê":"O","Å":"O","á¹":"O","á¹":"O","Æ":"O","Ǫ":"O","Ǭ":"O","Ã":"O","Ǿ":"O","Ã":"O","á¹":"O","á¹":"O","Ȭ":"O","Æ¢":"OI","ê":"OO","Æ":"E","Æ":"O","È¢":"OU","á¹":"P","á¹":"P","ê":"P","Ƥ":"P","ê":"P","â±£":"P","ê":"P","ê":"Q","ê":"Q","Å":"R","Å":"R","Å":"R","á¹":"R","á¹":"R","á¹":"R","È":"R","È":"R","á¹":"R","É":"R","Ɽ":"R","ê¾":"C","Æ":"E","Å":"S","Ṥ":"S","Å ":"S","Ṧ":"S","Å":"S","Å":"S","È":"S","á¹ ":"S","á¹¢":"S","Ṩ":"S","Ť":"T","Å¢":"T","á¹°":"T","È":"T","Ⱦ":"T","Ṫ":"T","Ṭ":"T","Ƭ":"T","á¹®":"T","Æ®":"T","Ŧ":"T","Ɐ":"A","ê":"L","Æ":"M","É ":"V","ê¨":"TZ","Ã":"U","Ŭ":"U","Ç":"U","Ã":"U","á¹¶":"U","Ã":"U","Ç":"U","Ç":"U","Ç":"U","Ç":"U","á¹²":"U","Ụ":"U","Ű":"U","È":"U","Ã":"U","Ủ":"U","Ư":"U","Ứ":"U","á»°":"U","Ừ":"U","Ử":"U","á»®":"U","È":"U","Ū":"U","Ṻ":"U","Ų":"U","Å®":"U","Ũ":"U","Ṹ":"U","á¹´":"U","ê":"V","á¹¾":"V","Ʋ":"
3436V","á¹¼":"V","ê ":"VY","áº":"W","Å´":"W","áº":"W","áº":"W","áº":"W","áº":"W","â±²":"W","áº":"X","áº":"X","Ã":"Y","Ŷ":"Y","Ÿ":"Y","áº":"Y","á»´":"Y","Ỳ":"Y","Ƴ":"Y","á»¶":"Y","Ỿ":"Y","Ȳ":"Y","É":"Y","Ỹ":"Y","Ź":"Z","Ž":"Z","áº":"Z","Ⱬ":"Z","Å»":"Z","áº":"Z","Ȥ":"Z","áº":"Z","Ƶ":"Z","IJ":"IJ","Å":"OE","á´":"A","á´":"AE","Ê":"B","á´":"B","á´":"C","á´
":"D","á´":"E","ê°":"F","É¢":"G","Ê":"G","Ê":"H","ɪ":"I","Ê":"R","á´":"J","á´":"K","Ê":"L","á´":"L","á´":"M","É´":"N","á´":"O","ɶ":"OE","á´":"O","á´":"OU","á´":"P","Ê":"R","á´":"N","á´":"R","ê±":"S","á´":"T","â±»":"E","á´":"R","á´":"U","á´ ":"V","á´¡":"W","Ê":"Y","á´¢":"Z","á":"a","Ä":"a","ắ":"a","ặ":"a","ằ":"a","ẳ":"a","ẵ":"a","Ç":"a","â":"a","ấ":"a","áº":"a","ầ":"a","ẩ":"a","ẫ":"a","ä":"a","Ç":"a","ȧ":"a","Ç¡":"a","ạ":"a","È":"a","à ":"a","ả":"a","È":"a","Ä":"a","Ä
":"a","á¶":"a","áº":"a","Ã¥":"a","Ç»":"a","á¸":"a","â±¥":"a","ã":"a","ê³":"aa","æ":"ae","ǽ":"ae","Ç£":"ae","êµ":"ao","ê·":"au","ê¹":"av","ê»":"av","ê½":"ay","á¸":"b","á¸
":"b","É":"b","á¸":"b","ᵬ":"b","á¶":"b","Æ":"b","Æ":"b","ɵ":"o","Ä":"c","Ä":"c","ç":"c","á¸":"c","Ä":"c","É":"c","Ä":"c","Æ":"c","ȼ":"c","Ä":"d","á¸":"d","á¸":"d","È¡":"d","á¸":"d","á¸":"d","É":"d","á¶":"d","á¸":"d","áµ":"d","á¶":"d","Ä":"d","É":"d","Æ":"d","ı":"i","È·":"j","É":"j","Ê":"j","dz":"dz","Ç":"dz","é":"e","Ä":"e","Ä":"e","È©":"e","á¸":"e","ê":"e","ế":"e","á»":"e","á»":"e","á»":"e","á»
":"e","á¸":"e","ë":"e","Ä":"e","ẹ":"e","È
":"e","è":"e","ẻ":"e","È":"e","Ä":"e","á¸":"e","á¸":"e","ⱸ":"e","Ä":"e","á¶":"e","É":"e","ẽ":"e","á¸":"e","ê«":"et","á¸":"f","Æ":"f","áµ®":"f","á¶":"f","ǵ":"g","Ä":"g","ǧ":"g","Ä£":"g","Ä":"g","Ä¡":"g","É ":"g","ḡ":"g","á¶":"g","Ç¥":"g","ḫ":"h","È":"h","ḩ":"h","Ä¥":"h","ⱨ":"h","ḧ":"h","ḣ":"h","ḥ":"h","ɦ":"h","áº":"h","ħ":"h","Æ":"hv","Ã":"i","Ä":"i","Ç":"i","î":"i","ï":"i","ḯ":"i","á»":"i","È":"i","ì":"i","á»":"i","È":"i","Ä«":"i","į":"i","á¶":"i","ɨ":"i","Ä©":"i","á¸":"i","êº":"d","ê¼":"f","áµ¹":"g","ê":"r","ê
":"s","ê":"t","ê":"is","ǰ":"j","ĵ":"j","Ê":"j","É":"j","ḱ":"k","Ç©":"k","Ä·":"k","ⱪ":"k","ê":"k","ḳ":"k","Æ":"k","ḵ":"k","á¶":"k","ê":"k","ê
":"k","ĺ":"l","Æ":"l","ɬ":"l","ľ":"l","ļ":"l","ḽ":"l","È´":"l","ḷ":"l","ḹ":"l","ⱡ":"l","ê":"l","ḻ":"l","Å":"l","É«":"l","á¶
":"l","É":"l","Å":"l","Ç":"lj","Å¿":"s","áº":"s","áº":"s","áº":"s","ḿ":"m","á¹":"m","á¹":"m","ɱ":"m","ᵯ":"m","á¶":"m","Å":"n","Å":"n","Å":"n","á¹":"n","ȵ":"n","á¹
":"n","á¹":"n","ǹ":"n","ɲ":"n","á¹":"n","Æ":"n","áµ°":"n","á¶":"n","ɳ":"n","ñ":"n","Ç":"nj","ó":"o","Å":"o","Ç":"o","ô":"o","á»":"o","á»":"o","á»":"o","á»":"o","á»":"o","ö":"o","È«":"o","ȯ":"o","ȱ":"o","á»":"o","Å":"o","È":"o","ò":"o","á»":"o","Æ¡":"o","á»":"o","ợ":"o","á»":"o","á»":"o","ỡ":"o","È":"o","ê":"o","ê":"o","ⱺ":"o","Å":"o","á¹":"o","á¹":"o","Ç«":"o","Ç":"o","ø":"o","Ç¿":"o","õ":"o","á¹":"o","á¹":"o","È":"o","Æ£":"oi","ê":"oo","É":"e","á¶":"e","É":"o","á¶":"o","È£":"ou","á¹":"p","á¹":"p","ê":"p","Æ¥":"p","áµ±":"p","á¶":"p","ê":"p","áµ½":"p","ê":"p","ê":"q","Ê ":"q","É":"q","ê":"q","Å":"r","Å":"r","Å":"r","á¹":"r","á¹":"r","á¹":"r","È":"r","ɾ":"r","áµ³":"r","È":"r","á¹":"r","ɼ":"r","áµ²":"r","á¶":"r","É":"r","ɽ":"r","â":"c","ê¿":"c","É":"e","É¿":"r","Å":"s","á¹¥":"s","Å¡":"s","á¹§":"s","Å":"s","Å":"s","È":"s","ṡ":"s","á¹£":"s","ṩ":"s","Ê":"s","áµ´":"s","á¶":"s","È¿":"s","É¡":"g","á´":"o","á´":"o","á´":"u","Å¥":"t","Å£":"t","á¹±":"t","È":"t","ȶ":"t","áº":"t","ⱦ":"t","ṫ":"t","á¹":"t","Æ":"t","ṯ":"t","áµµ":"t","Æ«":"t","Ê":"t","ŧ":"t","ᵺ":"th","É":"a","á´":"ae","Ç":"e","áµ·":"g","É¥":"h","Ê®":"h","ʯ":"h","á´":"i","Ê":"k","ê":"l","ɯ":"m","ɰ":"m","á´":"oe","ɹ":"r","É»":"r","ɺ":"r","â±¹":"r","Ê":"t","Ê":"v","Ê":"w","Ê":"y","ê©":"tz","ú":"u","Å":"u","Ç":"u","û":"u","á¹·":"u","ü":"u","Ç":"u","Ç":"u","Ç":"u","Ç":"u","á¹³":"u","ụ":"u","ű":"u","È":"u","ù":"u","á»§":"u","ư":"u","ứ":"u","á»±":"u","ừ":"u","á»":"u","ữ":"u","È":"u","Å«":"u","á¹»":"u","ų":"u","á¶":"u","ů":"u","Å©":"u","á¹¹":"u","á¹µ":"u","ᵫ":"ue","ê¸":"um","â±´":"v","ê":"v","ṿ":"v","Ê":"v","á¶":"v","â±±":"v","á¹½":"v","ê¡":"vy","áº":"w","ŵ":"w","áº
":"w","áº":"w","áº":"w","áº":"w","â±³":"w","áº":"w","áº":"x","áº":"x","á¶":"x","ý":"y","Å·":"y","ÿ":"y","áº":"y","ỵ":"y","ỳ":"y","Æ´":"y","á»·":"y","ỿ":"y","ȳ":"y","áº":"y","É":"y","ỹ":"y","ź":"z","ž":"z","áº":"z","Ê":"z","ⱬ":"z","ż":"z","áº":"z","È¥":"z","áº":"z","áµ¶":"z","á¶":"z","Ê":"z","ƶ":"z","É":"z","ï¬":"ff","ï¬":"ffi","ï¬":"ffl","ï¬":"fi","ï¬":"fl","ij":"ij","Å":"oe","ï¬":"st","â":"a","â
3436":"e","áµ¢":"i","â±¼":"j","â":"o","áµ£":"r","ᵤ":"u","áµ¥":"v","â":"x"}; 3437String.prototype.latinise=function() {return this.replace(/[^A-Za-z0-9\[\] ]/g,function(a){return Latinise.latin_map[a]||a;});}; 3438String.prototype.latinize=String.prototype.latinise; 3439String.prototype.isLatin=function(){return this==this.latinise();}; 3440 3441Date.prototype.ascAddTime = function(val) { 3442 this.setTime(this.getTime()+val); 3443 return this; 3444} 3445//Simulates PHP's date function 3446Date.prototype.format = function(format) { 3447 if (this.ascIsEmpty) return ''; 3448 if (format == 'aria-date') { 3449 return this.format('l j. F Y'); 3450 } 3451 var returnStr = ''; 3452 var replace = Date.replaceChars; 3453 for (var i = 0; i < format.length; i++) { 3454 var curChar = format.charAt(i); 3455 if (i - 1 >= 0 && format.charAt(i - 1) == "\\") { 3456 returnStr += curChar; 3457 } 3458 else if (replace[curChar]) { 3459 returnStr += replace[curChar].call(this); 3460 } else if (curChar != "\\"){ 3461 returnStr += curChar; 3462 } 3463 } 3464 return returnStr; 3465}; 3466 3467Date.prototype.getWeekStart = function() { 3468 var d = new Date(this.getTime()); 3469 var firstDay = EdubarUtils.getFirstDayOfWeek(); 3470 3471 d.setDate(d.getDate()-((d.getDay()+(7-firstDay))%7)); 3472 3473 return d; 3474} 3475 3476Date.prototype.getWeekEnd = function() { 3477 var d = new Date(this.getTime()); 3478 var firstDay = EdubarUtils.getFirstDayOfWeek(); 3479 d.setDate(d.getDate()+((7-firstDay)-(d.getDay()))); 3480 return d; 3481} 3482 3483Date.prototype.asc_shortFormat = function(ajCas) { 3484 var ad = new Date(); 3485 var d = this; 3486 var dstr = ''; 3487 if (d.format('Y-m-d') == ad.format('Y-m-d') && !ajCas) { 3488 dstr = d.format('H:i'); 3489 } else if (d.format('Y') == ad.format('Y')) { 3490 dstr = d.format('M j'+(ajCas ? ' H:i' : '')); 3491 } else { 3492 dstr = d.format('d.m.y'+(ajCas ? ' H:i' : '')); 3493 } 3494 return dstr; 3495} 3496 3497Date.prototype.slovom = function(ajDatum, ajCas, short, lowerCase) { 3498 var format = ''; 3499 3500 var ad = new Date(); 3501 if (ajDatum) { 3502 format += 'd.m.'; 3503 if (ad.getFullYear() != this.getFullYear()) { 3504 format += 'Y'; 3505 } 3506 } 3507 3508 if (ajCas) format += ' H:i'; 3509 3510 ad.setUTCDate(ad.getUTCDate()-1); 3511 if (this.format('Y-m-d') == ad.format('Y-m-d')) { 3512 return ls(lowerCase ? 13976 : 1734)+(format != '' ? ' '+this.format(format) : ''); 3513 } 3514 ad.setUTCDate(ad.getUTCDate()+1); 3515 if (this.format('Y-m-d') == ad.format('Y-m-d')) { 3516 return ls(lowerCase ? 10097 : 1733)+(format != '' ? ' '+this.format(format) : ''); 3517 } 3518 ad.setUTCDate(ad.getUTCDate()+1); 3519 if (this.format('Y-m-d') == ad.format('Y-m-d')) { 3520 return ls(3280)+(format != '' ? ' '+this.format(format) : ''); 3521 } 3522 if (short) { 3523 return this.format("D d.m."); 3524 } 3525 if (!ajDatum) format = 'd.m.Y'+format; 3526 if (!this.dniVTyzdni) {this.dniVTyzdni = [ 3527 ls(1703), 3528 ls(1704), 3529 ls(1705), 3530 ls(1706), 3531 ls(1707), 3532 ls(1708), 3533 ls(1709) 3534 ]; 3535 } 3536 var den = this.dniVTyzdni[(this.getDay()+6)%7]; 3537 if (lowerCase && EdubarUtils.indexOf(EdubarUtils.getLang(), ['sk','cz']) >=0 ) { 3538 den = den.toLowerCase(); 3539 } 3540 return den+' '+this.format(format); 3541} 3542 3543Date.ascParse = function(str) { 3544 var ad = new Date(); 3545 var f = /^[0-9]+\.[0-9]+\.?([0-9]+)?$/gi;//new RegExp('^[0-9]+\.[0-9]+\.?([0-9]+)?$','gi'); 3546 if (f.test(str)) { 3547 var pom = str.split('.'); 3548 3549 if (pom.length < 3) { 3550 pom.push(ad.getFullYear().toString()); 3551 } 3552 3553 if (pom.length < 3) { 3554 return new Date(); 3555 } 3556 if (pom[2].length != 2 && pom[2].length != 4) { 3557 pom[2] = ad.getFullYear().toString(); 3558 } 3559 if (pom[2].length == 2) { 3560 pom[2] = pom[2]*1 > 50 ? '19'+pom[2] : '20'+pom[2]; 3561 } 3562 return new Date(pom[2]*1, pom[1]*1-1, pom[0]*1,0,0,0); 3563 } 3564 3565 f = /^[0-9]+\/[0-9]+(\/[0-9]+)?$/gi;//new RegExp('^[0-9]+/[0-9]+(/[0-9]+)?$','gi'); 3566 if (f.test(str)) { 3567 var pom = str.split('/'); 3568 if (pom.length < 3) { 3569 pom.push(ad.getFullYear()); 3570 } 3571 if (pom[2].length == 2) { 3572 pom[2] = pom[2]*1 > 50 ? '19'+pom[2] : '20'+pom[2]; 3573 } 3574 return new Date(pom[2]*1, pom[0]*1-1, pom[1]*1,0,0,0); 3575 } 3576 3577 f = /^[0-9]+-[0-9]+-[0-9]+$/gi;//new RegExp('^[0-9]+-[0-9]+-[0-9]+$','gi'); 3578 if (f.test(str)) { 3579 var pom = str.split('-'); 3580 return new Date(pom[0]*1, pom[1]*1-1, pom[2]*1,0,0,0); 3581 } 3582 3583 3584 f = /^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+(:[0-9]+)?$/gi;//new RegExp('^[0-9]+-[0-9]+-[0-9]+$','gi'); 3585 if (f.test(str)) { 3586 var pom0 = str.split(' '); 3587 var pom = pom0[0].split('-'); 3588 3589 var pom1 = pom0[1].split(':'); 3590 3591 return new Date(pom[0]*1, pom[1]*1-1, pom[2]*1,pom1[0]*1,pom1[1]
3591*1,pom1[2] ? pom1[2]*1 : 0); 3592 } 3593 3594 f = /^[0-9]+\.[0-9]+\.?([0-9]+)? [0-9]+:[0-9]+(:[0-9]+)?$/gi;//new RegExp('^[0-9]+\.[0-9]+\.?([0-9]+)? [0-9]+:[0-9]+(:[0-9]+)?$','gi'); 3595 if (f.test(str)) { 3596 var pom0 = str.split(' '); 3597 var pom = pom0[0].split('.'); 3598 if (pom.length < 3) { 3599 pom.push(ad.getFullYear().toString()); 3600 } 3601 if (pom[2].length != 2 && pom[2].length != 4) { 3602 pom[2] = ad.getFullYear().toString(); 3603 } 3604 if (pom[2].length == 2) { 3605 pom[2] = pom[2]*1 > 50 ? '19'+pom[2] : '20'+pom[2]; 3606 } 3607 3608 3609 var pom1 = pom0[1].split(':'); 3610 3611 3612 return new Date(pom[2]*1, pom[1]*1-1, pom[0]*1,pom1[0]*1,pom1[1]*1,pom1[2] ? pom1[2]*1 : 0); 3613 } 3614 3615 if (str.toLowerCase() == ls(1733).toLowerCase()) { //dnes 3616 return ad; 3617 } 3618 if (str.toLowerCase() == ls(1439).toLowerCase()) { 3619 return new Date(ad.getUTCFullYear(), ad.getUTCMonth(), ad.getUTCDate()+1,0,0,0); 3620 } 3621 if (str.toLowerCase() == ls(1734).toLowerCase()) { 3622 return new Date(ad.getUTCFullYear(), ad.getUTCMonth(), ad.getUTCDate()-1,0,0,0); 3623 } 3624 ad.ascIsEmpty = true; 3625 return ad; 3626} 3627Date.parse = Date.ascParse; 3628 3629Date.parseTime = function(str) { 3630 var ad = new Date(); 3631 var pom = str.split(':'); 3632 if (pom.length < 3) { 3633 pom.push('00'); 3634 } 3635 ad.setHours(pom[0]*1); 3636 ad.setMinutes(pom[1]*1); 3637 ad.setSeconds(pom[2]*1); 3638 return ad; 3639} 3640 3641Date.fromDbString = function(str, convertTimezone) { 3642 if (str === null || typeof str == 'undefined') str = ''; 3643 var pom = str.split(' '); 3644 if (pom.length == 0) return false; 3645 if (pom.length == 1) { 3646 pom.push('00:00:00'); 3647 } 3648 var dates = pom[0].split('-'); 3649 if (dates.length < 3) dates = ['1999','01','01']; 3650 var times = pom[1].split(':'); 3651 if (times.length < 3) times.push('00'); 3652 if (times.length < 3) times.push('00'); 3653 if (times.length < 3) times.push('00'); 3654 var d = new Date(); 3655 for (var i =0;i<3;i++) { 3656 if (dates[i].charAt(0) == '0') dates[i] = dates[i].substr(1); 3657 if (times[i].charAt(0) == '0') times[i] = times[i].substr(1); 3658 } 3659 d.setFullYear(parseInt(dates[0]), parseInt(dates[1])-1, parseInt(dates[2])); 3660 d.setHours(parseInt(times[0]),parseInt(times[1]), parseInt(times[2])); 3661 3662 if (convertTimezone && edubar && edubar.options.timezonediff) { 3663 d.setTime(d.getTime()+edubar.options.timezonediff*1000); 3664 } 3665 return d; 3666} 3667 3668 3669 3670 3671Date.initReplaceChars = function() { 3672 Date.replaceChars = { 3673 shortMonths: [ls(1711).substr(0,3),ls(1712).substr(0,3),ls(1713).substr(0,3),ls(1714).substr(0,3),ls(1715).substr(0,3),ls(1716).substr(0,3),ls(1717).substr(0,3),ls(1718).substr(0,3),ls(1719).substr(0,3),ls(1720).substr(0,3),ls(1721).substr(0,3),ls(1722).substr(0,3)], 3674 shortMonths_cz: [ls(1711).substr(0,3),ls(1712).substr(0,3),ls(1713).substr(0,3),ls(1714).substr(0,3),ls(1715).substr(0,3),'Ävn','Ävc',ls(1718).substr(0,3),ls(1719).substr(0,3),ls(1720).substr(0,3),ls(1721).substr(0,3),ls(1722).substr(0,3)], 3675 longMonths: [ls(1711),ls(1712),ls(1713),ls(1714),ls(1715),ls(1716),ls(1717),ls(1718),ls(1719),ls(1720),ls(1721),ls(1722)], 3676 shortDays: [ls(1709).substr(0,3),ls(1703).substr(0,3),ls(1704).substr(0,3),ls(1705).substr(0,3),ls(1706).substr(0,3),ls(1707).substr(0,3),ls(1708).substr(0,3)], 3677 longDays: [ls(1709), ls(1703), ls(1704),ls(1705),ls(1706),ls(1707),ls(1708)], 3678 3679 // Day 3680 d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); }, 3681 D: function() { return Date.replaceChars.shortDays[this.getDay()]; }, 3682 j: function() { return this.getDate(); }, 3683 l: function() { return Date.replaceChars.longDays[this.getDay()]; }, 3684 N: function() { return (this.getDay() +6)%7+1; }, 3685 S: function() { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); }, 3686 w: function() { return this.getDay(); }, 3687 z: function() { var d = new Date(this.getFullYear(),0,1); return Math.ceil((this - d) / 86400000); }, // Fixed now 3688 // Week 3689 W: function() { 3690 var tdt = new Date(this.valueOf()); 3691 var dayn = (this.getDay() + 6) % 7; 3692 tdt.setDate(tdt.getDate() - dayn + 3); 3693 var firstThursday = tdt.valueOf(); 3694 tdt.setMonth(0, 1); 3695 if (tdt.getDay() !== 4) { 3696 tdt.setMonth(0, 1 + ((4 - tdt.getDay()) + 7) % 7); 3697 }
3698 return 1 + Math.ceil((firstThursday - tdt) / 604800000); 3699 3700 //var d = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - d) / 86400000) + d.getDay() + 1) / 7); 3701 }, // Fixed now 3702 // Month 3703 F: function() { return Date.replaceChars.longMonths[this.getMonth()]; }, 3704 m: function() { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); }, 3705 M: function() { var shorts = Date.replaceChars['shortMonths_'+EdubarUtils.getLang()] ||Date.replaceChars.shortMonths;return shorts[this.getMonth()]; }, 3706 n: function() { return this.getMonth() + 1; }, 3707 t: function() { 3708 var d = this; 3709 return new Date(d.getFullYear(), d.getMonth()+1, 0).getDate() 3710 }, // Fixed now, gets #days of date 3711 // Year 3712 L: function() { var year = this.getFullYear(); return (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)); }, // Fixed now 3713 o: function() { var d = new Date(this.valueOf()); d.setDate(d.getDate() - ((this.getDay() + 6) % 7) + 3); return d.getFullYear();}, //Fixed now 3714 Y: function() { return this.getFullYear(); }, 3715 y: function() { return ('' + this.getFullYear()).substr(2); }, 3716 // Time 3717 a: function() { return this.getHours() < 12 ? 'am' : 'pm'; }, 3718 A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; }, 3719 B: function() { return Math.floor((((this.getUTCHours() + 1) % 24) + this.getUTCMinutes() / 60 + this.getUTCSeconds() / 3600) * 1000 / 24); }, // Fixed now 3720 g: function() { return this.getHours() % 12 || 12; }, 3721 G: function() { return this.getHours(); }, 3722 h: function() { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); }, 3723 H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); }, 3724 i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); }, 3725 s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); }, 3726 u: function() { var m = this.getMilliseconds(); return (m < 10 ? '00' : (m < 100 ? '0' : '')) + m; }, 3727 // Timezone 3728 e: function() { return "Not Yet Supported"; }, 3729 I: function() { return "Not Yet Supported"; }, 3730 O: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; }, 3731 P: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + ':00'; }, // Fixed now 3732 T: function() { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result;}, 3733 Z: function() { return -this.getTimezoneOffset() * 60; }, 3734 // Full Date/Time 3735 c: function() { return this.format("Y-m-d\\TH:i:sP"); }, // Fixed now 3736 r: function() { return this.toString(); }, 3737 U: function() { return this.getTime() / 1000; } 3738 }; 3739}; 3740 3741Date.initReplaceChars(); 3742 3743 3744var AscDate = {}; 3745AscDate.fromDbString = Date.fromDbString 3746 3747var EdubarUtils = {}; 3748EdubarUtils.getFirstDayOfWeek = function() { 3749 return edubar && edubar.options && edubar.options.firstDayOfWeek ? edubar.options.firstDayOfWeek : 1; 3750} 3751EdubarUtils.isBBEnabled = function() { 3752 return edubar && edubar.options.bbenabled; 3753} 3754EdubarUtils.replaceUrls = function(ret) { 3755 // http://, https://, ftp:// 3756 var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|](?![^\s]*")/gim; 3757 3758 // www. sans http:// or https:// 3759 var pseudoUrlPattern = /(^|[^\/])(www\.[^\r\n\t\f\v <>;,]+)(\b|$|<|>|;|,)/gim; 3760 3761 //vyhladame este odkazy: 3762 //'<a href="$&" target="_blank">$&</a>' 3763 ret = ret.replace(urlPattern, function(match) { 3764 var suffix = ''; 3765 if (match && match.endsWith('"')) { 3766 suffix = '"'; 3767 match = match.substr(0,match.length - 5); 3768 } 3769 return renderS('<a href="{url}" target="_blank" class="messageDangerousUrl">{match}</a>'+suffix, { 3770 match: undoet(match), 3771 url: MobileAppBridge.isActive() && !MobileAppBridge.isV2Active() 3772 ? '/elearning/elearn/redirect?g='+encodeURIComponent(undoet(match)) 3773 : undoet(match) 3774 }); 3775 3776 }); 3777 ret = ret.replace(pseudoUrlPattern, function(match, p1, p2, p3) { 3778 var suffix = ''; 3779 if (p2 && p2.endsWith('"')) { 3780 suffix = '"'; 3781 p2 = p2.substr(0,p2.length - 5); 3782 } 3783 if (p2 && p2.endsWith('.')) { 3784 suffix = '.'+suffix; 3785 p2 = p2.substr(0,p2.length - 1); 3786 } 3787 return p1+renderS('<a href="http://{url}" target="_blank" class="messageDangerousUrl">{p2}</a>'+suffix+p3, { 3788 url: MobileAppBridge.isActive() && !MobileAppBridge.isV2Active() 3789 ? '/elearning/elearn/redirect?g='+encodeURIComponent('http://'+p2) 3790 : ''+p2, 3791 p2: p2 3792 }); 3793 });//'$1<a href="http://$2" target="_blank">$2</a>'); 3794 return ret; 3795} 3796 3797EdubarUtils.doGetCaretPosition = function(oField) { 3798 var iCaretPos = 0; 3799 if (oField.selectionStart || oField.selectionStart == '0') { 3800 iCaretPos = oField.selectionStart; 3801 } else 3802 if (window.getSelection) { 3803 sel = window.getSelection(); 3804 if (sel.rangeCount) { 3805 range = sel.getRangeAt(0);
3806 if (range.commonAncestorContainer.parentNode == oField) { 3807 iCaretPos = range.endOffset; 3808 } else if (range.commonAncestorContainer.parentNode && range.commonAncestorContainer.parentNode.parentNode == oField) { 3809 var parentText = $j(range.commonAncestorContainer.parentNode.parentNode).text(); 3810 var nodeText = $j(range.commonAncestorContainer.parentNode).text(); 3811 iCaretPos = range.endOffset + parentText.indexOf(nodeText); 3812 } else { 3813 iCaretPos = range.endOffset; 3814 } 3815 } 3816 } else if (document.selection) { 3817 oField.focus (); 3818 var oSel = document.selection.createRange (); 3819 oSel.moveStart ('character', -oField.value.length); 3820 iCaretPos = oSel.text.length; 3821 } 3822 return (iCaretPos); 3823} 3824EdubarUtils.doSetCaretPosition = function(oField, iCaretPos) { 3825 if (document.selection) { 3826 oField.focus (); 3827 var oSel = document.selection.createRange (); 3828 try { 3829 oSel.moveStart ('character', -oField.value.length); 3830 oSel.moveStart ('character', iCaretPos); 3831 oSel.moveEnd ('character', 0); 3832 oSel.select (); 3833 } catch (e) { 3834 3835 } 3836 } else if (oField.selectionStart || oField.selectionStart == '0') { 3837 oField.selectionStart = iCaretPos; 3838 oField.selectionEnd = iCaretPos; 3839 oField.focus (); 3840 } else if (oField.setSelectionRange) { 3841 oField.setSelectionRange(iCaretPos, iCaretPos); 3842 } else if (oField.createTextRange) { 3843 var range = oField.createTextRange(); 3844 range.collapse(true); 3845 range.moveEnd('character', iCaretPos); 3846 range.moveStart('character', iCaretPos); 3847 range.select(); 3848 } else if (window.getSelection) { 3849 var sel = window.getSelection(); 3850 try { 3851 sel.collapse(oField, iCaretPos); 3852 } catch (e) { 3853 3854 } 3855 } 3856} 3857 3858EdubarUtils.getSelectionTextInfo = function(el) { 3859 var atStart = false, atEnd = false; 3860 var selRange, testRange; 3861 if (window.getSelection) { 3862 var sel = window.getSelection(); 3863 if (sel.rangeCount) { 3864 selRange = sel.getRangeAt(0); 3865 testRange = selRange.cloneRange(); 3866 3867 testRange.selectNodeContents(el); 3868 testRange.setEnd(selRange.startContainer, selRange.startOffset); 3869 atStart = (testRange.toString() == ""); 3870 3871 testRange.selectNodeContents(el); 3872 testRange.setStart(selRange.endContainer, selRange.endOffset); 3873 atEnd = (testRange.toString() == "" || testRange.toString() == "\n"); 3874 } 3875 } else if (document.selection && document.selection.type != "Control") { 3876 selRange = document.selection.createRange(); 3877 testRange = selRange.duplicate(); 3878 3879 testRange.moveToElementText(el); 3880 testRange.setEndPoint("EndToStart", selRange); 3881 atStart = (testRange.text == ""); 3882 3883 testRange.moveToElementText(el); 3884 testRange.setEndPoint("StartToEnd", selRange); 3885 atEnd = (testRange.text == "" || testRange.text == "\n"); 3886 } 3887 3888 return { 3889 atStart : atStart, 3890 atEnd : atEnd 3891 }; 3892 3893} 3894EdubarUtils.mozePreskocit = function(oField,kam) { 3895 3896 var selStart = typeof oField.selectionStart == "number" && typeof oField.selectionEnd == "number" 3897 ? oField.selectionStart 3898 : this.doGetCaretPosition(oField); 3899 var selEnd = typeof oField.selectionStart == "number" && typeof oField.selectionEnd == "number" 3900 ? oField.selectionEnd 3901 : selStart; 3902 3903 var selInfo = this.getSelectionTextInfo(oField); 3904 var val = oField.value || oField.value === '' ? oField.value : $j(oField).text(); 3905 3906 if (oField.value || oField.value === '') { 3907 selInfo.atStart = selStart == 0; 3908 selInfo.atEnd = selEnd >= val.length; 3909 } 3910 3911 3912 3913 var moze = false; 3914 if (oField.tagName == 'INPUT' && $(oField).attr('type') == 'number') { 3915 if (kam == 'hore') moze = true; 3916 if (kam == 'dole') moze = true; 3917 } 3918 3919 if (kam == 'hore' && (/*(selStart == 0 && (selEnd == 0 || selEnd >= val.length))) ||*/ selInfo.atStart)) moze = true; 3920 if (kam == 'dole' && (/*((selStart == 0 || selStart >= val.length) && selEnd >= val.length) ||*/ selInfo.atEnd)) { 3921 moze = true 3922 } 3923 if (kam == 'dole' && selEnd >= val.length) moze = true; 3924 if (kam == 'dolava' && ((selStart == 0 && (selEnd == 0 || selEnd >= val.length)))) moze = true; 3925 if (kam == 'doprava' && (((selStart == 0 || selStart >= val.length) && selEnd >= val.length))) moze = true; 3926 if ($j(oField).hasClass('ui-autocomplete-input') && (kam == 'hore' || kam == 'dole')) { 3927 if (event && event.which == 13) { 3928 moze = true; 3929 } else if ($j(oField).data('ignorable_open') 3930 && (!$j(oField).data('is_open') || $j(oField).data('itemCount') <=1)) { 3931 3932 moze = true; 3933 } else if (kam == 'dole' && $j(oField).data('incoming_open') ) { 3934 moze = false; 3935 } else if ($j(oField).data('is_open')) { 3936 moze = false; 3937 } 3938 } 3939 if ($j(oField).hasClass('ui-autocomplete-input') && moze) { 3940 $j(oField).autocomplete('close'); 3941 } 3942 3943 return moze; 3944} 3945EdubarUtils.kurzorNaKoniec = function(oField){ 3946 oField.focus(); 3947 var val = oField.value ? oField.value : $j(oField).html(); 3948 if ($j(oField).attr('contenteditable')) { 3949 var contentEditableElement = $j(oField).get(0); 3950 if (document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+ 3951 { 3952 range = document.createRange(); 3953 //Create a range (a range is a like the selection but invisible) 3954 range.selectNodeContents(contentEditableElement); 3955 //Select the entire contents of the element with the range 3956 range.collapse(false); 3957 //collapse the range to the end point. false means collapse to end rather than the start 3958 selection = window.getSelection(); 3959 //get the selection object (allows you to change selection) 3960 selection.removeAllRanges(); 3961 //remove any selections already made 3962 selection.addRange(range); 3963 //make the range you have just created the visible selection 3964 } else if (document.selection)//IE 8 and lower 3965 { 3966 range = document.body.createTextRange(); 3967 //Create a range (a range is a like the selection but invisible) 3968 range.moveToElementText(contentEditableElement); 3969 //Select the entire contents of the element with the range 3970 range.collapse(false); 3971 //collapse the range to the end point. false means collapse to end rather than the start 3972 range.select(); 3973 //Select the range (make it the visible selection 3974 } 3975 3976 3977 } else { 3978 this.doSetCaretPosition(oField, val.length); 3979 } 3980} 3981EdubarUtils.kurzorNaZaciatok = function(oField) { 3982 oField.focus(); 3983 this.doSetCaretPosition(oField, 0); 3984} 3985 3986EdubarUtils.indexOf = function(arr, elt /*, from*/) { 3987 if (!arr) return -1; 3988 try { 3989 var len = arr.length >>> 0; 3990 3991 var from = Number(arguments[2]) || 0; 3992 from = (from < 0) ? Math.ceil(from) : Math.floor(from); 3993 if (from < 0) 3994 from += len; 3995 3996 for (; from < len; from++) { 3997 if (from in arr && arr[from] == elt) 3998 return from; 3999 } 4000 } catch (e) { 4001 return -1; 4002 } 4003 4004 return -1; 4005};
4006 4007EdubarUtils.jeZUS = function() { 4008 if (!edubar || !edubar.options || !edubar.options.school_type) return null; 4009 return edubar.options.school_type == '5'; 4010}; 4011EdubarUtils.jeSUS = function() { 4012 if (!edubar || !edubar.options || !edubar.options.school_type) return null; 4013 return edubar.options.school_type == '7'; 4014}; 4015 4016EdubarUtils.jeSportovyKlub = function() { 4017 if (!edubar || !edubar.options || !edubar.options.school_type) return null; 4018 return edubar.options.school_type == '14'; 4019}; 4020 4021EdubarUtils.getLoggedUser = function() { 4022 if (!edubar || !edubar.options || !edubar.options.loggedUser) return null; 4023 return edubar.options.loggedUser; 4024} 4025 4026EdubarUtils.isLoggedToPortal = function() { 4027 if (!edubar || !edubar.options || !edubar.options.loggedPortalid) return null; 4028 return edubar.options.loggedPortalid; 4029} 4030 4031 4032EdubarUtils.getLoggedUserName = function() { 4033 if (!edubar || !edubar.options || !edubar.options.loggedUserName) return null; 4034 return edubar.options.loggedUserName; 4035} 4036 4037 4038EdubarUtils.jeEdupagePro = function() { 4039 if (!edubar || !edubar.options || !edubar.options.jePro) return null; 4040 return edubar.options.jePro; 4041} 4042 4043EdubarUtils.getEdupage = function() { 4044 if (!edubar || !edubar.options || !edubar.options.edupage) return null; 4045 return edubar.options.edupage; 4046} 4047 4048EdubarUtils.isOrbit = function() { 4049 if (!edubar || !edubar.options || !edubar.options.isOrbit) return null; 4050 return edubar.options.isOrbit; 4051} 4052 4053 4054EdubarUtils.getSchoolCountry = function() { 4055 if (!edubar || !edubar.options || !edubar.options.school_country) return null; 4056 return edubar.options.school_country; 4057} 4058EdubarUtils.isRestrictedEdupage = function() { 4059 if (!edubar || !edubar.options || !edubar.options.isRestrictedEdupage) return false; 4060 return edubar.options.isRestrictedEdupage; 4061} 4062 4063 4064EdubarUtils.getSelectedSchoolYear = function() { 4065 if (!edubar || !edubar.options || !edubar.options.selectedYear) return null; 4066 return parseInt(edubar.options.selectedYear, 10); 4067} 4068 4069EdubarUtils.getUserType = function(userid) { 4070 if (!userid) userid = ''; 4071 if (userid.substr(0,6) == 'Ucitel') return 'Ucitel'; 4072 if (userid.substr(0,6) == 'Studen') return 'Student'; 4073 if (userid.substr(0,5) == 'Rodic') return 'Rodic'; 4074 if (userid.substr(0,5) == 'Admin') return 'Admin'; 4075 if (userid.substr(0,5) == 'Guest') return 'Guest'; 4076 return ''; 4077} 4078EdubarUtils.getLoggedUserType = function() { 4079 if (!edubar) return ''; 4080 if (!edubar.options._getLoggedUserType) { 4081 edubar.options._getLoggedUserType = this.getUserType(edubar.options.loggedUser); 4082 } 4083 return edubar.options._getLoggedUserType; 4084} 4085 4086EdubarUtils.isStudent = function() { 4087 if (!edubar || !edubar.options) return null 4088 if (edubar.options._isStudent === undefined) { 4089 edubar.options._isStudent = EdubarUtils.isStudent0(); 4090 } 4091 return edubar.options._isStudent; 4092} 4093EdubarUtils.isStudent0 = function () { 4094 if (this.getLoggedUserType() == 'Student') { 4095 return this.getLoggedUser().substr(7); 4096 } 4097 return null; 4098} 4099 4100EdubarUtils.isGuest = function() { 4101 if (!edubar || !edubar.options) return null 4102 if (edubar.options._isGuest === undefined) { 4103 edubar.options._isGuest = EdubarUtils.isGuest0(); 4104 } 4105 return edubar.options._isGuest; 4106} 4107 4108EdubarUtils.isGuest0 = function () { 4109 if (this.getLoggedUserType() == 'Guest') { 4110 return this.getLoggedUser().substr(5); 4111 } 4112 return null; 4113} 4114 4115 4116EdubarUtils.isStudentOrParent = function () { 4117 4118 if (EdubarUtils.isParent() && edubar && edubar.options.loggedChild) { 4119 return edubar.options.loggedChild; 4120 } 4121 return EdubarUtils.isStudent(); 4122} 4123 4124EdubarUtils.isParentChild = function () { 4125 4126 if (EdubarUtils.isParent() && edubar && edubar.options.loggedChild) { 4127 return edubar.options.loggedChild; 4128 } 4129 return null; 4130} 4131 4132 4133 4134EdubarUtils.isRodic = function () { 4135 if (!edubar || !edubar.options) return null 4136 if (edubar.options._isRodic === undefined) { 4137 edubar.options._isRodic = EdubarUtils.isRodic0(); 4138 } 4139 return edubar.options._isRodic; 4140} 4141EdubarUtils.isRodic0 = function () { 4142 if (this.getLoggedUserType() == 'Rodic') { 4143 return this.getLoggedUser().substr(5); 4144 } 4145 return null; 4146} 4147 4148EdubarUtils.isParent = function () { 4149 return EdubarUtils.isRodic(); 4150} 4151 4152EdubarUtils.isAdultStudent = function() { 4153 if (!EdubarUtils.isStudent()) return false; 4154 if (edubar && edubar.options && edubar.options.isAdult) return true; 4155 return false; 4156} 4157 4158EdubarUtils.isParentOrAdultStudent = function () { 4159 if (EdubarUtils.isParent()) { 4160 return EdubarUtils.isStudentOrParent(); 4161 } 4162 if (EdubarUtils.isAdultStudent()) { 4163 return EdubarUtils.isStudent(); 4164 } 4165 return null; 4166} 4167 4168 4169EdubarUtils.isUcitelInstruktorFirmaid = function () { 4170 if (!edubar || !edubar.options) return false 4171 if (edubar.options._isUcitel === undefined) { 4172 edubar.options._isUcitel = EdubarUtils.isUcitel0(); 4173 } 4174 if (!edubar.options._isUcitel) return false; 4175 return edubar.options.isUcitelInstruktorFirmaid || false; 4176} 4177 4178EdubarUtils.isUcitel = function () { 4179 if (!edubar || !edubar.options) return null 4180 if (edubar.options._isUcitel === undefined) { 4181 edubar.options._isUcitel = EdubarUtils.isUcitel0(); 4182 } 4183 return edubar.options._isUcitel; 4184} 4185 4186EdubarUtils.isUcitel0 = function () { 4187 if (this.getLoggedUserType() == 'Ucitel') { 4188 return this.getLoggedUser().substr(6); 4189 } 4190 return null; 4191} 4192 4193 4194EdubarUtils.isUcitelOrAdmin = function () { 4195 if (this.getLoggedUserType() == 'Admin') { 4196 return true; 4197 } 4198 if (this.getLoggedUserType() == 'Ucitel') { 4199 return true; 4200 } 4201 return null; 4202} 4203 4204 4205EdubarUtils.isAdmin = function () { 4206 if (this.getLoggedUserType() == 'Admin') { 4207 return true; 4208 } 4209 return false; 4210} 4211 4212EdubarUtils.isWebpageAdmin = function () { 4213 if (EdubarUtils.isAdmin()) return true; 4214 if (edubar && edubar.options.webpageadmin) return true; 4215 return false; 4216} 4217 4218 4219EdubarUtils.hasUserRight = function (right) { 4220 if (EdubarUtils.isAdmin()) return true; 4221 if (edubar && edubar.options.userrights && edubar.options.userrights[right]) return true; 4222 return false; 4223} 4224 4225EdubarUtils.getVyucovacieDni = function() { 4226 if (edubar && edubar.options.vyucovacieDni) return edubar.options.vyucovacieDni; 4227 return [false, true, true, true, true, true, false]; 4228} 4229 4230 4231EdubarUtils.formatTimeDiff = function(time, options) { 4232 var r = Math.floor(time/1000); 4233 var d = Math.floor(r/(24*3600)); 4234 r = r-d*(24*3600); 4235 var h = Math.floor(r/3600); 4236 r = r-h*3600; 4237 var m = Math.floor((r)/60); 4238 r = r-m*60; 4239 var s = Math.floor(r); 4240 4241 var ret = ''; 4242 4243 if (d>0) { 4244 4245 //ret += d.toString() + ' '+ls(1465).substr(0,1)+' '; 4246 4247 if (options && options.short) { 4248 return ret; 4249 } 4250 4251 if (h>16) d++; 4252 return d.toString() + ' '+ls(1465).substr(0,1); 4253 /*if (d == 1) 4254 4255 else if (d <= 4) 4256 ret += d.toString() + ' dni '; 4257 else 4258 ret += d.toString() + ' dnà ';*/ 4259 } 4260 if (h >= 2) { 4261 if (m>=45) h++; 4262 return ASC.lsf(3147, { n: h }) 4263 } 4264 if (h>0 && (options && options.short)) { 4265 ret += (h<10 ? '0' : '')+h.toString()+':'; 4266 return h+' '+ls(9465).substr(0,1)+' '+m+' '+ls(3888).substr(0,1); 4267 } 4268 4269 if (h>0) { 4270 ret += (h<10 ? '0' : '')+h.toString()+':'; 4271 } 4272 ret += (m<10 ? '0' : '')+m.toString(); 4273 4274 if (h == 0 || !(options && options.short) ) { 4275 ret += ':'+(s<10 ? '0' : '')+s.toString(); 4276 } 4277 return ret; 4278} 4279 4280EdubarUtils.showAlert = function(msg) { 4281 var thisObj = this; 4282 var s = ''; 4283 s += '<div class="edubarAlertBox">'; 4284 s += msg; 4285 s += '</div>'; 4286 4287 $j(s).appendTo('body').fadeIn(300).delay(10000).fadeOut(300, function(){ 4288 $j(this).remove(); 4289 }); 4290}; 4291 4292EdubarUtils.getLang = function() { 4293 if (edubar && edubar.options && edubar.options.lang) return edubar.options.lang; 4294 if (!EdubarUtils._lang) EdubarUtils._lang = $('html').attr('data-lang'); 4295 if (EdubarUtils._lang) return EdubarUtils._lang; 4296 4297 return 'en'; 4298} 4299 4300EdubarUtils.hexToRGB = function(hex) { 4301 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 4302 return result ? { 4303 r: parseInt(result[1], 16), 4304 g: parseInt(result[2], 16), 4305 b: parseInt(result[3], 16) 4306 } : null; 4307} 4308 4309EdubarUtils.sortObject = function(obj, fields) { 4310 var ret = []; 4311 if (fields && fields == 'byKey') { 4312 for (var id in obj) {
4313 ret.push({key: id, val: obj[id]}); 4314 } 4315 ret.sort(function(a,b) { 4316 var ak = a.key.toString(); 4317 var bk = b.key.toString(); 4318 return ak.localeCompare(bk); 4319 }); 4320 } else { 4321 if ($.isArray(obj)) { 4322 ret = obj; 4323 } else { 4324 for (var id in obj) { 4325 ret.push(obj[id]); 4326 } 4327 } 4328 4329 4330 if (typeof fields == 'function') { 4331 ret.sort(fields); 4332 } else { 4333 ret.sort(function(a,b) { 4334 if (!fields) { 4335 4336 return (a || "").localeCompare(b || ""); 4337 } 4338 4339 for (var i=0;i<fields.length;i++) { 4340 var f = fields[i]; 4341 var desc = false; 4342 if (f.substr(0,1) == '-') { 4343 f = f.substr(1); 4344 desc = true; 4345 } 4346 var aval = a && a[f] ? a[f] : ''; 4347 var bval = b && b[f] ? b[f] : ''; 4348 4349 var cmp = 0; 4350 if (!isNaN(parseFloat(aval)) && isFinite(aval) 4351 && !isNaN(parseFloat(bval)) && isFinite(bval)) { 4352 if (parseFloat(aval) > parseFloat(bval)) { 4353 cmp = 1; 4354 } else if (parseFloat(aval) < parseFloat(bval)) { 4355 cmp = -1; 4356 } 4357 } else { 4358 aval = aval.toString(); 4359 bval = bval.toString(); 4360 cmp = aval.localeCompare(bval); 4361 } 4362 4363 if (desc) { 4364 cmp = cmp*-1; 4365 } 4366 if (cmp != 0) return cmp; 4367 } 4368 return 0; 4369 }); 4370 } 4371 } 4372 return ret; 4373} 4374 4375EdubarUtils.getObjectKeys = function(obj) { 4376 if (!obj) return []; 4377 var ret = []; 4378 for (var k in obj) { 4379 ret.push(k); 4380 } 4381 return ret; 4382} 4383 4384 4385EdubarUtils.isEmptyObject = function(obj) { 4386 var poc = 0; 4387 for (var id in obj) { 4388 poc++; 4389 break 4390 } 4391 return poc == 0; 4392} 4393 4394EdubarUtils.countObject = function(obj) { 4395 var poc = 0; 4396 for (var id in obj) { 4397 poc++; 4398 } 4399 return poc; 4400} 4401 4402EdubarUtils.arrayToObject = function(arr) { 4403 var obj = {}; 4404 for (var i=0;i<arr.length;i++) { 4405 obj[i] = arr[i]; 4406 } 4407 return obj; 4408} 4409 4410EdubarUtils._isEqualLastPath = ''; 4411EdubarUtils.isEqual = function(x,y, ignore, path) { 4412 EdubarUtils._isEqualLastPath = path; 4413 if (x === y) return true; 4414 // if both x and y are null or undefined and exactly the same 4415 4416 if (ignore && ignore.numbersAsStrings 4417 && (typeof x == 'string' || typeof x == 'number') 4418 && (typeof y == 'string' || typeof y == 'number')) { 4419 4420 if (x.toString() == y.toString()) return true; 4421 } 4422 4423 if (!( x instanceof Object ) || !( y instanceof Object )) return false; 4424 // if they are not strictly equal, they both need to be Objects 4425 4426 if (ignore && ignore.objectArrays && $j.isArray(x) != $j.isArray(y)) { 4427 x = $j.isArray(x) ? EdubarUtils.arrayToObject(x) : x; 4428 y = $j.isArray(y) ? EdubarUtils.arrayToObject(y) : y; 4429 } 4430 4431 if (x.constructor !== y.constructor) { 4432 return false; 4433 } 4434 // they must have the exact same prototype chain, the closest we can do is 4435 // test there constructor. 4436 if ($j.isArray(x) != $j.isArray(y)) { 4437 return false; 4438 } 4439 if ($j.isArray(x)) { 4440 if (x.length != y.length) { 4441 return false; 4442 } 4443 4444 for (var i=0;i<x.length;i++) { 4445 if (! EdubarUtils.isEqual(x[i], y[i], ignore, (path || "")+'/'+i.toString())) { 4446 return false; 4447 } 4448 } 4449 return true; 4450 } 4451 4452 for (var p in x ) { 4453 4454 if (! x.hasOwnProperty(p)) { 4455 continue; 4456 } 4457 if (ignore && ignore[p]) continue; 4458 // other properties were tested using x.constructor === y.constructor 4459 4460 if (! y.hasOwnProperty(p)) { 4461 4462 return false; 4463 } 4464 // allows to compare x[ p ] and y[ p ] when set to undefined 4465 4466 if (x[p] === y[p]) 4467 continue; 4468 // if they have the same strict value or identity then they are equal 4469 4470 if ( typeof (x[p] ) !== "object") { 4471 4472 return false; 4473 } 4474 // Numbers, Strings, Functions, Booleans must be strictly equal 4475 4476 if (! EdubarUtils.isEqual(x[p], y[p], ignore, (path || "")+'/'+p.toString())) { 4477 4478 return false; 4479 } 4480 // Objects and Arrays must be tested recursively 4481 } 4482 4483 for (p in y ) { 4484 if (ignore && ignore[p]) continue; 4485 if (y.hasOwnProperty(p) && ! x.hasOwnProperty(p)) { 4486 4487 return false; 4488 } 4489 // allows x[ p ] to be set to undefined 4490 } 4491 return true; 4492 4493} 4494 4495EdubarUtils.getVideoLink = function(id) { 4496 var lang = edubar && edubar.options.lang ? edubar.options.lang : 'en'; 4497 if (lang == 'sk' || lang == 'cz') { 4498 if (id == '11_preparations') return 'http://www.triednakniha.sk/#!/videos/241'; 4499 if (id == '12_preparations_withstudent') return 'http://www.triednakniha.sk/#!/videos/242'; 4500 if (id == '03_teachingplans') return 'http://www.triednakniha.sk/#!/videos/5'; 4501 if (id == '13_elearning_test') return 'http://www.triednakniha.sk/#!/videos/202'; 4502 return 'http://triednakniha.sk/video'; 4503 } else if (lang == 'de') { 4504 if (id == '11_preparations') return 'http://klassenbuch.edupage.org/#!/videos/222'; 4505 if (id == '12_preparations_withstudent') return 'http://klassenbuch.edupage.org/#!/videos/223'; 4506 if (id == '03_teachingplans') return 'http://klassenbuch.edupage.org/#!/videos/10'; 4507 if (id == '13_elearning_test') return 'http://klassenbuch.edupage.org/#!/videos/224'; 4508 return 'http://klassenbuch.edupage.org/video'; 4509 } else { 4510 if (id == '11_preparations') return 'http://classregister.edupage.org/#!/videos/231'; 4511 if (id == '12_preparations_withstudent') return 'http://classregister.edupage.org/#!/videos/232'; 4512 if (id == '03_teachingplans') return 'http://classregister.edupage.org/#!/videos/120'; 4513 if (id == '13_elearning_test') return 'http://classregister.edupage.org/#!/videos/233'; 4514 } 4515 return 'http://classregister.edupage.org/video'; 4516} 4517 4518 4519EdubarUtils.hexToRgba = function(hex, opacity) { 4520 var c = EdubarUtils.hexToRgb(hex); 4521 return renderS('rgba({c.r},{c.g},{c.b},{a})', { 4522 c: c, 4523 a: (opacity*1).toFixed(2) 4524 }); 4525} 4526 4527EdubarUtils.hexToRgb = function(hex) { 4528 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 4529 return result ? { 4530 r: parseInt(result[1], 16), 4531 g: parseInt(result[2], 16), 4532 b: parseInt(result[3], 16) 4533 } : null; 4534};
4535EdubarUtils.componentToHex = function(c) { 4536 var hex = Math.min(255,Math.max(0,Math.round(c))).toString(16); 4537 return hex.length == 1 ? "0" + hex : hex; 4538}; 4539EdubarUtils.rgbToHex = function(r, g, b) { 4540 return "#" + this.componentToHex(r) + this.componentToHex(g) + this.componentToHex(b); 4541}; 4542EdubarUtils.mergeColors = function(color1,color2, pos) { 4543 if (color1 == '') { 4544 if (color2 == '') 4545 return '#ffffff'; 4546 return color1; 4547 } 4548 4549 var rgb1 = this.hexToRgb(color1); 4550 var rgb2 = this.hexToRgb(color2); 4551 if (!rgb1 || !rgb2) { 4552 return color1; 4553 } 4554 4555 var r = Math.max(0,Math.min(255,Math.round((rgb1.r*(1-pos)+rgb2.r*pos)))); 4556 var g = Math.max(0,Math.min(255,Math.round((rgb1.g*(1-pos)+rgb2.g*pos)))); 4557 var b = Math.max(0,Math.min(255,Math.round((rgb1.b*(1-pos)+rgb2.b*pos)))); 4558 return this.rgbToHex(r,g,b); 4559} 4560 4561EdubarUtils.hsv2rgb = function(h, s, v) { 4562 var rgb, i, data = []; 4563 if (s === 0) { 4564 rgb = [v,v,v]; 4565 } else { 4566 h = h / 60; 4567 i = Math.floor(h); 4568 data = [v*(1-s), v*(1-s*(h-i)), v*(1-s*(1-(h-i)))]; 4569 switch(i) { 4570 case 0: 4571 rgb = [v, data[2], data[0]]; 4572 break; 4573 case 1: 4574 rgb = [data[1], v, data[0]]; 4575 break; 4576 case 2: 4577 rgb = [data[0], v, data[2]]; 4578 break; 4579 case 3: 4580 rgb = [data[0], data[1], v]; 4581 break; 4582 case 4: 4583 rgb = [data[2], data[0], v]; 4584 break; 4585 default: 4586 rgb = [v, data[0], data[1]]; 4587 break; 4588 } 4589 } 4590 return '#' + rgb.map(function(x){ 4591 return ("0" + Math.round(x*255).toString(16)).slice(-2); 4592 }).join(''); 4593}; 4594 4595EdubarUtils.rgb2hsv = function(r, g, b) { 4596 var rr, gg, bb, 4597 r = r / 255, 4598 g = g / 255, 4599 b = b / 255, 4600 h, s, 4601 v = Math.max(r, g, b), 4602 diff = v - Math.min(r, g, b), 4603 diffc = function(c){ 4604 return (v - c) / 6 / diff + 1 / 2; 4605 }; 4606 4607 if (diff == 0) { 4608 h = s = 0; 4609 } else { 4610 s = diff / v; 4611 rr = diffc(r); 4612 gg = diffc(g); 4613 bb = diffc(b); 4614 4615 if (r === v) { 4616 h = bb - gg; 4617 }else if (g === v) { 4618 h = (1 / 3) + rr - bb; 4619 }else if (b === v) { 4620 h = (2 / 3) + gg - rr; 4621 } 4622 if (h < 0) { 4623 h += 1; 4624 }else if (h > 1) { 4625 h -= 1; 4626 } 4627 } 4628 return { 4629 h: Math.round(h * 360), 4630 s: Math.round(s * 100), 4631 v: Math.round(v * 100) 4632 }; 4633} 4634 4635EdubarUtils.rgbToHsl = function(r, g, b){ 4636 r /= 255, g /= 255, b /= 255; 4637 var max = Math.max(r, g, b), min = Math.min(r, g, b); 4638 var h, s, l = (max + min) / 2; 4639 4640 if(max == min){ 4641 h = s = 0; // achromatic 4642 }else{ 4643 var d = max - min; 4644 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 4645 switch(max){ 4646 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 4647 case g: h = (b - r) / d + 2; break; 4648 case b: h = (r - g) / d + 4; break; 4649 } 4650 h /= 6; 4651 } 4652 4653 return {h: h, s: s, l:l}; 4654} 4655 4656EdubarUtils.hslToRgb = function(h, s, l){ 4657 var r, g, b; 4658 4659 if(s == 0){ 4660 r = g = b = l; // achromatic 4661 } else { 4662 function hue2rgb(p, q, t){ 4663 if(t < 0) t += 1; 4664 if(t > 1) t -= 1; 4665 if(t < 1/6) return p + (q - p) * 6 * t; 4666 if(t < 1/2) return q; 4667 if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; 4668 return p; 4669 } 4670 4671 var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 4672 var p = 2 * l - q; 4673 r = hue2rgb(p, q, h + 1/3); 4674 g = hue2rgb(p, q, h); 4675 b = hue2rgb(p, q, h - 1/3); 4676 } 4677 4678 return {r:r * 255, g: g * 255, b: b * 255}; 4679} 4680 4681EdubarUtils.adjustBrightness = function(color, vall, vals) { 4682 var rgb = this.hexToRgb(color); 4683 if (!rgb) return color; 4684 4685 var hsl = this.rgbToHsl(rgb.r, rgb.g, rgb.b); 4686 if (vall) hsl.l = hsl.l*vall; 4687 if (vals) hsl.s = hsl.s*vals; 4688 rgb = this.hslToRgb(hsl.h, hsl.s, hsl.l); 4689 return this.rgbToHex(rgb.r, rgb.g, rgb.b); 4690 //return this.hsv2rgb(hsv.h, hsv.s, hsv.v); 4691} 4692 4693 4694EdubarUtils.setBrightness = function(color, vall, vals) { 4695 var rgb = this.hexToRgb(color); 4696 if (!rgb) return color; 4697 4698 var hsl = this.rgbToHsl(rgb.r, rgb.g, rgb.b); 4699 if (vall) hsl.l = vall; 4700 if (vals) hsl.s = vals; 4701 rgb = this.hslToRgb(hsl.h, hsl.s, hsl.l); 4702 return this.rgbToHex(rgb.r, rgb.g, rgb.b); 4703} 4704 4705EdubarUtils.getQueryParameters = function(url) { 4706 var pom = url.toString().split('#'); 4707 url = pom[0]; 4708 var pos = url.indexOf('?'); 4709 var script = pos == -1 ? url : url.substr(0,pos); 4710 4711 var ret = {}; 4712 var regExp = new RegExp('^(http.?://[^/]*)?/([^/]*)/.*$','gi'); 4713 var moduleParams = regExp.exec(script); 4714 ret.module = moduleParams ? moduleParams[2] : ''; 4715 ret.params = {}; 4716 4717 var query = pos == -1 ? '' : url.substr(pos+1); 4718 var a = query.split('&'); 4719 4720 if (a == "") return ret; 4721 4722 var b = {}; 4723 try { 4724 b = EdubarUtils.parseQueryParams(query); 4725 } catch (e) { 4726 b = {}; 4727 } 4728 4729 ret.params = b; 4730 return ret; 4731} 4732 4733EdubarUtils.parseQueryParams = function(query) { 4734 var a = query.split('&'); 4735 4736 var b = {}; 4737 for (var i = 0; i < a.length; ++i) 4738 { 4739 var p=a[i].split('='); 4740 if (p.length < 2) { 4741 b[p[0]] = ''; 4742 } else 4743 if (p[0] == 'eqa') { 4744 var b2 = {}; 4745 try { 4746 b2 = EdubarUtils.parseQueryParams(Base64.decode(decodeURIComponent(p[1].replace(/\+/g, " ")))
4746); 4747 } catch (e) { 4748 b2 = {}; 4749 } 4750 for (var x in b2) { 4751 b[x] = b2[x]; 4752 } 4753 } else { 4754 b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " ")); 4755 } 4756 } 4757 4758 return b; 4759} 4760 4761EdubarUtils.nl2br = function(str, is_xhtml) { 4762 var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br ' + '/>' : '<br>'; 4763 return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2'); 4764} 4765 4766EdubarUtils.kompetenceV2Enabled = function() { 4767 if (EdubarUtils.getSchoolCountry() == 'co') return false; 4768 return true; 4769 //return EdubarUtils.getSchoolCountry() == 'sk' || EdubarUtils.indexOf(['ascgreenfield','ascfuture','greenlearn','cslewis','asckompetencie','schillertest2','angerschule-leipzig'],EdubarUtils.getEdupage())>=0; 4770} 4771 4772EdubarUtils.getZnamkyPohladBtn = function(pohlad, triedaid, predmetid, planid, obdobie, options) { 4773 if (!options) options = {}; 4774 if (!planid) planid = ''; 4775 if (!obdobie) obdobie = ''; 4776 var cestaEnabled = true;//edubar && (edubar.options.server == 'edupage15' || edubar.options.edupage == 'ascgreenfield'); 4777 var osnovaEnabled = true;//edubar && (edubar.options.edupage == 'ascgreenfield' || edubar.options.server == 'edupage15'); 4778 var s = ''; 4779 4780 s += '<span class="dropDownBtn pohladDropDownBtn znamkySidePohladDropDown" style="display:block;">'; 4781 4782 var items = []; 4783 if (EdubarUtils.isAdmin()) { 4784 if (pohlad=='kurz' || pohlad=='plan') { 4785 items.push({ 4786 'id': 'kurz', 4787 'img': '/plany/pics/icons/pohlad_kurz.png', 4788 'url': '/plany/?pohlad=kurz&planid='+planid+'&triedaid='+triedaid+'&predmetid='+predmetid, 4789 'name': ls(3891) 4790 }); 4791 items.push({ 4792 'id': 'plan', 4793 'img': '/plany/pics/icons/pohlad_plan.png', 4794 'url': '/plany/?pohlad=plan&planid='+planid+'&triedaid='+triedaid+'&predmetid='+predmetid, 4795 'name': ls(3662) 4796 }); 4797 } else { 4798 items.push({ 4799 'id': 'uvod', 4800 'img': '/znamky/pics/znamky_intro.svg', 4801 'url': '/znamky/', 4802 'name': ls(3976) 4803 }); 4804 items.push({ 4805 'id': 'znamky', 4806 'img': '/znamky/pics/znamky_filled.svg', 4807 'url': '/znamky/?what=zobraztriedu&p='+(predmetid)+'&t='+(triedaid), 4808 'name': ls(1131) 4809 }); 4810 items.push({ 4811 'id': 'poznamky', 4812 'img': '/global/pics/ui/note_32.png', 4813 'url': '/znamky/?what=PoznamkyTriedy&triedaid='+triedaid+'&predmetid=', 4814 'name': ls(4829) 4815 }); 4816 /*items.push({ 4817 'id': 'poznamky', 4818 'img': '/global/pics/ui/note_32.png', 4819 'url': '/znamky/?what=PoznamkyTriedy&version=1&triedaid='+triedaid+'&predmetid=', 4820 'name': ls(4829)+' - new' 4821 });*/ 4822 4823 if (cestaEnabled) { 4824 items.push({ 4825 'id': 'cesta', 4826 'img': '/znamky/pics/znamkycesta.svg', 4827 'url': '/znamky/?what=ZnamkyCestaTrieda&triedaid='+triedaid+'&predmetid='+predmetid+'&obdobie='+obdobie, 4828 'name': ls(4910) 4829 }); 4830 } 4831 4832 if (EdubarUtils.kompetenceV2Enabled()) { 4833 items.push({ 4834 'id': 'kompetenciev2', 4835 'img': '/znamky/pics/kompetencie.svg', 4836 'url': '/znamky/?what=Kompetencie&triedaid='+triedaid+'&predmetid='+predmetid+(true ? '&planid='+planid : ''), 4837 'name': ls(4224)+'' 4838 }); 4839 } else { 4840 items.push({ 4841 'id': 'kompetencie', 4842 'img': '/znamky/pics/kompetencie.svg', 4843 'url': '/znamky/?what=KompetencieManager', 4844 'name': ls(4224) 4845 }); 4846 } 4847 4848 4849 if ((edubar && edubar.options.school_country == 'il') || (edubar && edubar.options.useZnamkyExams)) { 4850 items.push({ 4851 'id': 'znamkyexam', 4852 'img': '/znamky/pics/znamkyexam.svg', 4853 'url': '/znamky/?what=ZnamkyExams&t='+triedaid+'&p='+predmetid+(planid ? '&planid='+planid : ''), 4854 'name': (edubar && edubar.options.school_country == 'sk') ? ls(1010) : ls(9710) 4855 }); 4856 } 4857 4858 if (EdubarUtils.indexOf(['sk','cz','de','at','ch'],EdubarUtils.getSchoolCountry())>=0 4859 || EdubarUtils.indexOf(['novigrad','angerschule-leipzig','schillertest2'],EdubarUtils.getEdupage())>=0) { 4860 items.push({ 4861 'id': 'komisionalneskusky',
4862 'img': '/znamky/pics/icons/komisionalnaskuska2.svg', 4863 'url': '/skd/?cmd=KomisionalneSkusky&mod=grades&triedaid='+(triedaid || "")+'&predmetid='+(predmetid || "")+'&obdobie='+(obdobie || "")+(planid ? '&planid='+planid : ''), 4864 'name': ls(12082) 4865 }); 4866 } 4867 4868 if (true || EdubarUtils.indexOf(['sk','cz','de','at','ch'],EdubarUtils.getSchoolCountry())>=0) { 4869 items.push({ 4870 'id': 'verbeval', 4871 'img': '/znamky/pics/verbeval.svg', 4872 'url': '/znamky/?what=VerbalEvaluation&triedaid='+(triedaid || "")+'&predmetid='+(predmetid || "")+'&obdobie='+(obdobie || "")+('&planid='+planid), 4873 'name': ls(9867) 4874 }); 4875 } 4876 4877 if (EdubarUtils.getSchoolCountry() != 'co' /*|| EdubarUtils.indexOf(['sk','cz','de','at','ch','ke'],EdubarUtils.getSchoolCountry())>=0*/) { 4878 items.push({ 4879 'id': 'classificationreports', 4880 'img': '/znamky/pics/klasifporady.svg', 4881 'url': '/znamky/?what=ClassificationReports&mod=znamky&triedaid='+(triedaid || "")+'&predmetid='+(predmetid || "")+'&obdobie='+(obdobie || "")+(planid ? '&planid='+planid : ''), 4882 'name': ls(12956) 4883 }); 4884 } 4885 4886 if (EdubarUtils.getSchoolCountry() != 'co' /*|| EdubarUtils.indexOf(['sk','cz','de','at','ch','ke'],EdubarUtils.getSchoolCountry())>=0*/) { 4887 items.push({ 4888 'id': 'certificates', 4889 'img': '/znamky/pics/vysvedcenia.svg', 4890 'url': '/znamky/?what=Certificates&triedaid='+(triedaid || "")+'&predmetid='+(predmetid || "")+'&obdobie='+(obdobie || "")+(planid ? '&planid='+planid : ''), 4891 'name': ls(12110) 4892 }); 4893 } 4894 4895 if (osnovaEnabled) { 4896 items.push({ 4897 'id': 'osnova', 4898 'img': '/znamky/pics/user_rights.svg', 4899 'url': '/znamky/?what=OsnovaHodin', 4900 'name': ls(6010) 4901 }); 4902 } 4903 } 4904 4905 } else { 4906 items.push({ 4907 'id': 'znamky', 4908 'img': '/znamky/pics/znamky_filled.svg', 4909 'url': '/znamky/?what=zobraztriedu&p='+(predmetid)+'&t='+(triedaid)+'&planid='+planid, 4910 'name': ls(1131) 4911 }); 4912 items.push({ 4913 'id': 'poznamky', 4914 'img': '/global/pics/ui/note_32.png', 4915 'url': '/znamky/?what=PoznamkyTriedy&triedaid='+triedaid+'&predmetid='+'&planid='+planid, 4916 'name': ls(4829) 4917 }); 4918 4919 /*items.push({ 4920 'id': 'poznamky', 4921 'img': '/global/pics/ui/note_32.png', 4922 'url': '/znamky/?what=PoznamkyTriedy&version=1&triedaid='+triedaid+'&predmetid='+'&planid='+planid, 4923 'name': ls(4829)+' - old' 4924 });*/ 4925 4926 if (cestaEnabled) { 4927 items.push({ 4928 'id': 'cesta', 4929 'img': '/znamky/pics/znamkycesta.svg', 4930 'url': '/znamky/?what=ZnamkyCestaTrieda&triedaid='+triedaid+'&predmetid='+predmetid+'&obdobie='+obdobie+'&planid='+planid, 4931 'name': ls(4910) 4932 }); 4933 } 4934 4935 if (EdubarUtils.kompetenceV2Enabled()) { 4936 items.push({ 4937 'id': 'kompetenciev2', 4938 'img': '/znamky/pics/kompetencie.svg', 4939 'url': '/znamky/?what=Kompetencie&triedaid='+triedaid+'&predmetid='+predmetid+(true ? '&planid='+planid : ''), 4940 'name': ls(4224)+'' 4941 }); 4942 } else { 4943 items.push({ 4944 'id': 'kompetencie', 4945 'img': '/znamky/pics/kompetencie.svg', 4946 'url': '/znamky/?what=kompetencie&t='+triedaid+'&p='+predmetid+(planid ? '&planid='+planid : ''), 4947 'name': ls(4224) 4948 }); 4949 } 4950 4951 if ((edubar && edubar.options.school_country == 'il') || (edubar && edubar.options.useZnamkyExams)) { 4952 items.push({ 4953 'id': 'znamkyexam', 4954 'img': '/znamky/pics/znamkyexam.svg', 4955 'url': '/znamky/?what=ZnamkyExams&t='+triedaid+'&p='+predmetid+(planid ? '&planid='+planid : ''), 4956 'name': (edubar && edubar.options.school_country == 'sk') ? ls(1010) : ls(9710) 4957 }); 4958 } 4959 4960 if (EdubarUtils.indexOf(['sk','cz','de','at','ch'],EdubarUtils.getSchoolCountry())>=0 4961 || EdubarUtils.indexOf(['novigrad','angerschule-leipzig','schillertest2'],EdubarUtils.getEdupage())>=0) { 4962 items.push({ 4963 'id': 'komisionalneskusky', 4964 'img': '/znamky/pics/icons/komisionalnaskuska2.svg', 4965 'url': '/skd/?cmd=KomisionalneSkusky&mod=grades&triedaid='+(triedaid || "")+'&predmetid='+(predmetid || "")+'&obdobie='+(obdobie || "")+(planid ? '&planid='+planid : ''), 4966 'name': ls(12082) 4967 }); 4968 } 4969 4970 if (true || EdubarUtils.indexOf(['sk','cz','de','at','ch'],EdubarUtils.getSchoolCountry())>=0) { 4971 items.push({ 4972 'id': 'verbeval', 4973 'img': '/znamky/pics/verbeval.svg', 4974 'url': '/znamky/?what=VerbalEvaluation&triedaid='+(triedaid || "")+'&predmetid='+(predmetid || "")+'&obdobie='+(obdobie || "")+('&planid='+planid), 4975 'name': ls(9867) 4976 }); 4977 } 4978 4979 if (EdubarUtils.getSchoolCountry() != 'co' /*|| EdubarUtils.indexOf(['sk','cz','de','at','ch','ke'],EdubarUtils.getSchoolCountry())>=0*/) { 4980 items.push({ 4981 'id': 'classificationreports', 4982 'img': '/znamky/pics/klasifporady.svg', 4983 'url': '/znamky/?what=ClassificationReports&mod=znamky&triedaid='+(triedaid || "")+'&predmetid='+(predmetid || "")+'&obdobie='+(obdobie || "")+(planid ? '&planid='+planid : ''), 4984 'name': ls(12956) 4985 }); 4986 } 4987 4988 if (EdubarUtils.getSchoolCountry() != 'co'/*EdubarUtils.indexOf(['sk','cz','de','at','ch'],EdubarUtils.getSchoolCountry())>=0*/) { 4989 items.push({ 4990 'id': 'certificates', 4991 'img': '/znamky/pics/vysvedcenia.svg', 4992 'url': '/znamky/?what=Certificates&triedaid='+(triedaid || "")+'&predmetid='+(predmetid || "")+'&obdobie='+(obdobie || "")+(planid ? '&planid='+planid : ''), 4993 'name': ls(12110) 4994 }); 4995 } 4996 4997 4998 4999 if (!(edubar && edubar.options.ecourseenabled)) { 5000 items.push({ 5001 'id': 'kurz', 5002 'img': '/plany/pics/icons/pohlad_kurz.png',
5003 'url': '/plany/?pohlad=kurz&planid='+planid+'&triedaid='+triedaid+'&predmetid='+predmetid, 5004 'name': ls(3891) 5005 }); 5006 items.push({ 5007 'id': 'plan', 5008 'img': '/plany/pics/icons/pohlad_plan.png', 5009 'url': '/plany/?planid='+planid+'&triedaid='+triedaid+'&predmetid='+predmetid, 5010 'name': ls(3662) 5011 }); 5012 items.push({ 5013 'id': 'homeworks', 5014 'img': '/elearning/pics/moje.png', 5015 'url': '/exam/?cmd=HomeworkList&planid='+planid+'&triedaid='+triedaid+'&predmetid='+predmetid, 5016 'name': ls(1312) 5017 }); 5018 } 5019 } 5020 5021 var ss = '<ul class="dropDownPanel znamkyPohladPanel" style="white-space:nowrap">'; 5022 for (var i=0;i<items.length;i++) { 5023 var item = items[i]; 5024 if (pohlad == item.id) { 5025 var pom = item.name.split(' '); 5026 var pom2 = item.name.split('/'); 5027 if (options.ecourseMode) { 5028 s += '<a class="ribbon-button ribbon-button-large alwaysEnabled" style="overflow:hidden;white-space:nowrap;;display:block;">'; 5029 // 5030 5031 //s += '<span class="button-title" style="padding-right:10px;'+et(pom.length==1 && pom2.length==1 ? 'margin-top:7px;' : '')+'">'; 5032 //s += '<img style="width: 25px;height:25px;margin:0;margin-right:10px;vertical-align:top;" src="'+et(item.img)+'" alt="">'; 5033 s += '<div style="font-size:10px;opacity:0.7;">'+lset(4462)+':</div>'; 5034 s += '<span style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:16px;display:inline-block;vertical-align: middle;font-weight:bold">'; 5035 5036 s += et(item.name); 5037 s += '</span>'; 5038 s += '</a>'; 5039 } else { 5040 s += '<a class="ribbon-button ribbon-button-large alwaysEnabled" style="overflow:hidden;">'; 5041 s += '<img class="ribbon-icon ribbon-normal" src="'+et(item.img)+'" alt="">'; 5042 s += '<span class="button-title" style="padding-right:10px;'+et(pom.length==1 && pom2.length==1 ? 'margin-top:7px;' : '')+'">'; 5043 s += et(item.name).naDvaRiadky(); 5044 s += '</span>'; 5045 s += '</a>'; 5046 } 5047 } 5048 5049 ss += '<li class="'+et(pohlad == item.id ? 'marked' : '')+'">'; 5050 ss += '<a href="'+et(barEncLink(item.url))+'" class="edubarSmartLink">'; 5051 if (options.ecourseMode) { 5052 ss += '<img src="'+et(item.img)+'" alt="" style="width: 25px;height:25px; margin-left: -8px;margin-right: 8px;">'; 5053 } else { 5054 ss += '<img src="'+et(item.img)+'" alt="">'; 5055 } 5056 ss += et(item.name); 5057 ss += '</a>'; 5058 ss += '</li>'; 5059 } 5060 5061 5062 if (EdubarUtils.isAdmin()) { 5063 ss += '<hr style="margin:1px 0">'; 5064 ss += '<li>'; 5065 ss += '<a onclick="barNewDialog({\'title\': ls(1637),\'source\': \'/znamky/?jwgc=ZnamkyAdminSettings\',close: function() {barSmartReloadPage()}});">'; 5066 ss += '<img src="/global/pics/ui/settings_32.png" alt="">'; 5067 ss += et(ls(3409)); 5068 ss += '</a>'; 5069 ss += '</li>'; 5070 } 5071 ss += '</ul>'; 5072 5073 s += '<div class="dropDown pohladDropDown">'; 5074 s += ss; 5075 s += '</div>'; 5076 5077 s += '</span>'; 5078 return s; 5079} 5080 5081EdubarUtils.getUserRowName = function(row, showSubname) { 5082 if (!row) return ''; 5083 5084 var prveMeno = edubar && edubar.options && ['tr', 'cn', 'th', 'mv', 'iq','ke','sg'].includes(edubar.options.school_country) 5085 var ret = ''; 5086 if (row["p_meno"] || row["p_priezvisko"]) { 5087 if (!row["p_meno"]) row["p_meno"] = ''; 5088 if (!row["p_priezvisko"]) row["p_priezvisko"] = ''; 5089 if (prveMeno) { 5090 ret = row["p_meno"]+' '+row["p_priezvisko"]; 5091 } else { 5092 ret = (row["p_priezvisko"] ? row["p_priezvisko"]+', ' : '')+row["p_meno"]; 5093 } 5094 } else 5095 if (row["firstname"] || row["lastname"]) { 5096 if (!row["firstname"]) row["firstname"] = ''; 5097 if (!row["lastname"]) row["lastname"] = ''; 5098 if (prveMeno) { 5099 ret = row["firstname"]+' '+row["lastname"]; 5100 } else { 5101 ret = (row["lastname"] ? row["lastname"]+', ' : '')+row["firstname"]; 5102 } 5103 } else 5104 if (row["meno"] || row["priezvisko"]) { 5105 if (!row["meno"]) row["meno"] = ''; 5106 if (!row["priezvisko"]) row["priezvisko"] = ''; 5107 if (prveMeno) { 5108 ret = row["meno"]+' '+row["priezvisko"]; 5109 } else { 5110 ret = (row["priezvisko"] ? row["priezvisko"]+', ' : '')+row["meno"]; 5111 } 5112 } 5113 5114 if (showSubname !== false && row["subname"]) { 5115 if (row["subname"]) { 5116 ret += (ret ? ', ' : '')+et(row["subname"]); 5117 } 5118 } 5119 5120 return ret; 5121} 5122 5123EdubarUtils.switchRodicDieta = function(studentid, doneFunc) { 5124 $j('body').append('<div id="barSmartLinkLoadingText">'+ls(3358)+'</div>'); 5125 $j.get('/login/switchchild?studentid='+studentid, function(data) { 5126 if (EdubarUtils.isParent() && edubar) { 5127 edubar.options.loggedChild = studentid; 5128 } 5129 $j('.edubarProfileChildBtn.switchChildBtn').each(function() { 5130 $(this).toggleClass('selected', $(this).attr('data-sid') == studentid); 5131 }) 5132 $j('#barSmartLinkLoadingText').remove(); 5133 if (doneFunc) doneFunc(); 5134 }); 5135}; 5136 5137EdubarUtils.formatFileSize = function(size) { 5138 var t = size + ' B'; 5139 if (size > 1000) 5140 t = Math.round(size / 1024) + ' KB'; 5141 if (size > 1000000) 5142 t = Math.round(size / 1024 / 1024) + ' MB'; 5143 return t; 5144 } 5145EdubarUtils.strtr = function(str, from, to) { 5146 var fr = '', i = 0, j = 0, lenStr = 0, lenFrom = 0, tmpStrictForIn = false, fromTypeStr = '', toTypeStr = '', istr = ''; 5147 var tmpFrom = []; 5148 var tmpTo = []; 5149 var ret = ''; 5150 var match = false; 5151 5152 // Received replace_pairs? 5153 // Convert to normal from->to chars 5154 if ( typeof from === 'object') { 5155 for (fr in from) { 5156 if (from.hasOwnProperty(fr)) { 5157 tmpFrom.push(fr); 5158 tmpTo.push(from[fr]); 5159 } 5160 } 5161 5162 from = tmpFrom; 5163 to = tmpTo; 5164 } 5165 5166 // Walk through subject and replace chars when needed 5167 lenStr = str.length; 5168 lenFrom = from.length; 5169 fromTypeStr = typeof from === 'string'; 5170 toTypeStr = typeof to === 'string'; 5171 5172 for ( i = 0; i < lenStr; i++) { 5173 match = false; 5174 if (fromTypeStr) { 5175 istr = str.charAt(i); 5176 for ( j = 0; j < lenFrom; j++) { 5177 if (istr == from.charAt(j)) { 5178 match = true; 5179 break; 5180 } 5181 } 5182 } else { 5183 for ( j = 0; j < lenFrom; j++) { 5184 if (str.substr(i, from[j].length) == from[j]) { 5185 match = true; 5186 // Fast forward 5187 i = (i + from[j].length) - 1; 5188 break; 5189 } 5190 } 5191 } 5192 if (match) { 5193 ret += toTypeStr ? to.charAt(j) : to[j]; 5194 } else { 5195 ret += str.charAt(i); 5196 } 5197 } 5198 5199 return ret; 5200} 5201 5202EdubarUtils.htmlToText = function(html) { 5203 5204 html = html.replace(/<style([\s\S]*?)<\/style>/gi, ''); 5205 html = html.replace(/<script([\s\S]*?)<\/script>/gi, ''); 5206 html = html.replace(/<\/div><\/div><\/li>/ig, '\n'); 5207 html = html.replace(/<\/div><\/li>/ig, '\n'); 5208 html = html.replace(/<\/p><\/div>/ig, '\n'); 5209 html = html.replace(/<\/div><\/div>/ig, '\n'); 5210 html = html.replace(/<\/div>/ig, '\n'); 5211 html = html.replace(/<\/li>/ig, '\n'); 5212 html = html.replace(/<\/a>/ig, ' '); 5213 html = html.replace(/<li>/ig, ' * '); 5214 html = html.replace(/<\/ul>/ig, '\n'); 5215 html = html.replace(/<\/p>/ig, '\n \n'); 5216 html = html.replace(/<\/h1>/ig, '\n \n'); 5217 html = html.replace(/<\/h2>/ig, '\n \n'); 5218 html = html.replace(/<\/h3>/ig, '\n \n'); 5219 html = html.replace(/<br\s*[\/]?>/gi, "\n"); 5220 html = html.replace(/<[^>]+>/ig, ''); 5221 5222 html = html.replace(/\r?\n\r?\n(\r?\n)+\r?/ig, '\n\n'); 5223 5224 return html; 5225} 5226EdubarUtils.strip_tags = function(s, keepNewLines) { 5227 if (keepNewLines) { 5228 s = (s || "").replace(/(<div[^>]*>|<\/div>|<\/p>|<p>|<br>|<br\/>)/ig,"\n"); 5229 } 5230 return (s || "").replace(/(<([^>]+)>)/ig,""); 5231} 5232 5233EdubarUtils.emailIsValid = function(email) { 5234 if (!email) email = ''; 5235 email = email.toString(); 5236 email = $j.trim(email); 5237 var re = /^[a-zA-Z0-9\_]+[a-zA-Z0-9\._\-\+]*@([a-zA-Z0-9_\-]+\.)+[a-zA-Z]+$/; 5238 if (!re.test(email.toLowerCase())) return false; 5239 5240 if ( 5241 email.endsWith('@gmail.sk') 5242 || email.endsWith('@gmail.cz') 5243 || email.endsWith('@gamil.com') 5244 || email.endsWith('@gmial.com') 5245 || email.endsWith('@gmal.com') 5246 || email.endsWith('@gmil.com') 5247 || email.endsWith('@gmali.com') 5248 || email.endsWith('@gmila.com') 5249 || email.endsWith('vgmail.com') 5250 //|| email.endsWith('vcentrum.sk') //stavcentrum.sk 5251 ) { 5252 //2019-10-09 Janov research v DB 5253 return false; 5254 } 5255 return true; 5256} 5257 5258var EduSettings = {}; 5259EduSettings.getSchoolYearTournOver = function() { 5260 var turnover = edubar && edubar.options.schoolyear_turnover ? edubar.options.schoolyear_turnover : '08-01'; 5261 return turnover; 5262} 5263EduSettings.getZaciatocnyMesiacRoku = function(sinceTurnover) { 5264 var turnover = edubar && edubar.options.year_turnover ? edubar.options.year_turnover : ''; 5265 if (!turnover) return 9; 5266
5267 var month = Date.fromDbString(turnover).format('n'); 5268 5269 return month; 5270 //sk/cz skoly uz maju turnover 09-01, cize toto netreba 5271 if (sinceTurnover) return month; 5272 5273 if (month == 1) { 5274 return 1; 5275 } 5276 if (month != 8) return month; 5277 5278 return 9; 5279} 5280 5281EduSettings.getNazovSkolskehoRoku = function(rok) { 5282 if (typeof ASC != 'undefined' && ASC.req && ASC.req.getSchoolYearName) return ASC.req.getSchoolYearName(rok*1); 5283 var month = this.getZaciatocnyMesiacRoku(); 5284 if (month == 1) { 5285 return rok; 5286 } 5287 return (rok*1).toString()+' / '+(rok*1+1).toString(); 5288} 5289 5290 5291EduSettings.getPoradieMesiacov = function(vsetky) { 5292 var m = this.getZaciatocnyMesiacRoku(vsetky)-1; 5293 //if (vsetky && m == 8) m = 7; 5294 var ret = []; 5295 for (var i=0;i<12;i++) { 5296 if (!vsetky && edubar && EdubarUtils.indexOf(['sk','cz'],edubar.options.school_country) != -1 && ((m+i)%12+1==7 || (m+i)%12+1==8)) continue; 5297 ret.push((m+i)%12+1); 5298 } 5299 return ret; 5300} 5301 5302/*=================== edubarSections ===============================================*/ 5303 5304function barHideEdubar() { 5305 barToggleSideBar(false); 5306 barToggleEdubarHeader(false); 5307} 5308 5309function barShowEdubar() { 5310 barToggleSideBar(true); 5311 barToggleEdubarHeader(true); 5312} 5313 5314function barSaveSkinSettings(skinData) { 5315 if (!skinData) { 5316 var frm = document.getElementById('edubarSkinSettingsFrm'); 5317 var skinData = $j(frm).serialize(); 5318 } 5319 $j.post('/customize/skinSettings.php', skinData, function(data) { 5320 if (data == 'ok') { 5321 document.location.reload(true); 5322 } else { 5323 alert('Nepodarilo sa uložiť nastavenia. Chybové hlásenie: '+data); 5324 } 5325 }); 5326} 5327 5328function barRefreshSkinSettings() { 5329 var frm = document.getElementById('edubarSkinSettingsFrm'); 5330 frm.akcia.value = 'refreshSettings'; 5331 var skinData = $j(frm).serialize(); 5332 5333 frm.akcia.value = 'changeSettings'; 5334 $j.post('/customize/skinSettings.php', skinData, function(data) { 5335 $j(data).appendTo('head'); 5336 }); 5337} 5338 5339function barResetSkinSettings() { 5340 var data = {akcia: 'resetSettings'}; 5341 $j.post('/customize/skinSettings.php', data, function(data) { 5342 5343 if (data == 'ok') { 5344 document.location.reload(true); 5345 } else { 5346 alert('Nepodarilo sa uložiť nastavenia. Chybové hlásenie: '+data); 5347 } 5348 }); 5349} 5350 5351function barProcessSkinColor(val) { 5352 if (val.substr(0,1) == '#') { 5353 return val; 5354 } else if (val.substr(0,3) == 'rgb') { 5355 return val; 5356 } else if (val.substr(0,5) == 'theme') { 5357 return $j('.'+val).css('color'); 5358 } 5359 return val; 5360} 5361 5362WebFontConfig = { 5363 google: { families: [] } 5364}; 5365 5366var barLoadedFonts = {}; 5367function barLoadGoogleFont(fontName) { 5368 if (barLoadedFonts[fontName]) return; 5369 if (true) { 5370 if (fontName.indexOf('Century gothic') != -1) return; 5371 var version = ''; 5372 if (fontName.toLowerCase().indexOf('open sans') != -1) { 5373 version = '2'; 5374 }; 5375 var fn = fontName.replace(/\s/gi,"_"); 5376 var ua = window.navigator.userAgent; 5377 var msie = ua.indexOf("MSIE "); 5378 if (msie > 0 || !!ua.match(/Trident.*rv\:11\./)) { 5379 barCssLoad('/global/pics/gfonts/'+fn+'/fontie.css'); 5380 } else { 5381 barCssLoad('/global/pics/gfonts/'+fn+'/font.css'+(version ? '?v='+version : '')); 5382 } 5383 } else { 5384 WebFontConfig.google.families.push(fontName+':300,400:latin,latin-ext'); 5385 var wf = document.createElement('script'); 5386 wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + 5387 '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'; 5388 wf.type = 'text/javascript'; 5389 wf.async = 'true'; 5390 var s = document.getElementsByTagName('script')[0]; 5391 s.parentNode.insertBefore(wf, s); 5392 } 5393 barLoadedFonts[fontName] = true; 5394} 5395 5396function barAdminBtnListClick(groupid) { 5397 $j('#barSkinVolbaBtn .cp_groupDiv').hide(); 5398 $j('#barAdminBtn'+groupid).show(); 5399 $j('ul.barAdminBtnList > li').removeClass('selected'); 5400 $j('#barAdminBtnLi'+groupid).addClass('selected'); 5401 localStorage.setItem('barAdminBtnSelection',groupid); 5402} 5403 5404/*==================== edubar dialogs ===================================================*/ 5405 5406var barDialogs = new Array(); 5407function barOpenDialog(dlgId, dialogSrc, title, onCloseFunc, onBeforeCloseFunc) { 5408 barNewDialog({ 5409 'id': dlgId, 5410 'source': dialogSrc, 5411 'title': title, 5412 'close': onCloseFunc, 5413 'beforeClose': onBeforeCloseFunc 5414 }); 5415} 5416function barMDialog(params) { 5417 barStartLoading(); 5418 $.post(params.url,{},function() { 5419 5420 },'script').always(function() { 5421 barEndLoading(); 5422 }); 5423} 5424function barNewDialog(params) { 5425 if (params && params.allowDialoginInAppLegacyView && params.source && MobileAppBridge.isV2Active()) { 5426 EdupageApp.pushLegacyUrlView(params); 5427 return; 5428 } 5429 if (params && params.allowDialoginInAppLegacyView && params.content && MobileAppBridge.isV2Active()) { 5430 return EdupageApp.pushLegacyDialogView('<div>'+params.content+'</div>', params); 5431 } 5432 5433 var dialogSrc = params.source ? params.source : ''; 5434 var dialogClass = params.dialogClass 5435 ? params.dialogClass 5436 : ''; 5437 5438 if (!dialogClass) { 5439 5440 } 5441 var maxHeightKoef = params.maxHeightKoef ? params.maxHeightKoef : 1; 5442 var postData = params.postData ? params.postData : {}; 5443 var dialogWidth = params.width ? params.width : 820; 5444 var onCloseFunc = params.close ? params.close : null; 5445 var onLoadFunc = params.onload ? params.onload : null; 5446 var onBeforeCloseFunc = params.beforeClose ? params.beforeClose : null; 5447 var dlgid = params.id ? params.id : ''; 5448 var buttons = params.buttons ? params.buttons : {}; 5449 var title = params.title ? params.title : ''; 5450 var height = params.height ? params.height: 'auto'; 5451 var resizeable = params.resizeable ? params.resizeable: true; 5452 5453 var newDiv = $j('<div>').appendTo('body'); 5454 var returnFunc = params.returnFunc ? params.returnFunc : null; 5455 var modal = params.modal === false ? false : true; 5456 var dialogContent = params.content ? params.content : ''; 5457 var dialogPosition = params.position || { my: "center", at: "center", of: window }; 5458 if (typeof dialogPosition == 'string') { 5459 dialogPosition = { my: "center", at: "center", of: window }; 5460 } 5461 if (dlgid != '') { 5462 newDiv.attr('id',dlgid); 5463 } else { 5464 if (!window.dlgid) window.dlgid = 0; 5465 window.dlgid++; 5466 dlgid = 'dlg'+(window.dlgid).toString(); 5467 newDiv.attr('id',dlgid); 5468 } 5469 5470 if (dialogSrc != '') { 5471 if (MobileAppBridge.isActive() && !params.autoHeight) { 5472 height = $(window).height()+70; 5473 } 5474 var sl = '<div class="dialog-loading-div" style="position: relative;padding:15px;'+(height != 'auto' ? 'height:'+et(height-70)+'px;': 'min-height:150px')+';">'; 5475 sl += '<i class="fa fa-spinner fa-pulse" style="color: rgba(0,0,0,0.2);position:absolute;
5475left:50%;top:50%;margin-top:-24px;margin-left:-24px;font-size:48px"></i>'; 5476 sl += '</div>'; 5477 newDiv.html(sl); 5478 5479 } else { 5480 newDiv.html(dialogContent); 5481 var str = ''; 5482 for (var x in buttons) { 5483 var btn = buttons[x]; 5484 var cls = btn.buttonClass ? btn.buttonClass : 'button-blue'; 5485 var onclick = btn.type == 'close' ? 'barCloseDialog(this)' : (btn.click ? btn.click : ''); 5486 str += '<input type="button" onclick="'+et(onclick)+'" class="'+et(cls)+'" value="'+et(x)+'">'; 5487 } 5488 if (str != '') { 5489 newDiv.append('<div style="text-align:right;margin-top:10px;">'+str+'</div>'); 5490 } 5491 newDiv.addClass('dialog'); 5492 } 5493 5494 var appendToElem = $(params.appendTo ? params.appendTo : 'body'); 5495 5496 var fullScreenLevel = 0; 5497 if (params.fullScreen) { 5498 fullScreenLevel = appendToElem.find('.fullScreenDialogEx, .etest-overlay').length; 5499 } 5500 var restoreScrollTop = $(window).scrollTop(); 5501 5502 5503 5504 var dlgOpts = { 5505 'modal': modal, 5506 'dialogClass': dialogClass, 5507 'width': dialogWidth+'px', 5508 'height': height, 5509 'minHeight': 60, 5510 'maxHeight': $j(window).height()/**maxHeightKoef*/, 5511 'resizeable': resizeable, 5512 'appendTo': params.appendTo ? params.appendTo : 'body', 5513 'position': dialogPosition, 5514 'close': function() { 5515 var elem = barDialogs && barDialogs.length > 0 ? barDialogs.pop() : null; 5516 if (elem) { 5517 elem.remove(); 5518 } 5519 $j('.tipsy').remove(); 5520 $j(window).off('resize.centerDialog'+dlgid); 5521 5522 if (params.fullScreen) { 5523 appendToElem.children().each(function() { 5524 if ($(this).hasClass('etest-overlay-level-'+fullScreenLevel)) { 5525 $(this).toggleClass('etest-overlay-level', false).toggleClass('etest-overlay-level-'+fullScreenLevel, false).toggleClass('etest-overlay-hidden',false); 5526 } 5527 }); 5528 $(window).resize(); 5529 if (restoreScrollTop) { 5530 $(window).scrollTop(restoreScrollTop); 5531 setTimeout(function() { 5532 $(window).scrollTop(restoreScrollTop); 5533 },10); 5534 } 5535 } 5536 if (onCloseFunc) {onCloseFunc();} 5537 5538 }, 5539 'title': title, 5540 'beforeClose': function(e) { 5541 if (window.skipDialogClose) { 5542 e.preventDefault(); 5543 return; 5544 } 5545 if (onBeforeCloseFunc) { 5546 onBeforeCloseFunc(); 5547 } 5548 } 5549 } 5550 if (params.fullScreen) { 5551 dlgOpts["resizeable"] = false; 5552 dlgOpts["draggable"] = false; 5553 dlgOpts["dialogClass"] += (dlgOpts["dialogClass"] || "")+" fullScreenDialog fullScreenDialogEx etest-overlay"; 5554 } 5555 5556 if (params.dlgOpts) { 5557 for (var x in params.dlgOpts) { 5558 if (dlgOpts[x]) continue; 5559 5560 dlgOpts[x] = params.dlgOpts[x]; 5561 } 5562 } 5563 newDiv.dialog(dlgOpts); 5564 var pauseWndResizeHandle = false; 5565 newDiv.on('dialogresizestart',function() { 5566 pauseWndResizeHandle = true; 5567 }); 5568 newDiv.on('dialogresizestop',function() { 5569 pauseWndResizeHandle = false; 5570 wndResizeHandle(); 5571 }); 5572 5573 if (params.fullScreen) { 5574 appendToElem.children().each(function() { 5575 if ($(this).closest('.ui-dialog').get(0) == newDiv.closest('.ui-dialog').get(0)) return; 5576 if (!$(this).hasClass('ui-datepicker')) { 5577 $(this).toggleClass('etest-overlay-hidden',true) 5578 } 5579 if (!$(this).hasClass('etest-overlay-level')) { 5580 $(this).toggleClass('etest-overlay-level', true).toggleClass('etest-overlay-level-'+fullScreenLevel, true); 5581 } 5582 }); 5583 } 5584 5585 var _wndResizeTimeout = null; 5586 function wndResizeHandle() { 5587 5588 if (pauseWndResizeHandle) return; 5589 if (_wndResizeTimeout) clearTimeout(_wndResizeTimeout); 5590 _wndResizeTimeout = setTimeout(function() { 5591 5592 //newDiv.css('max-height',$j(window).height()*maxHeightKoef); 5593 var titleElem = newDiv.closest('.ui-dialog').find('.ui-dialog-titlebar'); 5594 var titleHeight = 0; 5595 if (titleElem.length>0 && titleElem.is(':visible')) { 5596 titleHeight = titleElem.outerHeight(); 5597 ht += titleHeight; 5598 } 5599 newDiv.css('max-height',($j(window).height()*maxHeightKoef-(newDiv.closest('.ui-dialog').hasClass('noPadding') ? titleHeight+10 : 52)).toString()+'px'); 5600 5601 var ht = newDiv.find('.whiteDialogTitle').outerHeight(); 5602 var hf = newDiv.find('.whiteDialogFooter').outerHeight(); 5603 5604 5605 var maxH = $(window).height() - ht - hf - 15; 5606 newDiv.find('.whiteDialogContent').css('max-height',maxH+'px'); 5607 if (newDiv.data('ui-dialog')) { 5608 newDiv.dialog('option','maxHeight',$j(window).height()); 5609 } 5610 5611 barCenterDialog(newDiv); 5612 },50); 5613 } 5614 5615
5616 $j(window).on('resize', wndResizeHandle); 5617 newDiv.on('remove',function() { 5618 if (_wndResizeTimeout) clearTimeout(_wndResizeTimeout); 5619 $j(window).off('resize',wndResizeHandle); 5620 }); 5621 5622 5623 5624 newDiv.css('box-sizing','border-box'); 5625 newDiv.data('returnFunc',returnFunc); 5626 newDiv.data('dialogData',params.dialogData); 5627 5628 barDialogs.push(newDiv); 5629 5630 //postData["asDialog"] = 1; 5631 5632 if (dialogSrc != '') { 5633 if (dialogSrc.indexOf('asDialog') == -1) { 5634 dialogSrc += (dialogSrc.indexOf('?') == -1 ? '?' : '&')+'asDialog=1'; 5635 } 5636 newDiv.data('source',dialogSrc); 5637 newDiv.data('postData',postData); 5638 $j.post(dialogSrc, postData, function(data) { 5639 if (data != '') { 5640 iconsSelectedImg = ''; 5641 newDiv.html(data); 5642 5643 var str = ''; 5644 for (var x in buttons) { 5645 var btn = buttons[x]; 5646 var cls = btn.buttonClass ? btn.buttonClass : 'button-blue'; 5647 var onclick = btn.type == 'close' ? 'barCloseDialog(this)' : (btn.click ? btn.click : ''); 5648 str += '<a onclick="'+et(onclick)+'" class="'+et(cls)+'" style="display:inline-block">'+et(x)+'</a>'; 5649 } 5650 if (str != '') { 5651 newDiv.append('<div style="text-align:right">'+str+'</div>'); 5652 } 5653 5654 newDiv.addClass('dialog'); 5655 5656 5657 if (newDiv.height() > $j(window).height()) { 5658 newDiv.dialog('option','height',$j(window).height()*maxHeightKoef); 5659 } 5660 newDiv.closest('.ui-dialog').css('position','fixed'); 5661 5662 if (dialogClass != 'skinBrowserDialog') { 5663 $j(window).resize(); 5664 } 5665 5666 5667 barRefreshPage(); 5668 5669 if (onLoadFunc) { 5670 onLoadFunc(newDiv); 5671 } 5672 } 5673 }); 5674 } else { 5675 5676 if (newDiv.height() > $j(window).height()) { 5677 newDiv.dialog('option','height',$j(window).height()*maxHeightKoef); 5678 } 5679 5680 newDiv.closest('.ui-dialog').css('position','fixed'); 5681 if (dialogClass != 'skinBrowserDialog') { 5682 $j(window).resize(); 5683 } 5684 5685 barRefreshPage(); 5686 if (onLoadFunc) { 5687 onLoadFunc(newDiv); 5688 } 5689 } 5690 5691 if (params.closeOnOverlayClick) { 5692 newDiv.closest('.ui-dialog').next().on('click',function() { 5693 barCloseDialog(newDiv); 5694 }) 5695 } 5696 if (params.closeOnBack && !MobileAppBridge.isActive()) { 5697 barRegisterPopstateHandler(newDiv, function() { 5698 barCloseDialog(newDiv); 5699 }, null, {dlgid: newDiv.attr('id')}) 5700 } 5701 newDiv.attr('') 5702 newDiv.closest('.ui-dialog').css('position','fixed'); 5703 barCenterDialog(newDiv); 5704 $j('.tipsy').remove(); 5705 $j('.dropDown').fadeOut(150); 5706 $j('.dropDownBtn').children('a').removeClass('icon-button-active'); 5707 5708 barFixAutocenterDialogs(); 5709 setTimeout(function() { 5710 barFixAutocenterDialogs(); 5711 },300); 5712 return newDiv; 5713} 5714 5715function barFixAutocenterDialogs() { 5716 if (EdubarUtils._autoCenterDialogTimeout) return; 5717 5718 EdubarUtils._autoCenterDialogTimeout = setTimeout(function() { 5719 5720 EdubarUtils._autoCenterDialogTimeout = null; 5721 var dlgs = $j('.autoCenteredDialog'); 5722 if (dlgs.length == 0) return; 5723 5724 dlgs.each(function() { 5725 var $this = $(this); 5726 var w = Math.round($this.outerWidth()); 5727 var h = Math.round($this.outerHeight()); 5728 if (!$this.data('autocenterLastW') || !$this.data('autocenterLastH') || Math.abs(w - $this.data('autocenterLastW'))>5 || Math.abs(h - $this.data('autocenterLastH')) > 5) { 5729 barCenterDialog($this.find('.ui-dialog-content')); 5730 } 5731 $this.data('autocenterLastW', w); 5732 $this.data('autocenterLastH', h); 5733 }); 5734 barFixAutocenterDialogs(); 5735 },150); 5736} 5737 5738function barRenderReactComponent(elem, src, componentName, props) { 5739 function init() { 5740 ASC.requireAsync(src).then(function(c){ 5741 ASC.requireAsync('react-dom').then(function(ReactDOM){ 5742 window.ReactDOM = ReactDOM; 5743 var React=ASC.require('react'); 5744 5745 ReactDOM.render(React.createElement(c[componentName],props),elem); 5746 5747 $(elem).on('remove',function() { 5748 ReactDOM.unmountComponentAtNode(this); 5749 }) 5750 }); 5751 }); 5752 5753 } 5754 5755 if (MobileAppBridge.isV2Active()) { 5756 init(); 5757 } else { 5758 5759 barJsLibraryLoad(edubar && edubar.options && edubar.options.srcv ? edubar.options.srcv : '/global/pics/js/srcv.js?v='+(new Date()).getTime(), function() { 5760 init(); 5761 }); 5762 } 5763} 5764
5765function barNewReactSourceDlg(src, componentName, props, options) { 5766 var dlgRef = { 5767 elem: null 5768 } 5769 if (!options) options = {}; 5770 if (!options.dialogClass) { 5771 options.dialogClass = 'grayTitleDialog noPadding'; 5772 5773 } 5774 if (!options.closeOnOverlayClick) { 5775 options.closeOnOverlayClick = false; 5776 } 5777 5778 if (options && options.allowDialoginInAppLegacyView && MobileAppBridge.isV2Active()) { 5779 EdupageApp.pushReactComponentView(src, props, { 5780 viewClass: componentName 5781 }); 5782 return; 5783 } 5784 5785 function init() { 5786 barStartLoading(); 5787 ASC.requireAsync('react-dom').then(function(ReactDOM){ 5788 window.ReactDOM = ReactDOM; 5789 5790 ASC.requireAsync(src).then(function(c){ 5791 barEndLoading(); 5792 var React=ASC.require('react'); 5793 dlgRef.elem = barNewReactDlg(React.createElement(c[componentName],props), options); 5794 }); 5795 }); 5796 } 5797 5798 if (MobileAppBridge.isV2Active()) { 5799 if (componentName == 'MathEditor') options.allowDialoginInAppView = true; 5800 if (options.allowDialoginInAppView || options.allowDialoginInAppLegacyView) { 5801 options.viewClass = componentName; 5802 EdupageApp.pushReactComponentView(src, props, options); 5803 } else { 5804 init(); 5805 } 5806 } else { 5807 barStartLoading(); 5808 barJsLibraryLoad(edubar && edubar.options && edubar.options.srcv ? edubar.options.srcv : '/global/pics/js/srcv.js?v='+(new Date()).getTime(), function() { 5809 barEndLoading(); 5810 init(); 5811 }); 5812 } 5813 return dlgRef; 5814} 5815 5816function barNewReactDlg(component, options) { 5817 if (!options) options = {}; 5818 options.closeOnOverlayClick = options.closeOnOverlayClick === false || options.closeOnOverlayClick === true ? options.closeOnOverlayClick : (MobileAppBridge.isActive() ? true : false); 5819 if (!options.dialogClass) { 5820 options.dialogClass = 'whiteDialog visibleEdges noPadding'; 5821 } 5822 5823 if (options && options.allowDialoginInAppLegacyView && MobileAppBridge.isV2Active()) { 5824 EdupageApp.pushReactComponentView("/app/pics/jsw/views/legacy/ReactDialogView.js", { 5825 children: component, 5826 options: options 5827 }); 5828 return; 5829 } 5830 5831 var dlg = null; 5832 var closeFunc = options.close; 5833 options.close = function() { 5834 ReactDOM.unmountComponentAtNode(dlg.get(0)); 5835 if (closeFunc) closeFunc(); 5836 } 5837 5838 if (!options.dlgOpts && MobileAppBridge.isActive()) { 5839 options.dlgOpts = { 5840 show: {effect: 'fade',delay:20, duration: 100} 5841 } 5842 } 5843 dlg = barNewDialog(options); 5844 dlg.on('remove',function() { 5845 ReactDOM.unmountComponentAtNode(dlg.get(0)); 5846 }); 5847 ASC.requireAsync('react-dom').then(function(ReactDOM){ 5848 window.ReactDOM = ReactDOM; 5849 ReactDOM.render(component,dlg.get(0)); 5850 barCenterDialog(dlg); 5851 }); 5852 5853 5854 barCenterDialog(dlg); 5855 return dlg; 5856} 5857 5858 5859function barCloseDialogOrView(elem) { 5860 if ($j(elem).closest('.ui-dialog-content').data('ui-dialog')) { 5861 $j(elem).closest('.ui-dialog-content').dialog('close'); 5862 } else 5863 if ($j(elem).closest('.yui-dialog').length>0) { 5864 var elem = $j(elem).closest('.ui-dialog-content'); 5865 elem.data('yuiDialog').hide(); 5866 } else 5867 if ($j(elem).closest('.etest-overlay.etest-return-div').length>0) { 5868 var elem = $j(elem).closest('.etest-overlay.etest-return-div'); 5869 if (elem.data('returnFunc')) { 5870 elem.data('returnFunc')(); 5871 } 5872 } else 5873 if ($j(elem).closest('.app-dlg-inner,.app-legacy-url,.app-view-stack').length>0 && typeof EdupageApp != 'undefined') { 5874 EdupageApp.inst.goBack(); 5875 } 5876} 5877 5878function barSetDialogTitle(elem, title) { 5879 if (MobileAppBridge.isActive() && $(elem).closest('.app-view-stack').length > 0) { 5880 var viewid = $(elem).closest('.app-view').attr('data-viewid'); 5881 EdupageApp.inst.setViewTitle(title,viewid); 5882 } else { 5883 $(elem).closest('.ui-dialog-content').dialog('option','title',title); 5884 } 5885} 5886 5887function barCloseDialog(elem) { 5888 if ($j(elem).closest('.etest-overlay.etest-return-div').length>0) { 5889 var elem = $j(elem).closest('.etest-overlay.etest-return-div'); 5890 5891 if (elem.data('returnFunc')) { 5892 elem.data('returnFunc')(); 5893 } 5894 } else 5895 5896 if ($j(elem).closest('.app-dlg-inner,.app-legacy-url, .app-react-dlg-inner').length>0 && typeof EdupageApp != 'undefined') { 5897 var uniqueViewId = $j(elem).closest('.app-view').attr('data-uniqueviewid'); 5898 if (uniqueViewId && EdupageApp.removeViewId) { 5899 EdupageApp.removeViewId(uniqueViewId) 5900 } else { 5901 EdupageApp.inst.goBack(); 5902 } 5903 } else 5904 if ($j(elem).closest('.yui-dialog').length>0) { 5905 var elem = $j(elem).closest('.ui-dialog-content'); 5906 elem.data('yuiDialog').hide(); 5907 } else { 5908 5909 if ($j(elem).closest('.ui-dialog-content').data('ui-dialog')) { 5910 $j(elem).closest('.ui-dialog-content').dialog('close'); 5911 } 5912 } 5913} 5914 5915function barCenterDialog(elem) { 5916 5917 if ($j(elem).closest('.ui-dialog-content').data('ui-dialog')) { 5918 var position = $j(elem).closest('.ui-dialog-content').dialog("option","position");
5919 var $dlg = $j(elem).closest('.ui-dialog'); 5920 5921 var o = $dlg.offset(); 5922 if (o) { 5923 if (o.left + $dlg.width() > $(window).width() 5924 || o.top + $dlg.height() > $(window).height()) { 5925 position = { my: "center", at: "center", of: window } 5926 } 5927 } 5928 5929 var panelW = $('#edubarAiPanel, #edubarBbPanel, #bar_chatPanel').outerWidth(); 5930 if (panelW) { 5931 position = { my: "center", at: "center-"+(panelW/2).toFixed(0)+"px center", of: window } 5932 } 5933 5934 $j(elem).closest('.ui-dialog-content').dialog("option","position",position || { my: "center", at: "center", of: window }); 5935 5936 5937 if ($dlg.height() >= $(window).height()-3) { 5938 $dlg.css('top',0); 5939 } 5940 } 5941} 5942 5943function barCenterTopDialog(elem) { 5944 if ($j(elem).closest('.ui-dialog-content').data('ui-dialog')) { 5945 $j(elem).closest('.ui-dialog-content').dialog('option','position', {my:"center top", at:"center top", of: window}); 5946 } 5947} 5948 5949function barReloadDialog(elem, onLoadFunc) { 5950 var dlg = $j(elem).closest('.ui-dialog-content'); 5951 var dialogSrc = dlg.data('source'); 5952 var postData = dlg.data('postData'); 5953 5954 dlg.append('<div class="loadingDiv loading-background"></div>'); 5955 5956 $j.post(dialogSrc, postData, function(data) { 5957 if (data != '') { 5958 dlg.html(data); 5959 5960 dlg.toggleClass('dialog', true); 5961 5962 5963 if (dlg.height() > $j(window).height()) { 5964 dlg.dialog('option','height',$j(window).height()*0.98); 5965 } 5966 dlg.css('max-height',($j(window).height()*0.98-52)+'px'); 5967 dlg.closest('.ui-dialog').css('position','fixed'); 5968 dlg.dialog("option", "position", { my: "center", at: "center", of: window }); 5969 5970 barRefreshPage(); 5971 5972 if (onLoadFunc) { 5973 onLoadFunc(dlg); 5974 } 5975 } 5976 }); 5977} 5978 5979function barGetDialogReturnFunc(elem, funcName) { 5980 if (!funcName) funcName = 'returnFunc'; 5981 if (elem.data(funcName)) { 5982 return elem.data(funcName); 5983 } 5984 5985 if (elem.closest('.ui-dialog-content').data(funcName)) { 5986 return elem.closest('.ui-dialog-content').data(funcName); 5987 } 5988 if (elem.closest('.barReturnElem').data(funcName)) { 5989 return elem.closest('.barReturnElem').data(funcName); 5990 } 5991 return null; 5992} 5993 5994 5995function barGetDialogData(elem, param) { 5996 var data = null; 5997 if (elem.data('dialogData')) { 5998 data = elem.data('dialogData'); 5999 }else 6000 if (elem.closest('.ui-dialog-content').data('dialogData')) { 6001 data = elem.closest('.ui-dialog-content').data('dialogData'); 6002 } else 6003 if (elem.closest('.barReturnElem').data('dialogData')) { 6004 data = elem.closest('.barReturnElem').data('dialogData'); 6005 } else 6006 if (elem.closest('.etest-return-div').data('dialogData')) { 6007 data = elem.closest('.etest-return-div').data('dialogData'); 6008 } 6009 if (param) { 6010 return data && data[param] ? data[param] : null; 6011 } 6012 6013 return data; 6014} 6015 6016var iconsSelectedImg = ''; 6017function bariconClicked(imgSrc, thumbSrc, w,h) { 6018 iconsSelectedImg = imgSrc; 6019 barDialogs[barDialogs.length-1].dialog("close"); 6020} 6021 6022function barOpenLoginDialog(msg, onLoginComplete) { 6023 function dlgLoadFunc(dlg) { 6024 if (msg) { 6025 dlg.find('.loginMsgDiv').append('<div>'+msg+'</div>'); 6026 } 6027 6028 if (onLoginComplete) { 6029 dlg.find('form').on('submit',function(event) { 6030 event.preventDefault(); 6031 6032 $j.post($j(this).attr('action')+'asAjax=1', $j(this).serialize(), function(data) { 6033 if (data.substr(0,7) == 'loginok') { 6034 var pom = data.split(';'); 6035 edupage = pom[1]; 6036 onLoginComplete(edupage, pom[2], pom[3]); 6037 } else { 6038 dlg.html(data); 6039 dlgLoadFunc(dlg); 6040 dlg.dialog('options','position','center'); 6041 } 6042 }); 6043 6044 return false; 6045 }); 6046 } 6047 }; 6048 6049 var dlg = barNewDialog({ 6050 'source': '/login/form', 6051 'title': 'Prihlásenie', 6052 'width': '450', 6053 'onload': dlgLoadFunc 6054 }); 6055} 6056 6057function barChangeLang(elem) { 6058 window.location=$j(elem).attr('data-l'); 6059} 6060 6061function barShowMessageBox(msg, icon, options) { 6062 var isMobile = MobileAppBridge.isActive() || $('body').hasClass('mobileBody') || (options && options.forceMobileLayout); 6063 6064 if (!icon || icon.substr(0,3) != 'fa-') icon = 'fa-comments'; 6065 6066 var s = ''; 6067 if (isMobile) { 6068 if (icon != 'fa-none') { 6069 s += '<div style="margin: 12px 0 32px;text-align:center;"><i class="fa fa-fw {icon}" style="color: #BDBDBD;font-size:48px;opacity:0.7;"></i></div>'; 6070 } 6071 s += '<div style="margin-bottom: 32px;text-align:center;">{!msg}</div>'; 6072 } else {
6073 s += renderS('<i class="fa {icon}" style="color: #43A047;font-size:32px;'+(isMobile ? 'margin:10px 0px 10px 0px;' : 'float:left;margin:10px 20px 10px 10px;')+'display:inline-block;"></i>', { 6074 'icon': icon 6075 }); 6076 s += '<div style="text-align:left;margin-left:62px;">{!msg}</div>'; 6077 s += '<br>'; 6078 } 6079 6080 s += '<div class="barShowMessageBoxButtons" style="text-align:center;margin-top:10px;clear:both;">'; 6081 var numButtons = 1; 6082 var mamFwButton = false; 6083 if (options && options.buttons) { 6084 6085 for (var i=0;i<options.buttons.length;i++) { 6086 var btn = options.buttons[i]; 6087 var ss = ''; 6088 ss += '<button type="button" class="{btnCls} customBtn" value="{title}" data-ind="{ind}" data-i="{i}">'; 6089 if (btn.iconHtml) ss += btn.iconHtml; 6090 ss += '{title}'; 6091 if (btn.subtitle) { 6092 ss += '<div style="opacity: 0.8">{subtitle}</div>' 6093 } 6094 ss += '</button>'; 6095 s += renderS(ss, { 6096 btnCls: btn.cssClass ? btn.cssClass : 'button-gray', 6097 title: btn.label, 6098 subtitle: btn.subtitle, 6099 i: i, 6100 ind: btn.ind ? btn.ind : i 6101 }); 6102 if (btn.cssClass && btn.cssClass.indexOf('etest-btn-fw-confirm')>=0) mamFwButton = true; 6103 } 6104 numButtons = options.buttons.length; 6105 } else 6106 if (options && options.confirm) { 6107 numButtons = 2; 6108 s += '<input type="button" class="'+(options.okClass ? et(options.okClass) : 'button-green')+' okBtn" value="'+(options.okLbl ? et(options.okLbl) : '{#1573}')+'">'; 6109 s += '<input type="button" class="'+(options.cancelClass ? et(options.cancelClass) : 'button-gray')+' cancelBtn" value="'+(options.cancelLbl ? et(options.cancelLbl) : '{#1038}')+'">'; 6110 } else { 6111 s += '<input type="button" class="button-blue closeBtn" value="{#1573}" onclick="barCloseDialog(this)">'; 6112 } 6113 6114 if (numButtons > 2 && !mamFwButton) { 6115 for (var i=0;i<3;i++) { 6116 s += '<div class="barShowMessageBoxButtons-emptyItem"></div>'; 6117 } 6118 } 6119 s += '</div>'; 6120 var returnStatus = ''; 6121 6122 var dlg = barNewDialog({ 6123 'title': options && options.title ? et(options.title) : et(ls(2315)), 6124 'content': renderS(s, {msg: msg, icon: icon}), 6125 'width': options && options.width ? options.width : 350, 6126 'dialogClass': (isMobile ? 'whiteDialog mobileDlgPadding fixedPos' : '')+(options && options.dialogClass ? ' '+options.dialogClass : ''), 6127 'close': function() { 6128 if (options && options.close) { 6129 options.close(returnStatus); 6130 } 6131 } 6132 }); 6133 if (options && options.buttons) { 6134 dlg.find('.customBtn').click(function() { 6135 returnStatus = $j(this).attr('data-ind'); 6136 var btn = options.buttons[$j(this).attr('data-i')*1]; 6137 if (btn && btn.noDlgClose) { 6138 } else { 6139 barCloseDialog(dlg); 6140 } 6141 options.buttonClick($j(this).attr('data-ind'), btn); 6142 }); 6143 } else 6144 if (options && options.confirm) { 6145 dlg.find('.okBtn').click(function() { 6146 returnStatus = 'confirm'; 6147 barCloseDialog(dlg); 6148 options.confirm(); 6149 }); 6150 6151 dlg.find('.cancelBtn').click(function() { 6152 barCloseDialog(dlg); 6153 if (options && options.cancel) { 6154 options.cancel(); 6155 } 6156 }); 6157 } 6158 6159 return dlg; 6160} 6161 6162function barShowPromptBox(options) { 6163 var s = ''; 6164 s += '<div style="padding:0px">' 6165 s += '<form action="?" method="post">'; 6166 s += '<div style="white-space: pre-wrap" class="edubar-prompt-message">{msg}</div>'; 6167 if (options && options.inputType == 'textarea') { 6168 s += '<textarea name="prompt" style="width:100%;box-sizing: border-box;padding: 7px;height: 150px" class="promptField" autofocus>{value}</textarea>'; 6169 } else if (options && options.inputType == 'select') { 6170 s += '<select name="prompt" style="width:100%;box-sizing: border-box;padding: 7px;" class="promptField">'; 6171 for (var i=0;i<options.values.length;i++) { 6172 s += renderS('<option value="{v.id}" {selected}>{v.name}</option>', { 6173 v: options.values[i], 6174 selected: options.values[i].id == options.value ? 'selected' : '' 6175 }); 6176 } 6177 s += '</select>'; 6178 } else if (options && options.inputType == 'number') { 6179 s += '<input type="number" style="width:100%;box-sizing: border-box;padding: 7px" name="prompt" value="{value}"'; 6180 if (options.max) { 6181 s += ' max="'+et(options.max)+'"'; 6182 } 6183 if (options.min) { 6184 s += ' min="'+et(options.min)+'"'; 6185 } 6186 s += ' class="promptField">'; 6187 } else if (options && options.inputType == 'password') { 6188 s += '<input type="password" style="width:100%;box-sizing: border-box;padding: 7px" name="prompt" value="{value}" {maxLength} class="promptField">'; 6189 6190 } else { 6191 s += '<input type="text" style="width:100%;box-sizing: border-box;padding: 7px" name="prompt" value="{value}" {maxLength} class="promptField">'; 6192 } 6193 s += '<div style="text-align: right;padding-top:10px;" class="edubar-prompt-buttons">'; 6194 if (options && options.leftButtons) { 6195 s += '<div style="float:left">'; 6196 for (var i=0;i<options.leftButtons.length;i++) { 6197 var btn = options.leftButtons[i]; 6198
6199 s += renderS('<a class="leftBtn {btnCls}" data-btnind="{ind}" style="cursor:pointer;display:inline-block;">{title}</a>',{ 6200 btnCls: btn.cssClass ? btn.cssClass : 'button-blue', 6201 title: btn.label, 6202 ind: i 6203 }); 6204 } 6205 s += '</div>'; 6206 } 6207 s += '<input type="submit" value="{#1573}" class="button-green">'; 6208 s += '<input type="button" value="{#1038}" class="button-gray" onclick="barCloseDialog(this)">'; 6209 s += '</div>'; 6210 s += '</form>'; 6211 s += '</div>'; 6212 6213 var dlg = barNewDialog({ 6214 'title': et(options.title ? options.title : 'EduPage'), 6215 'content': renderS(s, {msg: options.msg ? options.msg : '', value: options.value ? options.value : ''}), 6216 'width': options.width || 350, 6217 'dialogClass': options.dialogClass, 6218 'maxLength': options.maxLength ? ' maxlength="'+et(options.maxLength)+'"' : '' 6219 }); 6220 6221 dlg.find('input[type="text"]').on('keydown',function(e) { 6222 if (e.which == 13) { 6223 $(this.form).submit(); 6224 } 6225 }); 6226 6227 dlg.find('form').on('submit',function(event) { 6228 event.preventDefault(); 6229 if (options.confirm) { 6230 var ret = options.confirm($j(this).find('.promptField').val()); 6231 if (ret !== false) { 6232 barCloseDialog(dlg); 6233 } 6234 } else if (options.confirmAsync) { 6235 dlg.find('.button-green').attr('disabled', true); 6236 options.confirmAsync($j(this).find('.promptField').val(), function(ret) { 6237 dlg.find('.button-green').attr('disabled', false); 6238 if (ret !== false) { 6239 barCloseDialog(dlg); 6240 } 6241 }); 6242 } else { 6243 barCloseDialog(dlg); 6244 } 6245 6246 }); 6247 6248 if (options && options.leftButtons) { 6249 dlg.find('.leftBtn').click(function() { 6250 var ind = $j(this).attr('data-btnind'); 6251 if (options.leftButtons[ind].click) { 6252 options.leftButtons[ind].click(); 6253 } 6254 }); 6255 } 6256 6257 dlg.find('.promptField').focus().select(); 6258 return dlg; 6259} 6260 6261 6262/** 6263* 6264* Base64 encode / decode 6265* http://www.webtoolkit.info/ 6266* 6267**/ 6268var Base64 = { 6269 // private property 6270 _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", 6271 6272 // public method for encoding 6273 encode : function (input, forceJs) { 6274 if (!forceJs && typeof btoa == 'function') return btoa(input); 6275 6276 if (typeof btoa != 'undefined' && forceJs != 'plainjs') { 6277 return btoa(Base64.UnicodetoUTF8(input)); 6278 } 6279 var output = ""; 6280 var chr1, chr2, chr3, enc1, enc2, enc3, enc4; 6281 var i = 0; 6282 6283 input = Base64._utf8_encode(input); 6284 6285 while (i < input.length) { 6286 6287 chr1 = input.charCodeAt(i++); 6288 chr2 = input.charCodeAt(i++); 6289 chr3 = input.charCodeAt(i++); 6290 6291 enc1 = chr1 >> 2; 6292 enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); 6293 enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); 6294 enc4 = chr3 & 63; 6295 6296 if (isNaN(chr2)) { 6297 enc3 = enc4 = 64; 6298 } else if (isNaN(chr3)) { 6299 enc4 = 64; 6300 } 6301 6302 output = output + 6303 this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + 6304 this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); 6305 6306 } 6307 6308 return output; 6309 }, 6310 UTF8toUnicode: function(str) { 6311 // |[\xF8-\xFB][\x80-\xBF]{4}|[\xFC-\xFD][\x80-\xBF]{5} 6312 //return str.replace(/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, function (str) { 6313 return decodeURIComponent(escape(str)); 6314 //}); 6315 }, 6316 6317 UnicodetoUTF8: function(str) { 6318 return unescape(encodeURIComponent(str)); 6319 }, 6320 // public method for decoding 6321 decode : function (input, forceJs) { 6322 if (!forceJs && typeof atob == 'function') return atob(input); 6323 /*return decodeURIComponent(Array.prototype.map.call(atob(input), function(c) { 6324 return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) 6325 }).join(''));*/ 6326 6327 if (typeof btoa != 'undefined' && forceJs != 'plainjs') { 6328 return Base64.UTF8toUnicode(atob(input)); 6329 //return btoa(unescape(encodeURIComponent(str))); 6330 } 6331 6332 var output = ""; 6333 var chr1, chr2, chr3; 6334 var enc1, enc2, enc3, enc4; 6335 var i = 0; 6336 6337 input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 6338 6339 while (i < input.length) { 6340 6341 enc1 = this._keyStr.indexOf(input.charAt(i++)); 6342 enc2 = this._keyStr.indexOf(input.charAt(i++)); 6343 enc3 = this._keyStr.indexOf(input.charAt(i++)); 6344 enc4 = this._keyStr.indexOf(input.charAt(i++)); 6345 6346 chr1 = (enc1 << 2) | (enc2 >> 4); 6347 chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); 6348 chr3 = ((enc3 & 3) << 6) | enc4; 6349 6350 output = output + String.fromCharCode(chr1); 6351 6352 if (enc3 != 64) { 6353 output = output + String.fromCharCode(chr2); 6354 } 6355 if (enc4 != 64) { 6356 output = output + String.fromCharCode(chr3); 6357 } 6358 6359 } 6360 6361 output = Base64._utf8_decode(output); 6362 6363 return output; 6364 6365 }, 6366 6367 // private method for UTF-8 encoding 6368 _utf8_encode : function (string) { 6369 string = string.replace(/\r\n/g,"\n"); 6370 var utftext = ""; 6371 6372 for (var n = 0; n < string.length; n++) { 6373 6374 var c = string.charCodeAt(n); 6375 6376 if (c < 128) { 6377 utftext += String.fromCharCode(c); 6378 } 6379 else if((c > 127) && (c < 2048)) { 6380 utftext += String.fromCharCode((c >> 6) | 192); 6381 utftext += String.fromCharCode((c & 63) | 128); 6382 } 6383 else { 6384 utftext += String.fromCharCode((c >> 12) | 224); 6385 utftext += String.fromCharCode(((c >> 6) & 63) | 128); 6386 utftext += String.fromCharCode((c & 63) | 128); 6387 } 6388 6389 } 6390 6391 return utftext; 6392 }, 6393 6394 // private method for UTF-8 decoding 6395 _utf8_decode : function (utftext) { 6396 var string = ""; 6397 var i = 0; 6398 var c = c1 = c2 = 0; 6399 6400 while ( i < utftext.length ) { 6401 6402 c = utftext.charCodeAt(i); 6403 6404 if (c < 128) {
6405 string += String.fromCharCode(c); 6406 i++; 6407 } 6408 else if((c > 191) && (c < 224)) { 6409 c2 = utftext.charCodeAt(i+1); 6410 string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); 6411 i += 2; 6412 } 6413 else { 6414 c2 = utftext.charCodeAt(i+1); 6415 c3 = utftext.charCodeAt(i+2); 6416 string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); 6417 i += 3; 6418 } 6419 6420 } 6421 6422 return string; 6423 } 6424} 6425 6426function barOpenBoxEffect(startX, startY, startW, startH, dstX, dstY, dstW, dstH, options) { 6427 if (!options) options = {} 6428 var s = renderS('<div class="barOpenBoxEf" style="top: {startY}px;left:{startX}px;width:{startW}px;height:{startH}px;opacity: 1"></div>', { 6429 startX: startX, 6430 startY: startY, 6431 startW: startW, 6432 startH: startH 6433 }); 6434 var box = $j(s).appendTo($j('body')); 6435 box.animate({ 6436 top: dstY, 6437 left: dstX, 6438 width: dstW, 6439 height: dstH, 6440 opacity: options.dstOpacity ? options.dstOpacity : 0.1 6441 }, 500, 'easeInOutCubic').animate({ 6442 opacity:0 6443 },200, 'swing', function() { 6444 box.remove(); 6445 }); 6446} 6447 6448function barShowTipArrow(options) { 6449 var x = options.x; 6450 var y = options.y;
6451 var direction = options.direction ? options.direction : 'right'; 6452 var s = ''; 6453 6454 s += '<div class="peTipArrowDiv" style="top:{y}px;left:{x}px;opacity:0;position:{options.position};">'; 6455 s += '<i class="fa fa fa-arrow-{direction}"></i>'; 6456 s += '</div>'; 6457 s = renderS(s, { 6458 direction: direction, 6459 x: x-70, 6460 y: y+5, 6461 options: options 6462 }); 6463 6464 var box = $j(s).appendTo($j('body')); 6465 box.data('stopped', false); 6466 var loopCount = 0; 6467 function loop() { 6468 if (box.data('stopped')) return; 6469 box.animate({ 6470 'margin-left': 50, 6471 'opacity': 1 6472 }, 300, 'linear').delay(500).animate({ 6473 'opacity': 0 6474 }, 200, 'linear', function() { 6475 box.css('margin-left',0); 6476 loopCount++; 6477 if (options.loopCount && loopCount >= options.loopCount) { 6478 box.data('stopped',true); 6479 box.remove(); 6480 } else { 6481 loop(); 6482 } 6483 }); 6484 } 6485 6486 loop(); 6487 setTimeout(function() { 6488 $j(document).off('click.peArrowTip').on('click.peArrowTip',function() { 6489 $j('body').children('.peTipArrowDiv').each(function() { 6490 $j(this).data('stoppped',true); 6491 $j(this).remove(); 6492 $j(document).off('click.peArrowTip'); 6493 }); 6494 }); 6495 }, 300); 6496 6497 return box; 6498} 6499 6500var barMapsDoneFuncs = []; 6501function barMapsApiLoaded() { 6502 if (barMapsDoneFuncs) { 6503 for (var i=0;i<barMapsDoneFuncs.length;i++) { 6504 barMapsDoneFuncs[i](); 6505 } 6506 barMapsDoneFuncs = []; 6507 } 6508} 6509 6510function barLoadMapsApi(apiKey, onload) { 6511 barMapsDoneFuncs.push(onload); 6512 6513 barJsLibraryLoad('https://maps.googleapis.com/maps/api/js?key='+apiKey+'&sensor=false&callback=barMapsApiLoaded', null, barMapsApiLoaded); 6514} 6515 6516 6517function barToggleSideBar(val) { 6518 $j('#edubar').toggleClass('edubarSidebarHidden',!val); 6519 $j('#bar_mainDiv').toggleClass('edubarSidebarHidden',!val); 6520} 6521 6522function barToggleEdubarHeader(val) { 6523 $j('#edubar .edubarHeader').toggle(val); 6524 $j('#barHeaderMargin').toggle(val); 6525 $j('#bar_mainDiv').toggleClass('edubarHeaderHidden',!val); 6526 $j('#bar_chatPanel').toggle(val); 6527} 6528 6529function barEdubarHeaderIsHidden() { 6530 return $j('#bar_mainDiv').hasClass('edubarHeaderHidden'); 6531} 6532function barToggleEdubarLogo(val, showBack) { 6533 $j('#edubar .edubarHeaderTitle').toggle(val); 6534 $j('#edubar #edubarStartButton').toggle(val); 6535 if (showBack) { 6536 var s = renderS('<a href="{url}" class="edubarSmartLink edubarBackBtn">',{ 6537 'url': edubar && (edubar.options.school_country == 'pl' || edubar.options.lang == 'pl') ? '/' : '/user/' 6538 }); 6539 s += '<i class="fa fa-fw fa-arrow-left"></i></a>'; 6540 6541 var btn = $j(s).appendTo($j('#edubar .edubarHeader')); 6542 } else { 6543 $j('#edubar .edubarHeader .edubarBackBtn').remove(); 6544 } 6545} 6546 6547function barToggleEdubarBorder(val) { 6548 $j('#edubar').toggleClass('edubarNoBorder',!val); 6549} 6550 6551function barAddBackUrl(toUrl, backUrl) { 6552 if (!backUrl) { 6553 backUrl = window.location.pathname+window.location.search; 6554 } 6555 6556 toUrl = toUrl += '&ebu='+encodeURIComponent(backUrl); 6557 return toUrl; 6558} 6559 6560function barIsAscSupportLogin() { 6561 return !!window.isAscSupportLogin; 6562} 6563 6564function barToggleLoadingIndicator(val, id) { 6565 if (!id) id = 'barSmartLinkLoadingDiv'; 6566 $('#'+id).remove(); 6567 6568 if (val) { 6569 var sl = ''; 6570 sl += '<div class="edubar-loading-indicator" id="'+et(id)+'">'; 6571 sl += '<div class="edubar-loading-line"></div>'; 6572 sl += '<div class="edubar-loading-subline edubar-loading-inc"></div>'; 6573 sl += '<div class="edubar-loading-subline edubar-loading-dec"></div>'; 6574 sl += '</div>'; 6575 $j('body').append(sl); 6576 $('#barSmartLinkLoadingDiv').show(); 6577 } 6578} 6579 6580 6581function barStartLoading(elem) { 6582 var el = elem ? elem : window; 6583 6584 if (!el.barLoadingIndicatorCount) el.barLoadingIndicatorCount = 0; 6585 6586 if (el.barLoadingIndicatorCount==0) 6587 barToggleLoadingIndicator(true); 6588 6589 el.barLoadingIndicatorCount++; 6590 6591 if (elem) { 6592 $(elem).on('remove', function() { 6593 barEndLoading(elem); 6594 }); 6595 } 6596} 6597 6598function barEndLoading(elem) { 6599 var el = elem ? elem : window; 6600 6601 if (!el.barLoadingIndicatorCount) { 6602 el.barLoadingIndicatorCount = 0; 6603 } else { 6604 el.barLoadingIndicatorCount--; 6605 } 6606 6607 if (el.barLoadingIndicatorCount<=0) 6608 barToggleLoadingIndicator(false); 6609} 6610 6611var MobileAppBridge = {}; 6612MobileAppBridge._isIOS = null; 6613MobileAppBridge.isIOS = function() { 6614 if (MobileAppBridge._isIOS === null) { 6615 MobileAppBridge._isIOS = MobileAppBridge.isIOS0(); 6616 } 6617 return MobileAppBridge._isIOS; 6618} 6619MobileAppBridge.isIOS0 = function() { 6620 if (document && document.location && document.location.protocol == 'eduapp:') { 6621 return true; 6622 } 6623 6624 if (!!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform)) { 6625 return true; 6626 } 6627 if (navigator.userAgent && /iPad|iPhone|iPod/i.test(navigator.userAgent) && !window.MSStream) { 6628 return true; 6629 } 6630 6631 6632 return false; 6633} 6634 6635MobileAppBridge.getWebviewANE = function() { 6636 if (typeof webViewANE != 'undefined' && webViewANE) { 6637 return webViewANE; 6638 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.webViewANE) { 6639 return window.webkit.messageHandlers.webViewANE; 6640 } 6641 return null; 6642} 6643 6644MobileAppBridge.webview_call = function(method, params) { 6645 if (!MobileAppBridge.getWebviewANE()) return false; 6646 6647 var isAndroid = /Android/.test(navigator.userAgent); 6648 var messageToPost = { 6649 'functionName': method, 6650 'callbackName': '', 6651 'args': params ? params : [] 6652 }; 6653 6654 MobileAppBridge.getWebviewANE().postMessage(isAndroid ? JSON.stringify(messageToPost) : messageToPost); 6655 return true; 6656} 6657 6658MobileAppBridge.compareVersion = function(v1,v2) { 6659 if (typeof v1 !== 'string') return false; 6660 if (typeof v2 !== 'string') return false;
6661 v1 = v1.split('.'); 6662 v2 = v2.split('.'); 6663 var k = Math.min(v1.length, v2.length); 6664 for (var i = 0; i < k; ++ i) { 6665 v1[i] = parseInt(v1[i], 10); 6666 v2[i] = parseInt(v2[i], 10); 6667 if (v1[i] > v2[i]) return 1; 6668 if (v1[i] < v2[i]) return -1; 6669 } 6670 return v1.length == v2.length ? 0: (v1.length < v2.length ? -1 : 1); 6671} 6672 6673MobileAppBridge.isMinAppVersion = function(v) { 6674 return MobileAppBridge.compareVersion(window.AscMobileAppVersion, v) >= 0; 6675} 6676 6677MobileAppBridge.runFlexMethod = function(method, params) { 6678 if (!MobileAppBridge.isActive()) return; 6679 6680 if (window.AscNativeWebview) { 6681 $(window).trigger("runFlexMethodInvoked",[method, params]); 6682 } else 6683 if (typeof MobileAppData != 'undefined') { 6684 MobileAppData[method].apply(MobileAppData, params); 6685 } else 6686 if (MobileAppBridge.getWebviewANE()) { 6687 MobileAppBridge.webview_call('webview_runMethod',[method, params]); 6688 } else { 6689 if (!this.locationCounter) this.locationCounter = 0; 6690 6691 6692 this.locationCounter++; 6693 6694 var ret = { 6695 method: method, 6696 params: params, 6697 locationCounter: this.locationCounter 6698 } 6699 6700 var qs = JSON.stringify(ret); 6701 var maxL = 500; 6702 6703 6704 if (qs.length > maxL && MobileAppBridge.isMinAppVersion('2019.5.20')) { 6705 MobileAppBridge.flexMethodParts = []; 6706 var i = 0; 6707 while (i < qs.length) { 6708 var ss = qs.substr(i,maxL); 6709 if (i+maxL < qs.length) { 6710 ss += '##tl##'; 6711 } 6712 this.flexMethodParts.push(ss); 6713 i += maxL; 6714 } 6715 MobileAppBridge.flexMethodParts.reverse(); 6716 qs = MobileAppBridge.flexMethodParts.pop(); 6717 } 6718 6719 6720 var str = 'https://flexmethod/'+Base64.encode(qs, true); 6721 6722 window.location = str; 6723 } 6724} 6725 6726MobileAppBridge.sendNextFlexPart = function() { 6727 if (!MobileAppBridge.flexMethodParts) { 6728 return; 6729 } 6730 var qs = MobileAppBridge.flexMethodParts.pop(); 6731 var str = 'https://flexmethod/'+Base64.encode(qs, true); 6732 window.location = str; 6733} 6734 6735MobileAppBridge.externalFunctions = {}; 6736MobileAppBridge.registerJsFunction = function(name, func) { 6737 MobileAppBridge.externalFunctions[name] = func; 6738} 6739 6740MobileAppBridge.registerJsFunctions = function(obj) { 6741 for (var x in obj) { 6742 MobileAppBridge.externalFunctions[x] = obj[x]; 6743 } 6744} 6745 6746MobileAppBridge.runJsFunction = function(name, params) { 6747 if (MobileAppBridge.externalFunctions[name]) { 6748 if (typeof params == 'string' && params.substr(0,3) == 'b64') { 6749 try { 6750 params = JSON.parse(Base64.decode(params.substr(3),true)); 6751 } catch (e) { 6752 alert('err'); 6753 } 6754 } 6755 MobileAppBridge.externalFunctions[name].apply(null, $j.isArray(params) ? params : [params]); 6756 } 6757} 6758 6759MobileAppBridge.isActive = function() { 6760 return !!window.AscMobileAppVersion; 6761} 6762 6763 6764MobileAppBridge._isV2Active = null; 6765MobileAppBridge.isV2Active = function() { 6766 if (MobileAppBridge._isV2Active === null) { 6767 MobileAppBridge._isV2Active = !!window.AscMobileAppVersion && $('body').hasClass('mobileBodyV2'); 6768 } 6769 return !!MobileAppBridge._isV2Active; 6770} 6771 6772MobileAppBridge.registerBackHandler = function(elem, func) { 6773 if (MobileAppBridge.isV2Active()) { 6774 barRegisterPopstateHandler(elem, func); 6775 return; 6776 } 6777 if (!MobileAppBridge.backHandlers) MobileAppBridge.backHandlers = []; 6778 var self = this; 6779 $j(elem).on('remove', function() { 6780 var pom = []; 6781 for (var i=0;i<MobileAppBridge.backHandlers.length;i++) { 6782 var r = MobileAppBridge.backHandlers[i]; 6783 if (r.elem == elem) continue; 6784 pom.push(r); 6785 } 6786 MobileAppBridge.backHandlers = pom; 6787 }); 6788 6789 var pom = []; 6790 for (var i=0;i<MobileAppBridge.backHandlers.length;i++) { 6791 var r = MobileAppBridge.backHandlers[i]; 6792 if (r.elem == elem) continue; 6793 pom.push(r); 6794 } 6795 MobileAppBridge.backHandlers = pom; 6796 6797 MobileAppBridge.backHandlers.push({'elem': elem, 'func' : func}); 6798} 6799MobileAppBridge.skipBack = function() { 6800 if (MobileAppBridge.getWebviewANE()) { 6801 MobileAppBridge.webview_call('webview_skipBack',[]); 6802 } else { 6803 window.location = 'https://skipback/'; 6804 } 6805} 6806 6807MobileAppBridge.goBack = function() { 6808 if (MobileAppBridge.getWebviewANE()) { 6809 MobileAppBridge.webview_call('webview_goBack',[]); 6810 } else { 6811 window.location = 'https://goback/'; 6812 } 6813} 6814MobileAppBridge.handleBackClick = function() { 6815 var dlgs = $j('body').find('.ui-dialog'); 6816 6817 if (dlgs.length > 0) { 6818 var dlg = dlgs.last(); 6819 if (!dlg.hasClass('noBackClose')) { 6820 barCloseDialog(dlg.find('.ui-dialog-content')); 6821 if (MobileAppBridge.getWebviewANE()) {
6822 MobileAppBridge.webview_call('webview_skipBack',[]); 6823 } else { 6824 window.location = 'https://skipback/'; 6825 } 6826 return; 6827 } 6828 } 6829 6830 if (MobileAppBridge.backHandlers && MobileAppBridge.backHandlers.length > 0) { 6831 for (var i=MobileAppBridge.backHandlers.length-1;i>=0;i--) { 6832 var r = MobileAppBridge.backHandlers[i]; 6833 //if ($j(r.elem).closest('body').length > 0) { 6834 if (r.func() === 'goback') { 6835 if (MobileAppBridge.getWebviewANE()) { 6836 MobileAppBridge.webview_call('webview_goBack',[]); 6837 } else { 6838 window.location = 'https://goback/'; 6839 } 6840 } else { 6841 if (MobileAppBridge.getWebviewANE()) { 6842 MobileAppBridge.webview_call('webview_skipBack',[]); 6843 } else { 6844 window.location = 'https://skipback/'; 6845 } 6846 } 6847 return; 6848 //} 6849 } 6850 } 6851 6852 if (MobileAppBridge.subviewStack && MobileAppBridge.subviewStack.length>1) { 6853 6854 6855 if (MobileAppBridge.getWebviewANE()) { 6856 MobileAppBridge.webview_call('webview_skipBack',[]); 6857 } else { 6858 window.location = 'https://skipback/'; 6859 } 6860 6861 6862 return; 6863 } 6864 6865 if (MobileAppBridge.getWebviewANE()) { 6866 MobileAppBridge.webview_call('webview_goBack',[]); 6867 } else { 6868 window.location = 'https://goback/'; 6869 } 6870 6871} 6872 6873MobileAppBridge.useInWebviewPlayer = function() { 6874 if (!window.AscMobileAppVersion) return false; 6875 var pom = window.AscMobileAppVersion.split('.'); 6876 if (pom[0] < 2018) return false; 6877 if (pom[0] == 2018 && pom[1] < 4) return false; 6878 if (pom[0] == 2018 && pom[1] == 4 && pom[2] < 8) return false; 6879 return true; 6880} 6881 6882 6883 6884var BarQIntroAssistent = {}; 6885BarQIntroAssistent.createElem = function() { 6886 var s = ''; 6887 s += '<div class="edubar-qiassist-main">'; 6888 s += '<img class="edubar-qiassist-einsty edubar-qiassist-einsty1" src="/elearning/pics/icons/einstyl1s.png" alt="">'; 6889 s += '<img class="edubar-qiassist-einsty edubar-qiassist-einsty2" src="/elearning/pics/icons/einstyl2s.png" alt="">'; 6890 s += '</div>'; 6891 this.element = $j(s).appendTo('#edubar'); 6892} 6893BarQIntroAssistent.addQIntros = function(qintros, parentElem) { 6894 return;//od 2020-05-14 zrusene na miladkinu ziadost 6895 if (MobileAppBridge.isActive()) return; 6896 6897 var self = this; 6898 this.remove(); 6899 barLoadGoogleFont('Kalam'); 6900 6901 var srcs = ['/global/pics/js/jquery/jquery.easing.min.js']; 6902 6903 if (!window.qintros) { 6904 srcs.push('/quickintro/getListG'); 6905 } 6906 6907 var ts = (new Date()).getTime(); 6908 barRequireJs(srcs, function() { 6909 ts = (new Date()).getTime()-ts; 6910 setTimeout(function() { 6911 6912 self.addQIntros0(qintros, parentElem); 6913 }, Math.max(1, 200-ts)); 6914 }); 6915} 6916 6917BarQIntroAssistent.addQIntros0 = function(qintros, parentElem) { 6918 var $ = $j; 6919 var self = this; 6920 6921 var seenSlides = edubar && edubar.options.seenqi 6922 ? edubar.options.seenqi 6923 : {}; 6924 6925 if (!self.element) { 6926 self.createElem(); 6927 } 6928 6929 if (!self.intros) { 6930 self.intros = {}; 6931 } 6932 var s = ''; 6933 var sl = ''; 6934 for (var i=0;i<qintros.length;i++) { 6935 var qid = qintros[i].qintroid; 6936 6937 if (!self.intros[qid]) { 6938 self.intros[qid] = { 6939 id: qid, 6940 title: window.qintros && window.qintros[qid] 6941 ? window.qintros[qid].name 6942 : (qintros[i].title ? qintros[i].title : 'Help'), 6943 parentElems: [], 6944 link: qintros[i].link ? qintros[i].link : null 6945 } 6946 if (!seenSlides[qid]) { 6947 s += self.getQIntroIcon(self.intros[qid]); 6948 } 6949 6950 sl += self.getHelpListItem(self.intros[qid]); 6951 } 6952 self.intros[qid].parentElems.push(parentElem); 6953 } 6954 6955 if (parentElem) { 6956 $j(parentElem).on('remove',function() { 6957 6958 var poc = 0; 6959 for (var qid in self.intros) { 6960 var qdata = self.intros[qid]; 6961 var ind = EdubarUtils.indexOf(qdata.parentElems, parentElem) 6962 if (ind >= 0) { 6963 qdata.parentElems.splice(ind,1); 6964 } 6965 if (qdata.parentElems.length == 0) { 6966 if (self.intros[qid].element) { 6967 self.intros[qid].element.remove(); 6968 } 6969 6970 if (self.intros[qid].helpListElement) { 6971 self.intros[qid].helpListElement.remove(); 6972 } 6973 delete self.intros[qid]; 6974 6975 } else { 6976 poc++; 6977 } 6978 } 6979 if (poc == 0) { 6980 $j('#edubarHelpListQintrosHeader').remove(); 6981 self.remove(); 6982 } 6983 }); 6984 } 6985 6986 if (s) { 6987 6988 self.element.find('.edubar-qiassist-item').finish();
6989 self.element.toggleClass('shaked',false); 6990 if (self.shakeMeTimeout) { 6991 clearTimeout(self.shakeMeTimeout); 6992 } 6993 6994 var elems = $j(s).appendTo(this.element); 6995 6996 6997 6998 var i = 2; 6999 elems.each(function() { 7000 var qid = $j(this).attr('data-qid'); 7001 self.intros[qid].element = $j(this); 7002 //$j(this).fadeIn('fast'); 7003 $j(this).delay(i*250).animate({ 7004 opacity: 1, 7005 'right': '0px' 7006 }, 800,'easeOutElastic'); 7007 i++; 7008 }); 7009 7010 self.element.find('.edubar-qiassist-einsty1').hide(); 7011 self.element.toggleClass('inited0', true); 7012 7013 setTimeout(function() { 7014 if (self.element) { 7015 7016 self.element.find('.edubar-qiassist-einsty1').fadeIn('fast', function() { 7017 if (self.element) { 7018 self.element.toggleClass('inited', true); 7019 } 7020 }); 7021 } 7022 },i*250+500); 7023 7024 7025 7026 7027 elems.on('click',function() { 7028 var qid = $j(this).attr('data-qid'); 7029 var offset = self.intros[qid].element.offset(); 7030 7031 var top = -(offset.top - $j(window).height()/2); 7032 var right = offset.left - $j(window).width()/2; 7033 seenSlides[qid] = true; 7034 if (self.intros[qid].link) { 7035 barSmartLoadPage(self.intros[qid].link); 7036 return; 7037 } 7038 self.intros[qid].element.toggleClass('opened', true).animate({ 7039 'right': right+'px', 7040 'top': top+'px' 7041 },300,'swing',function() { 7042 self.intros[qid].element.find('.edubar-qiassist-fa').toggleClass('fa-spin',true); 7043 $j.post('/quickintro/?cmd=QIntroSlider&forceShow=1&template='+qid, {}, function(data) { 7044 $j('body').append(data); 7045 setTimeout(function() { 7046 self.intros[qid].element.find('.edubar-qiassist-fa').toggleClass('fa-spin',false); 7047 }, 500); 7048 }); 7049 7050 var poc = 0; 7051 for (var id in self.intros) { 7052 if (id != qid && self.intros[id].element) poc++; 7053 } 7054 if (poc == 0) { 7055 self.element.find('.edubar-qiassist-einsty').hide(); 7056 } 7057 7058 }).find('.edubar-qiassist-icon-outer').animate({ 7059 'border-radius': '5px' 7060 },300, 'swing'); 7061 }); 7062 } 7063 7064 if (sl) { 7065 if ($j('#edubarHelpListQintrosHeader').length == 0) { 7066 var s = ''; 7067 s += '<li class="qintro-item" id="edubarHelpListQintrosHeader">'; 7068 s += '<hr>'; 7069 s += '<h1>Quick intro</h1>'; 7070 s += '<hr>'; 7071 s += '</li>'; 7072 7073 $j(s).appendTo($j('#edubarHelpMenuList')); 7074 } 7075 var helpListElems = $j(sl).insertAfter($j('#edubarHelpMenuList .qintro-item').last()); 7076 7077 helpListElems.each(function() { 7078 var qid = $j(this).attr('data-qid'); 7079 self.intros[qid].helpListElement = $j(this); 7080 }).click(function() { 7081 var qid = $j(this).attr('data-qid'); 7082 $j.post('/quickintro/?cmd=QIntroSlider&forceShow=1&template='+qid, {}, function(data) { 7083 $j('body').append(data); 7084 }); 7085 }); 7086 } 7087 7088 if (!self.shakeMeTimeout) { 7089 self.shakeMeTimeout = setTimeout(function() { 7090 BarQIntroAssistent.shakeMe(); 7091 }, 5000); 7092 } 7093 7094 $j(document).off('qintroclosed'); 7095 $j(document).on('qintroclosed', function(event, qintroid) { 7096 7097 if (self.intros[qintroid] && self.intros[qintroid].element) { 7098 var poc = 0; 7099 for (var qid in self.intros) { 7100 if (qid != qintroid && self.intros[qid].element) poc++; 7101 } 7102 if (poc == 0) { 7103 self.element.find('.edubar-qiassist-einsty').hide(); 7104 } 7105 console.log(poc); 7106 self.intros[qintroid].element.toggleClass('opened', false).toggleClass('moved', true).animate({ 7107 top: '0px', 7108 right: '160px', 7109 opacity: '0.01' 7110 }, 400, function () { 7111 if (edubar) { 7112 if (!edubar.options.seenqi) edubar.options.seenqi = {}; 7113 edubar.options.seenqi[qintroid] = (new Date()).format('Y-m-d H:i:s'); 7114 } 7115 //self.intros[qintroid].element.fadeOut(100, function() { 7116 self.intros[qintroid].element.remove(); 7117 self.intros[qintroid].element = null; 7118 $j('#edubarHelpMenuBtn').toggleClass('edubar-qiassist-zoomed', true); 7119 setTimeout(function() { 7120 $j('#edubarHelpMenuBtn').toggleClass('edubar-qiassist-zoomed', false); 7121 },400); 7122 7123 console.log(poc); 7124 if (poc == 0) { 7125 self.remove(); 7126 } 7127 //}); 7128 }); 7129 } 7130 }); 7131 7132 7133 self.element.hover(function() { 7134 self.hovered = true; 7135 },function() { 7136 self.hovered = false; 7137 }); 7138} 7139BarQIntroAssistent.shakeMe = function() { 7140 var self = this; 7141 self.shakeMeTimeout = null; 7142 7143 if (!self.element) return; 7144 var i = 0; 7145 if (!self.hovered && $j('body').children('.qiSliderContainer').length == 0 && !document.hidden) { 7146 self.element.find('.edubar-qiassist-item').each(function() { 7147 if ($j(this).hasClass('moved') || $j(this).hasClass('opened')) return; 7148 $j(this).delay(i*350).effect('bounce', {direction: 'left', distance: 20}, 'slow'); 7149 i++; 7150 }); 7151 7152 self.element.toggleClass('shaked'); 7153 setTimeout(function() { 7154 if (!self.element) return; 7155 self.element.toggleClass('shaked'); 7156 }, 1000); 7157 } 7158 7159 7160 this.shakeMeTimeout = setTimeout(function() { 7161 BarQIntroAssistent.shakeMe(); 7162 }, 2000*(1+Math.random()*9)); 7163 7164} 7165
7166BarQIntroAssistent.getHelpListItem = function(r) { 7167 var s = ''; 7168 s += '<li class="qintro-item" data-qid="{r.id}">'; 7169 if (r.link) { 7170 s += '<a class="edubarSmartLink" href="{r.link}" style="padding: 8px 10px">'; 7171 } else { 7172 s += '<a class="edubar-qassist-qintrolink" style="padding: 8px 10px">'; 7173 } 7174 s += '<i class="fa fa-fw fa-info" style="font-size:18px;width:32px;height:18px;padding-top:0px;vertical-align: middle;margin-right:5px"></i>'; 7175 s += '<span class="title" style="font-size: 13px;white-space:normal">'; 7176 s += '{r.title}'; 7177 s += '</span>'; 7178 7179 s += '</a>'; 7180 s += '</li>'; 7181 7182 s = renderS(s, {r: r}); 7183 return s; 7184} 7185 7186BarQIntroAssistent.getQIntroIcon = function(r) { 7187 var s= ''; 7188 s += '<div class="edubar-qiassist-item" data-qid="{r.id}" tabindex="0">'; 7189 s += '<div class="edubar-qiassist-icon-outer">'; 7190 s += '<i class="fa fa-info edubar-qiassist-fa"></i>'; 7191 //s += '<i class="edubar-qiassist-icon"></i>'; 7192 7193 s += '<div class="edubar-qiassist-title1">'; 7194 //s += '<div class="edubar-qiassist-title0">Quick how to:</div>'; 7195 s += '<span class="edubar-qiassist-title-text">{r.title}</span>'; 7196 s += '</div>'; 7197 s += '</div>'; 7198 7199 s += '</div>'; 7200 s = renderS(s, {r: r}); 7201 7202 return s; 7203} 7204 7205BarQIntroAssistent.remove = function() { 7206 var self = this; 7207 if (this.intros) { 7208 for (var qid in this.intros) { 7209 if (self.intros[qid].element) { 7210 self.intros[qid].element.remove(); 7211 } 7212 7213 if (self.intros[qid].helpListElement) { 7214 self.intros[qid].helpListElement.remove(); 7215 } 7216 } 7217 } 7218 this.intros = null 7219 if (this.element) { 7220 $j(this.element).remove(); 7221 this.element = null; 7222 } 7223 $j(document).off('qintroclosed'); 7224} 7225 7226 7227var LZString=function(){function o(o,r){if(!t[o]){t[o]={};for(var n=0;n<o.length;n++)t[o][o.charAt(n)]=n}return t[o][r]}var r=String.fromCharCode,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",t={},i={compressToBase64:function(o){if(null==o)return"";var r=i._compress(o,6,function(o){return n.charAt(o)});switch(r.length%4){default:case 0:return r;case 1:return r+"===";case 2:return r+"==";case 3:return r+"="}},decompressFromBase64:function(r){return null==r?"":""==r?null:i._decompress(r.length,32,function(e){return o(n,r.charAt(e))})},compressToUTF16:function(o){return null==o?"":i._compress(o,15,function(o){return r(o+32)})+" "},decompressFromUTF16:function(o){return null==o?"":""==o?null:i._decompress(o.length,16384,function(r){return o.charCodeAt(r)-32})},compressToUint8Array:function(o){for(var r=i.compress(o),n=new Uint8Array(2*r.length),e=0,t=r.length;t>e;e++){var s=r.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null===o||void 0===o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;t>e;e++)n[e]=256*o[2*e]+o[2*e+1];var s=[];return n.forEach(function(o){s.push(r(o))}),i.decompress(s.join(""))},compressToEncodedURIComponent:function(o){return null==o?"":i._compress(o,6,function(o){return e.charAt(o)})},decompressFromEncodedURIComponent:function(r){return null==r?"":""==r?null:(r=r.replace(/ /g,"+"),i._decompress(r.length,32,function(n){return o(e,r.charAt(n))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(o,r,n){if(null==o)return"";var e,t,i,s={},p={},u="",c="",a="",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;i<o.length;i+=1)if(u=o.charAt(i),Object.prototype.hasOwnProperty.call(s,u)||(s[u]=f++,p[u]=!0),c=a+u,Object.prototype.hasOwnProperty.call(s,c))a=c;else{if(Object.prototype.hasOwnProperty.call(p,a)){if(a.charCodeAt(0)<256){for(e=0;h>e;e++)m<<=1,v==r-1?(v=0,d.push(n(m)),m=0):v++;for(t=a.charCodeAt(0),e=0;8>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;h>e;e++)m=m<<1|t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=a.charCodeAt(0),e=0;16>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}l--,0==l&&(l=Math.pow(2,h),h++),delete p[a]}else for(t=s[a],e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;l--,0==l&&(l=Math.pow(2,h),h++),s[c]=f++,a=String(u)}if(""!==a){if(Object.prototype.hasOwnProperty.call(p,a)){if(a.charCo
7227deAt(0)<256){for(e=0;h>e;e++)m<<=1,v==r-1?(v=0,d.push(n(m)),m=0):v++;for(t=a.charCodeAt(0),e=0;8>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;h>e;e++)m=m<<1|t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=a.charCodeAt(0),e=0;16>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}l--,0==l&&(l=Math.pow(2,h),h++),delete p[a]}else for(t=s[a],e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;l--,0==l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==r-1){d.push(n(m));break}v++}return d.join("")},decompress:function(o){return null==o?"":""==o?null:i._decompress(o.length,32768,function(r){return o.charCodeAt(r)})},_decompress:function(o,n,e){var t,i,s,p,u,c,a,l,f=[],h=4,d=4,m=3,v="",w=[],A={val:e(0),position:n,index:1};for(i=0;3>i;i+=1)f[i]=i;for(p=0,c=Math.pow(2,2),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;switch(t=p){case 0:for(p=0,c=Math.pow(2,8),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;l=r(p);break;case 1:for(p=0,c=Math.pow(2,16),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;l=r(p);break;case 2:return""}for(f[3]=l,s=l,w.push(l);;){if(A.index>o)return"";for(p=0,c=Math.pow(2,m),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;switch(l=p){case 0:for(p=0,c=Math.pow(2,8),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;f[d++]=r(p),l=d-1,h--;break;case 1:for(p=0,c=Math.pow(2,16),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;f[d++]=r(p),l=d-1,h--;break;case 2:return w.join("")}if(0==h&&(h=Math.pow(2,m),m++),f[l])v=f[l];else{if(l!==d)return null;v=s+s.charAt(0)}w.push(v),f[d++]=s+v.charAt(0),h--,s=v,0==h&&(h=Math.pow(2,m),m++)}}};return i}();"function"==typeof define&&define.amd?define(function(){return LZString}):"undefined"!=typeof module&&null!=module&&(module.exports=LZString); 7228 7229/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';var n=void 0,u=!0,aa=this;function ba(e,d){var c=e.split("."),f=aa;!(c[0]in f)&&f.execScript&&f.execScript("var "+c[0]);for(var a;c.length&&(a=c.shift());)!c.length&&d!==n?f[a]=d:f=f[a]?f[a]:f[a]={}};var C="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function K(e,d){this.index="number"===typeof d?d:0;this.d=0;this.buffer=e instanceof(C?Uint8Array:Array)?e:new (C?Uint8Array:Array)(32768);if(2*this.buffer.length<=this.index)throw Error("invalid index");this.buffer.length<=this.index&&ca(this)}function ca(e){var d=e.buffer,c,f=d.length,a=new (C?Uint8Array:Array)(f<<1);if(C)a.set(d);else for(c=0;c<f;++c)a[c]=d[c];return e.buffer=a} 7230K.prototype.a=function(e,d,c){var f=this.buffer,a=this.index,b=this.d,k=f[a],m;c&&1<d&&(e=8<d?(L[e&255]<<24|L[e>>>8&255]<<16|L[e>>>16&255]<<8|L[e>>>24&255])>>32-d:L[e]>>8-d);if(8>d+b)k=k<<d|e,b+=d;else for(m=0;m<d;++m)k=k<<1|e>>d-m-1&1,8===++b&&(b=0,f[a++]=L[k],k=0,a===f.length&&(f=ca(this)));f[a]=k;this.buffer=f;this.d=b;this.index=a};K.prototype.finish=function(){var e=this.buffer,d=this.index,c;0<this.d&&(e[d]<<=8-this.d,e[d]=L[e[d]],d++);C?c=e.subarray(0,d):(e.length=d,c=e);return c}; 7231var ga=new (C?Uint8Array:Array)(256),M;for(M=0;256>M;++M){for(var R=M,S=R,ha=7,R=R>>>1;R;R>>>=1)S<<=1,S|=R&1,--ha;ga[M]=(S<<ha&255)>>>0}var L=ga;function ja(e){this.buffer=new (C?Uint16Array:Array)(2*e);this.length=0}ja.prototype.getParent=function(e){return 2*((e-2)/4|0)};ja.prototype.push=function(e,d){var c,f,a=this.buffer,b;c=this.length;a[this.length++]=d;for(a[this.length++]=e;0<c;)if(f=this.getParent(c),a[c]>a[f])b=a[c],a[c]=a[f],a[f]=b,b=a[c+1],a[c+1]=a[f+1],a[f+1]=b,c=f;else break;return this.length}; 7232ja.prototype.pop=function(){var e,d,c=this.buffer,f,a,b;d=c[0];e=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(b=0;;){a=2*b+2;if(a>=this.length)break;a+2<this.length&&c[a+2]>c[a]&&(a+=2);if(c[a]>c[b])f=c[b],c[b]=c[a],c[a]=f,f=c[b+1],c[b+1]=c[a+1],c[a+1]=f;else break;b=a}return{index:e,value:d,length:this.length}};function ka(e,d){this.e=ma;this.f=0;this.input=C&&e instanceof Array?new Uint8Array(e):e;this.c=0;d&&(d.lazy&&(this.f=d.lazy),"number"===typeof d.compressionType&&(this.e=d.compressionType),d.outputBuffer&&(this.b=C&&d.outputBuffer instanceof Array?new Uint8Array(d.outputBuffer):d.outputBuffer),"number"===typeof d.outputIndex&&(this.c=d.outputIndex));this.b||(this.b=new (C?Uint8Array:Array)(32768))}var ma=2,T=[],U; 7233for(U=0;288>U;U++)switch(u){case 143>=U:T.push([U+48,8]);break;case 255>=U:T.push([U-144+400,9]);break;case 279>=U:T.push([U-256+0,7]);break;case 287>=U:T.push([U-280+192,8]);break;default:throw"invalid literal: "+U;} 7234ka.prototype.h=function(){var e,d,c,f,a=this.input;switch(this.e){case 0:c=0;for(f=a.length;c<f;){d=C?a.subarray(c,c+65535):a.slice(c,c+65535);c+=d.length;var b=d,k=c===f,m=n,g=n,p=n,v=n,x=n,l=this.b,h=this.c;if(C){for(l=new Uint8Array(this.b.buffer);l.length<=h+b.length+5;
vendor: 4,296 bytes, lines 7234-7244
7234)l=new Uint8Array(l.length<<1);l.set(this.b)}m=k?1:0;l[h++]=m|0;g=b.length;p=~g+65536&65535;l[h++]=g&255;l[h++]=g>>>8&255;l[h++]=p&255;l[h++]=p>>>8&255;if(C)l.set(b,h),h+=b.length,l=l.subarray(0,h);else{v=0;for(x=b.length;v<x;++v)l[h++]= 7235b[v];l.length=h}this.c=h;this.b=l}break;case 1:var q=new K(C?new Uint8Array(this.b.buffer):this.b,this.c);q.a(1,1,u);q.a(1,2,u);var t=na(this,a),w,da,z;w=0;for(da=t.length;w<da;w++)if(z=t[w],K.prototype.a.apply(q,T[z]),256<z)q.a(t[++w],t[++w],u),q.a(t[++w],5),q.a(t[++w],t[++w],u);else if(256===z)break;this.b=q.finish();this.c=this.b.length;break;case ma:var B=new K(C?new Uint8Array(this.b.buffer):this.b,this.c),ra,J,N,O,P,Ia=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],W,sa,X,ta,ea,ia=Array(19), 7236ua,Q,fa,y,va;ra=ma;B.a(1,1,u);B.a(ra,2,u);J=na(this,a);W=oa(this.j,15);sa=pa(W);X=oa(this.i,7);ta=pa(X);for(N=286;257<N&&0===W[N-1];N--);for(O=30;1<O&&0===X[O-1];O--);var wa=N,xa=O,F=new (C?Uint32Array:Array)(wa+xa),r,G,s,Y,E=new (C?Uint32Array:Array)(316),D,A,H=new (C?Uint8Array:Array)(19);for(r=G=0;r<wa;r++)F[G++]=W[r];for(r=0;r<xa;r++)F[G++]=X[r];if(!C){r=0;for(Y=H.length;r<Y;++r)H[r]=0}r=D=0;for(Y=F.length;r<Y;r+=G){for(G=1;r+G<Y&&F[r+G]===F[r];++G);s=G;if(0===F[r])if(3>s)for(;0<s--;)E[D++]=0, 7237H[0]++;else for(;0<s;)A=138>s?s:138,A>s-3&&A<s&&(A=s-3),10>=A?(E[D++]=17,E[D++]=A-3,H[17]++):(E[D++]=18,E[D++]=A-11,H[18]++),s-=A;else if(E[D++]=F[r],H[F[r]]++,s--,3>s)for(;0<s--;)E[D++]=F[r],H[F[r]]++;else for(;0<s;)A=6>s?s:6,A>s-3&&A<s&&(A=s-3),E[D++]=16,E[D++]=A-3,H[16]++,s-=A}e=C?E.subarray(0,D):E.slice(0,D);ea=oa(H,7);for(y=0;19>y;y++)ia[y]=ea[Ia[y]];for(P=19;4<P&&0===ia[P-1];P--);ua=pa(ea);B.a(N-257,5,u);B.a(O-1,5,u);B.a(P-4,4,u);for(y=0;y<P;y++)B.a(ia[y],3,u);y=0;for(va=e.length;y<va;y++)if(Q= 7238e[y],B.a(ua[Q],ea[Q],u),16<=Q){y++;switch(Q){case 16:fa=2;break;case 17:fa=3;break;case 18:fa=7;break;default:throw"invalid code: "+Q;}B.a(e[y],fa,u)}var ya=[sa,W],za=[ta,X],I,Aa,Z,la,Ba,Ca,Da,Ea;Ba=ya[0];Ca=ya[1];Da=za[0];Ea=za[1];I=0;for(Aa=J.length;I<Aa;++I)if(Z=J[I],B.a(Ba[Z],Ca[Z],u),256<Z)B.a(J[++I],J[++I],u),la=J[++I],B.a(Da[la],Ea[la],u),B.a(J[++I],J[++I],u);else if(256===Z)break;this.b=B.finish();this.c=this.b.length;break;default:throw"invalid compression type";}return this.b}; 7239function qa(e,d){this.length=e;this.g=d} 7240var Fa=function(){function e(a){switch(u){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272, 7241a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:throw"invalid length: "+a;}}var d=[],c,f;for(c=3;258>=c;c++)f=e(c),d[c]=f[2]<<24| 7242f[1]<<16|f[0];return d}(),Ga=C?new Uint32Array(Fa):Fa; 7243function na(e,d){function c(a,c){var b=a.g,d=[],f=0,e;e=Ga[a.length];d[f++]=e&65535;d[f++]=e>>16&255;d[f++]=e>>24;var g;switch(u){case 1===b:g=[0,b-1,0];break;case 2===b:g=[1,b-2,0];break;case 3===b:g=[2,b-3,0];break;case 4===b:g=[3,b-4,0];break;case 6>=b:g=[4,b-5,1];break;case 8>=b:g=[5,b-7,1];break;case 12>=b:g=[6,b-9,2];break;case 16>=b:g=[7,b-13,2];break;case 24>=b:g=[8,b-17,3];break;case 32>=b:g=[9,b-25,3];break;case 48>=b:g=[10,b-33,4];break;case 64>=b:g=[11,b-49,4];break;case 96>=b:g=[12,b- 724465,5];break;case 128>=b:g=[13,b-97,5];break;case 192>=b:g=[14,b-129,6];break;case 256>=b:g=[15,b-193,6];break;case 384>=b:g=[16,b-257,7];break;case 512>=b:g=[17,b-385,7];break;case 768>=b:g=[18,b-513,8];break;case 1024>=b:g=[19,b-769,8];break;case 1536>=b:g=[20,b-1025,9];break;case 2048>=b:g=[21,b-1537,9];break;case 3072>=b:g=[22,b-2049,10];break;case 4096>=b:g=[23,b-3073,10];break;case 6144>=b:g=[24,b-4097,11];break;case 8192>
7244=b:g=[25,b-6145,11];break;case 12288>=b:g=[26,b-8193,12];break;case 16384>= 7245b:g=[27,b-12289,12];break;case 24576>=b:g=[28,b-16385,13];break;case 32768>=b:g=[29,b-24577,13];break;default:throw"invalid distance";}e=g;d[f++]=e[0];d[f++]=e[1];d[f++]=e[2];var k,m;k=0;for(m=d.length;k<m;++k)l[h++]=d[k];t[d[0]]++;w[d[3]]++;q=a.length+c-1;x=null}var f,a,b,k,m,g={},p,v,x,l=C?new Uint16Array(2*d.length):[],h=0,q=0,t=new (C?Uint32Array:Array)(286),w=new (C?Uint32Array:Array)(30),da=e.f,z;if(!C){for(b=0;285>=b;)t[b++]=0;for(b=0;29>=b;)w[b++]=0}t[256]=1;f=0;for(a=d.length;f<a;++f){b= 7246m=0;for(k=3;b<k&&f+b!==a;++b)m=m<<8|d[f+b];g[m]===n&&(g[m]=[]);p=g[m];if(!(0<q--)){for(;0<p.length&&32768<f-p[0];)p.shift();if(f+3>=a){x&&c(x,-1);b=0;for(k=a-f;b<k;++b)z=d[f+b],l[h++]=z,++t[z];break}0<p.length?(v=Ha(d,f,p),x?x.length<v.length?(z=d[f-1],l[h++]=z,++t[z],c(v,0)):c(x,-1):v.length<da?x=v:c(v,0)):x?c(x,-1):(z=d[f],l[h++]=z,++t[z])}p.push(f)}l[h++]=256;t[256]++;e.j=t;e.i=w;return C?l.subarray(0,h):l} 7247function Ha(e,d,c){var f,a,b=0,k,m,g,p,v=e.length;m=0;p=c.length;a:for(;m<p;m++){f=c[p-m-1];k=3;if(3<b){for(g=b;3<g;g--)if(e[f+g-1]!==e[d+g-1])continue a;k=b}for(;258>k&&d+k<v&&e[f+k]===e[d+k];)++k;k>b&&(a=f,b=k);if(258===k)break}return new qa(b,d-a)} 7248function oa(e,d){var c=e.length,f=new ja(572),a=new (C?Uint8Array:Array)(c),b,k,m,g,p;if(!C)for(g=0;g<c;g++)a[g]=0;for(g=0;g<c;++g)0<e[g]&&f.push(g,e[g]);b=Array(f.length/2);k=new (C?Uint32Array:Array)(f.length/2);if(1===b.length)return a[f.pop().index]=1,a;g=0;for(p=f.length/2;g<p;++g)b[g]=f.pop(),k[g]=b[g].value;m=Ja(k,k.length,d);g=0;for(p=b.length;g<p;++g)a[b[g].index]=m[g];return a} 7249function Ja(e,d,c){function f(a){var b=g[a][p[a]];b===d?(f(a+1),f(a+1)):--k[b];++p[a]}var a=new (C?Uint16Array:Array)(c),b=new (C?Uint8Array:Array)(c),k=new (C?Uint8Array:Array)(d),m=Array(c),g=Array(c),p=Array(c),v=(1<<c)-d,x=1<<c-1,l,h,q,t,w;a[c-1]=d;for(h=0;h<c;++h)v<x?b[h]=0:(b[h]=1,v-=x),v<<=1,a[c-2-h]=(a[c-1-h]/2|0)+d;a[0]=b[0];m[0]=Array(a[0]);g[0]=Array(a[0]);for(h=1;h<c;++h)a[h]>2*a[h-1]+b[h]&&(a[h]=2*a[h-1]+b[h]),m[h]=Array(a[h]),g[h]=Array(a[h]);for(l=0;l<d;++l)k[l]=c;for(q=0;q<a[c-1];++q)m[c- 72501][q]=e[q],g[c-1][q]=q;for(l=0;l<c;++l)p[l]=0;1===b[c-1]&&(--k[0],++p[c-1]);for(h=c-2;0<=h;--h){t=l=0;w=p[h+1];for(q=0;q<a[h];q++)t=m[h+1][w]+m[h+1][w+1],t>e[l]?(m[h][q]=t,g[h][q]=d,w+=2):(m[h][q]=e[l],g[h][q]=l,++l);p[h]=0;1===b[h]&&f(h)}return k} 7251function pa(e){var d=new (C?Uint16Array:Array)(e.length),c=[],f=[],a=0,b,k,m,g;b=0;for(k=e.length;b<k;b++)c[e[b]]=(c[e[b]]|0)+1;b=1;for(k=16;b<=k;b++)f[b]=a,a+=c[b]|0,a<<=1;b=0;for(k=e.length;b<k;b++){a=f[e[b]];f[e[b]]+=1;m=d[b]=0;for(g=e[b];m<g;m++)d[b]=d[b]<<1|a&1,a>>>=1}return d};ba("Zlib.RawDeflate",ka);ba("Zlib.RawDeflate.prototype.compress",ka.prototype.h);var Ka={NONE:0,FIXED:1,DYNAMIC:ma},V,La,$,Ma;if(Object.keys)V=Object.keys(Ka);else for(La in V=[],$=0,Ka)V[$++]=La;$=0;for(Ma=V.length;$<Ma;++$)La=V[$],ba("Zlib.RawDeflate.CompressionType."+La,Ka[La]);}).call(this); 7252 7253 7254 7255if (typeof TextEncoder === "undefined") { 7256 TextEncoder=function TextEncoder(){}; 7257 TextEncoder.prototype.encode = function encode(str) { 7258 "use strict"; 7259 var Len = str.length, resPos = -1; 7260 // The Uint8Array's length must be at least 3x the length of the string because an invalid UTF-16 7261 // takes up the equivelent space of 3 UTF-8 characters to encode it properly. However, Array's 7262 // have an auto expanding length and 1.5x should be just the right balance for most uses. 7263 var resArr = typeof Uint8Array === "undefined" ? new Array(Len * 1.5) : new Uint8Array(Len * 3); 7264 for (var point=0, nextcode=0, i = 0; i !== Len; ) { 7265 point = str.charCodeAt(i), i += 1; 7266 if (point >= 0xD800 && point <= 0xDBFF) { 7267 if (i === Len) { 7268 resArr[resPos += 1] = 0xef/*0b11101111*/; resArr[resPos += 1] = 0xbf/*0b10111111*/; 7269 resArr[resPos += 1] = 0xbd/*0b10111101*/; break; 7270 } 7271 // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae 7272 nextcode = str.charCodeAt(i); 7273 if (nextcode >= 0xDC00 && nextcode <= 0xDFFF) { 7274 point = (point - 0xD800) * 0x400 + nextcode - 0xDC00 + 0x10000; 7275 i += 1; 7276 if (point > 0xffff) { 7277 resArr[resPos += 1] = (0x1e/*0b11110*/<<3) | (point>>>18); 7278 resArr[resPos += 1] = (0x2/*0b10*/<<6) | ((point>>>12)&0x3f/*0b00111111*/); 7279 resArr[resPos += 1] = (0x2/*0b10*/<<6) | ((point>>>6)&0x3f/*0b00111111*/); 7280 resArr[resPos += 1] = (0x2/*0b10*/<<6) | (point&0x3f/*0b00111111*/); 7281 continue; 7282 } 7283 } else { 7284 resArr[resPos += 1] = 0xef/*0b11101111*/; resArr[resPos += 1] = 0xbf/*0b10111111*/; 7285 resArr[resPos += 1] = 0xbd/*0b10111101*/; continue; 7286 } 7287 } 7288 if (point <= 0x007f) { 7289 resArr[resPos += 1] = (0x0/*0b0*/<<7) | point; 7290 } else if (point <= 0x07ff) { 7291 resArr[resPos += 1] = (0x6/*0b110*/<<5) | (point>>>6); 7292 resArr[resPos += 1] = (0x2/*0b10*/<<6) | (point&0x3f/*0b00111111*/); 7293 } else { 7294 resArr[resPos += 1] = (0xe/*0b1110*/<<4) | (point>>>12); 7295 resArr[resPos += 1] = (0x2/*0b10*/<<6) | ((point>>>6)&0x3f/*0b00111111*/); 7296 resArr[resPos += 1] = (0x2/*0b10*/<<6) | (point&0x3f/*0b00111111*/); 7297 } 7298 } 7299 if (typeof Uint8Array !== "undefined") return resArr.subarray(0, resPos + 1); 7300 // else // IE 6-9 7301 resArr.length = resPos + 1; // trim off extra weight 7302 return resArr; 7303 }; 7304 TextEncoder.prototype.toString = function(){return "[object TextEncoder]"};
7305 try { // Object.defineProperty only works on DOM prototypes in IE8 7306 Object.defineProperty(TextEncoder.prototype,"encoding",{ 7307 get:function(){if(TextEncoder.prototype.isPrototypeOf(this)) return"utf-8"; 7308 else throw TypeError("Illegal invocation");} 7309 }); 7310 } catch(e) { /*IE6-8 fallback*/ TextEncoder.prototype.encoding = "utf-8"; } 7311 if(typeof Symbol!=="undefined")TextEncoder.prototype[Symbol.toStringTag]="TextEncoder"; 7312} 7313 7314 7315function importLegacyJsLib(path) { 7316 if (MobileAppBridge.isV2Active() && typeof Edupage != 'undefined' && Edupage.EdupageModule) { 7317 return Edupage.EdupageModule.require(path, null, {isLegacyJsLib: true}); 7318 } 7319} 7320 7321 7322function importCss(path) { 7323 if (MobileAppBridge.isV2Active() && typeof Edupage != 'undefined' && Edupage.EdupageModule) { 7324 return Edupage.EdupageModule.require(path, null, {isCss: true}); 7325 } 7326} 7327 7328function barOpenAIChat(params) { 7329 if(!edubar) return; 7330 edubar.toggleAIPanel(true); 7331 if (!window.aipanelFuncs) { 7332 setTimeout(function() { 7333 barOpenAIChat(params); 7334 },100); 7335 return; 7336 } 7337 if (window.aipanelFuncs.openChat) { 7338 window.aipanelFuncs.openChat(params); 7339 } 7340} 7341 7342function barToggleAiPanel(val) { 7343 if (!edubar) return; 7344 if (val !== true && val !== false) { 7345 val = $('#edubarAiPanel').length == 0; 7346 } 7347 7348 edubar.toggleAIPanel(val); 7349 7350} 7351function barSetAiSuggestions(val) { 7352 edubar.aipanelSuggestions = val; 7353 $('#edubarAiPanel').trigger('edubarAiSuggestionChanged'); 7354 //$('#edubarAiBtn').toggleClass('highlightedSuggestions', val && val.length > 0); 7355} 7356function barGetValidAiSuggestions() { 7357 var edubarSuggestions = (edubar.aipanelSuggestions || []); 7358 var ret = []; 7359 for (var i=0;i<edubarSuggestions.length;i++) { 7360 var r = edubarSuggestions[i]; 7361 if ($(r.elem).closest('body').length == 0) continue; 7362 if (!$(r.elem).is(':visible')) continue; 7363 7364 ret.push(r); 7365 } 7366 return ret; 7367} 7368function barNewAiSuggestion(elem, suggestions) { 7369 if (!edubar) return; 7370 if (!edubar.aipanelSuggestions) edubar.aipanelSuggestions = []; 7371 if (elem) { 7372 $(elem).on('remove.aisuggestion', function() { 7373 var nval = []; 7374 for (var i=0;i<edubar.aipanelSuggestions.length;i++) { 7375 var r = edubar.aipanelSuggestions[i]; 7376 if (r.elem && $(r.elem).closest('body').length == 0) continue; 7377 if (r.elem && r.elem == this) continue; 7378 nval.push(r); 7379 } 7380 barSetAiSuggestions(nval); 7381 }); 7382 } 7383 var nv = []; 7384 for (var i =0;i<edubar.aipanelSuggestions.length;i++) { 7385 var r = edubar.aipanelSuggestions[i]; 7386 if (r.elem && $(r.elem).closest('body').length == 0) continue; 7387 if (r.elem && r.elem == elem) continue; 7388 nv.push(r); 7389 } 7390 for (var i=0;i<suggestions.length;i++) { 7391 var params = suggestions[i]; 7392 nv.push({ 7393 elem: elem, 7394 params: params 7395 }); 7396 } 7397 7398 barSetAiSuggestions(nv); 7399} 7400 7401function barRemoveAiSuggestion(elem, ineid) { 7402 if (!edubar) return; 7403 if (!edubar.aipanelSuggestions) edubar.aipanelSuggestions = []; 7404 if (elem) { 7405 $(elem).off('remove.aisuggestion'); 7406 } 7407 var nv = []; 7408 for (var i =0;i<edubar.aipanelSuggestions.length;i++) { 7409 var r = edubar.aipanelSuggestions[i]; 7410 if (r.elem && $(r.elem).closest('body').length == 0) continue; 7411 if (r.elem && elem && r.elem == elem) continue; 7412 if (ineid && r.params.ineid == ineid) continue; 7413 nv.push(r); 7414 } 7415 7416 barSetAiSuggestions(nv); 7417} 7418if (typeof window != 'undefined' && !window.tapOrClick) { 7419 window.tapOrClick = function tapOrClick(callback, ref) { 7420 if (!callback) return null; 7421 var props = ref && typeof ref === 'object' ? ref : {}; 7422 7423 props.onClick = callback; 7424 if (!callback.keyDownHandler) { 7425 callback.keyDownHandler = function(e) { 7426 if (e.which == 32) e.preventDefault(); 7427 if (e.which == 32 || e.which == 13) { 7428 callback(e); 7429 } 7430 } 7431 } 7432 props.onKeyDown = callback.keyDownHandler; 7433 props.tabIndex = 0; 7434 props.role = "button"; 7435 7436 return props 7437 } 7438}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.