var $j = jQuery.noConflict(); /*======================================uniform=====================================*/ (function(e,t){"use strict";function n(e){var t=Array.prototype.slice.call(arguments,1);return e.prop?e.prop.apply(e,t):e.attr.apply(e,t)}function s(e,t,n){var s,a;for(s in n)n.hasOwnProperty(s)&&(a=s.replace(/ |$/g,t.eventNamespace),e.bind(a,n[s]))}function a(e,t,n){s(e,n,{focus:function(){t.addClass(n.focusClass)},blur:function(){t.removeClass(n.focusClass),t.removeClass(n.activeClass)},mouseenter:function(){t.addClass(n.hoverClass)},mouseleave:function(){t.removeClass(n.hoverClass),t.removeClass(n.activeClass)},"mousedown touchbegin":function(){e.is(":disabled")||t.addClass(n.activeClass)},"mouseup touchend":function(){t.removeClass(n.activeClass)}})}function i(e,t){e.removeClass(t.hoverClass+" "+t.focusClass+" "+t.activeClass)}function r(e,t,n){n?e.addClass(t):e.removeClass(t)}function l(e,t,n){var s="checked",a=t.is(":"+s);t.prop?t.prop(s,a):a?t.attr(s,s):t.removeAttr(s),r(e,n.checkedClass,a)}function u(e,t,n){r(e,n.disabledClass,t.is(":disabled"))}function o(e,t,n){switch(n){case"after":return e.after(t),e.next();case"before":return e.before(t),e.prev();case"wrap":return e.wrap(t),e.parent()}return null}function c(t,s,a){var i,r,l;return a||(a={}),a=e.extend({bind:{},divClass:null,divWrap:"wrap",spanClass:null,spanHtml:null,spanWrap:"wrap"},a),i=e("
"),r=e(""),s.autoHide&&t.is(":hidden")&&"none"===t.css("display")&&i.hide(),a.divClass&&i.addClass(a.divClass),s.wrapperClass&&i.addClass(s.wrapperClass),a.spanClass&&r.addClass(a.spanClass),l=n(t,"id"),s.useID&&l&&n(i,"id",s.idPrefix+"-"+l),a.spanHtml&&r.html(a.spanHtml),i=o(t,i,a.divWrap),r=o(t,r,a.spanWrap),u(i,t,s),{div:i,span:r}}function d(t,n){var s;return n.wrapperClass?(s=e("").addClass(n.wrapperClass),s=o(t,s,"wrap")):null}function f(){var t,n,s,a;return a="rgb(120,2,153)",n=e('
'),e("body").append(n),s=n.get(0),t=window.getComputedStyle?window.getComputedStyle(s,"").color:(s.currentStyle||s.style||{}).color,n.remove(),t.replace(/ /g,"")!==a}function p(t){return t?e("").text(t).html():""}function m(){return navigator.cpuClass&&!navigator.product}function v(){return window.XMLHttpRequest!==void 0?!0:!1}function h(e){var t;return e[0].multiple?!0:(t=n(e,"size"),!t||1>=t?!1:!0)}function C(){return!1}function w(e,t){var n="none";s(e,t,{"selectstart dragstart mousedown":C}),e.css({MozUserSelect:n,msUserSelect:n,webkitUserSelect:n,userSelect:n})}function b(e,t,n){var s=e.val();""===s?s=n.fileDefaultHtml:(s=s.split(/[\/\\]+/),s=s[s.length-1]),t.text(s)}function y(e,t,n){var s,a;for(s=[],e.each(function(){var e;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s.push({el:this,name:e,old:this.style[e]}),this.style[e]=t[e])}),n();s.length;)a=s.pop(),a.el.style[a.name]=a.old}function g(e,t){var n;n=e.parents(),n.push(e[0]),n=n.not(":visible"),y(n,{visibility:"hidden",display:"block",position:"absolute"},t)}function k(e,t){return function(){e.unwrap().unwrap().unbind(t.eventNamespace)}}var H=!0,x=!1,A=[{match:function(e){return e.is("a, button, :submit, :reset, input[type='button']")},apply:function(e,t){var r,l,o,d,f;return l=t.submitDefaultHtml,e.is(":reset")&&(l=t.resetDefaultHtml),d=e.is("a, button")?function(){return e.html()||l}:function(){return p(n(e,"value"))||l},o=c(e,t,{divClass:t.buttonClass,spanHtml:d()}),r=o.div,a(e,r,t),f=!1,s(r,t,{"click touchend":function(){var t,s,a,i;f||e.is(":disabled")||(f=!0,e[0].dispatchEvent?(t=document.createEvent("MouseEvents"),t.initEvent("click",!0,!0),s=e[0].dispatchEvent(t),e.is("a")&&s&&(a=n(e,"target"),i=n(e,"href"),a&&"_self"!==a?window.open(i,a):document.location.href=i)):e.click(),f=!1)}}),w(r,t),{remove:function(){return r.after(e),r.remove(),e.unbind(t.eventNamespace),e},update:function(){i(r,t),u(r,e,t),e.detach(),o.span.html(d()).append(e)}}}},{match:function(e){return e.is(":checkbox")},apply:function(e,t){var n,r,o;return n=c(e,t,{divClass:t.checkboxClass}),r=n.div,o=n.span,a(e,r,t),s(e,t,{"click touchend":function(){l(o,e,t)}}),l(o,e,t),{remove:k(e,t),update:function(){i(r,t),o.removeClass(t.checkedClass),l(o,e,t),u(r,e,t)}}}},{match:function(e){return e.is(":file")},apply:function(t,r){function l(){b(t,p,r)}var d,f,p,v;return d=c(t,r,{divClass:r.fileClass,spanClass:r.fileButtonClass,spanHtml:r.fileButtonHtml,spanWrap:"after"}),f=d.div,v=d.span,p=e("").html(r.fileDefaultHtml),p.addClass(r.filenameClass),p=o(t,p,"after"),n(t,"size")||n(t,"size",f.width()/10),a(t,f,r),l(),m()?s(t,r,{click:function(){t.trigger("change"),setTimeout(l,0)}}):s(t,r,{change:l}),w(p,r),w(v,r),{remove:function(){return p.remove(),v.remove(),t.unwrap().unbind(r.eventNamespace)},update:function(){i(f,r),b(t,p,r),u(f,t,r)}}}},{match:function(e){if(e.is("input")){var t=(" "+n(e,"type")+" ").toLowerCase(),s=" color date datetime datetime-local email month number password search tel text time url week ";return s.indexOf(t)>=0}return!1},apply:function(e,t){var s,i;return s=n(e,"type"),e.addClass(t.inputClass),i=d(e,t),a(e,e,t),t.inputAddTypeAsClass&&e.addClass(s),{remove:function(){e.removeClass(t.inputClass),t.inputAddTypeAsClass&&e.removeClass(s),i&&e.unwrap()},update:C}}},{match:function(e){return e.is(":radio")},apply:function(t,r){var o,d,f;return o=c(t,r,{divClass:r.radioClass}),d=o.div,f=o.span,a(t,d,r),s(t,r,{"click touchend":function(){e.uniform.update(e(':radio[name="'+n(t,"name")+'"]'))}}),l(f,t,r),{remove:k(t,r),update:function(){i(d,r),l(f,t,r),u(d,t,r)}}}},{match:function(e){return e.is("select")&&!h(e)?!0:!1},apply:function(t,n){var r,l,o,d;return n.selectAutoWidth&&g(t,function(){d=t.width()}),r=c(t,n,{divClass:n.selectClass,spanHtml:(t.find(":selected:first")||t.find("option:first")).html(),spanWrap:"before"}),l=r.div,o=r.span,n.selectAutoWidth?g(t,function(){y(e([o[0],l[0]]),{display:"block"},function(){var e;e=o.outerWidth()-o.width(),l.width(d+e),o.width(d)})}):l.addClass("fixedWidth"),a(t,l,n),s(t,n,{change:function(){o.html(t.find(":selected").html()),l.removeClass(n.activeClass)},"click touchend":function(){var e=t.find(":selected").html();o.html()!==e&&t.trigger("change")},keyup:function(){o.html(t.find(":selected").html())}}),w(o,n),{remove:function(){return o.remove(),t.unwrap().unbind(n.eventNamespace),t},update:function(){n.selectAutoWidth?(e.uniform.restore(t),t.uniform(n)):(i(l,n),o.html(t.find(":selected").html()),u(l,t,n))}}}},{match:function(e){return e.is("select")&&h(e)?!0:!1},apply:function(e,t){var n;return e.addClass(t.selectMultiClass),n=d(e,t),a(e,e,t),{remove:function(){e.removeClass(t.selectMultiClass),n&&e.unwrap()},update:C}}},{match:function(e){return e.is("textarea")},apply:function(e,t){var n;return e.addClass(t.textareaClass),n=d(e,t),a(e,e,t),{remove:function(){e.removeClass(t.textareaClass),n&&e.unwrap()},update:C}}}];m()&&!v()&&(H=!1),e.uniform={defaults:{activeClass:"active",autoHide:!0,buttonClass:"button",checkboxClass:"checker",checkedClass:"checked",disabledClass:"disabled",eventNamespace:".uniform",fileButtonClass:"action",fileButtonHtml:"Choose File",fileClass:"uploader",fileDefaultHtml:"No file selected",filenameClass:"filename",focusClass:"focus",hoverClass:"hover",idPrefix:"uniform",inputAddTypeAsClass:!0,inputClass:"uniform-input",radioClass:"radio",resetDefaultHtml:"Reset",resetSelector:!1,selectAutoWidth:!0,selectClass:"selector",selectMultiClass:"uniform-multiselect",submitDefaultHtml:"Submit",textareaClass:"uniform",useID:!0,wrapperClass:null},elements:[]},e.fn.uniform=function(t){var n=this;return t=e.extend({},e.uniform.defaults,t),x||(x=!0,f()&&(H=!1)),H?(t.resetSelector&&e(t.resetSelector).mouseup(function(){window.setTimeout(function(){e.uniform.update(n)},10)}),this.each(function(){var n,s,a,i=e(this);if(i.data("uniformed"))return e.uniform.update(i),void 0;for(n=0;A.length>n;n+=1)if(s=A[n],s.match(i,t))return a=s.apply(i,t),i.data("uniformed",a),e.uniform.elements.push(i.get(0)),void 0})):this},e.uniform.restore=e.fn.uniform.restore=function(n){n===t&&(n=e.uniform.elements),e(n).each(function(){var t,n,s=e(this);n=s.data("uniformed"),n&&(n.remove(),t=e.inArray(this,e.uniform.elements),t>=0&&e.uniform.elements.splice(t,1),s.removeData("uniformed"))})},e.uniform.update=e.fn.uniform.update=function(n){n===t&&(n=e.uniform.elements),e(n).each(function(){var t,n=e(this);t=n.data("uniformed"),t&&t.update(n,t.options)})}})(jQuery); /*======================================tipsy======================================= tipsy, facebook style tooltips for jquery version 1.0.0a (c) 2008-2010 jason frame [jason@onehackoranother.com] released under the MIT license */ /*(function(c){function k(b,d){this.$element=c(b);this.options=d;this.enabled=!0;this.fixTitle()}k.prototype={show:function(){var b=this.getTitle();if(b&&this.enabled){var d=this.tip();d.find(".tipsy-inner")[this.options.html?"html":"text"](b);d[0].className="tipsy";d.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var a=c.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),f=d[0].offsetWidth,g=d[0].offsetHeight, b="function"==typeof this.options.gravity?this.options.gravity.call(this.$element[0]):this.options.gravity,e;switch(b.charAt(0)){case "n":e={top:a.top+a.height+this.options.offset,left:a.left+a.width/2-f/2};break;case "s":e={top:a.top-g-this.options.offset,left:a.left+a.width/2-f/2};break;case "e":e={top:a.top+a.height/2-g/2,left:a.left-f-this.options.offset};break;case "w":e={top:a.top+a.height/2-g/2,left:a.left+a.width+this.options.offset}}2==b.length&&("w"==b.charAt(1)?e.left=a.left+a.width/2- 15:e.left=a.left+a.width/2-f+15);"absolute"!=d.css("position")&&d.css("position","absolute");d.css(e).addClass("tipsy-"+b);this.options.fixedPosition&&(e=d.offset(),d.css("position","fixed"),d.offset(e));d.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+b.charAt(0);this.options.className&&d.addClass("function"==typeof this.options.className?this.options.className.call(this.$element[0]):this.options.className);this.options.fade?d.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}): d.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){c(this).remove()}):this.tip().remove()},fixTitle:function(){var b=this.$element;(b.attr("title")||"string"!=typeof b.attr("original-title"))&&b.attr("original-title",b.attr("title")||"").removeAttr("title")},getTitle:function(){var b,c=this.$element,a=this.options;this.fixTitle();a=this.options;"string"==typeof a.title?b=c.attr("title"==a.title?"original-title":a.title): "function"==typeof a.title&&(b=a.title.call(c[0]));return(b=(""+b).replace(/(^\s*|\s*$)/,""))||a.fallback},tip:function(){this.$tip||(this.$tip=c('
').html('
'));return this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.options=this.$element=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}};c.fn.tipsy=function(b){function d(a){var d= c.data(a,"tipsy");d||(d=new k(a,c.fn.tipsy.elementOptions(a,b)),c.data(a,"tipsy",d));return d}function a(){var a=d(this);a.hoverState="in";0==b.delayIn?a.show():(a.fixTitle(),setTimeout(function(){"in"==a.hoverState&&a.show()},b.delayIn))}function f(){var a=d(this);a.hoverState="out";0==b.delayOut?a.hide():setTimeout(function(){"out"==a.hoverState&&a.hide()},b.delayOut)}if(!0===b)return this.data("tipsy");if("string"==typeof b){var g=this.data("tipsy");if(g)g[b]();return this}b=c.extend({},c.fn.tipsy.defaults, b);b.live||this.each(function(){d(this)});if("manual"!=b.trigger){var g=b.live?"live":"bind",e="hover"==b.trigger?"mouseleave":"blur";this[g]("hover"==b.trigger?"mouseenter":"focus",a)[g](e,f)}return this};c.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:0.8,title:"title",trigger:"hover"};c.fn.tipsy.elementOptions=function(b,d){return c.metadata?c.extend({},d,c(b).metadata()):d};c.fn.tipsy.autoNS=function(){return c(this).offset().top> c(document).scrollTop()+c(window).height()/2?"s":"n"};c.fn.tipsy.autoWE=function(){return c(this).offset().left>c(document).scrollLeft()+c(window).width()/2?"e":"w"};c.fn.tipsy.autoBounds=function(b,d){return function(){var a=d[0],f=1300&&(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||e.fallback},tip:function(){return this.$tip||(this.$tip=t('
').html('
')),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,fallback:"",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'+et(exception)+'

'); return; } var s = ''; s += ''; s += '

'+et(ls(3470))+'

'; s += '
'; s += '
'; s += '

'+et(exception)+'

'; s += '
'; s += '
'; s += ''; s += '
'; ajaxErrorDlg = barNewDialog({ 'title': et(ls(2315)), 'content': s, 'width': 350, 'close': function() { ajaxErrorDlg = null; } }); }); $j.datepicker.setDefaults({ defaultDate: new Date(), dateFormat: 'dd.mm.yy', 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)], dayNames: [ls(1709),ls(1703),ls(1704),ls(1705),ls(1706),ls(1707),ls(1708)], firstDay: 1, 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(1707).substr(0,2),ls(1708).substr(0,2)] }); }); /*** * Pacth for dialog-fix ckeditor problem [ by ticket #4727 ] * http://dev.jqueryui.com/ticket/4727 */ $j.widget("ui.dialog", $j.ui.dialog, { _allowInteraction: function( event ) { var ret = !!$j( event.target ).closest( ".cke_dialog_body" ).length || !!$j( event.target ).closest( ".cke_skin_office2003" ).length || !!$j( event.target ).closest( ".cke" ).length || this._super( event ); return ret; } }); $j.widget("ui.dialog", $j.ui.dialog, { _moveToTop: function (event, silent) { if (!event || !this.options.modal) { this._super(event, silent); } } }); $j.fn.selectText = function() { var range, selection; return this.each(function() { if (document.body.createTextRange) { range = document.body.createTextRange(); range.moveToElementText(this); range.select(); } else if (window.getSelection) { selection = window.getSelection(); range = document.createRange(); range.selectNodeContents(this); selection.removeAllRanges(); selection.addRange(range); } }); }; function barFixYuiDialogs() { $j('.yui-dialog').each(function() { if ($j(this).css('z-index')<100) { $j(this).css('z-index',$j(this).css('z-index')*1+100); } }); setTimeout('barFixYuiDialogs()',1000); } function barRefreshPage() { $j(function(){ $j('.tips').tipsy({gravity: 's',html: true, delayIn: 200}); }); $j(function(){ $j('.tips-right').tipsy({gravity: 'w',html: true, delayIn: 200}); }); $j(function(){ $j('.tips-left').tipsy({gravity: 'e',html: true, delayIn: 200}); }); $j(function(){ $j('.tips-bottom').tipsy({gravity: 'n',html: true, delayIn: 200}); }); $j(function(){ $j('.tips-se').tipsy({gravity: 'se',html: true, delayIn: 500}); }); $j('.tipsy').css('position','fixed'); $j(".uniform").uniform({selectAutoWidth : true}); $j(".uniform").removeClass('uniform'); $j(document).off('click.dropDown'); $j(document).on('click.dropDown', function(event) { if ($j(event.target).closest('.dropDownBtn').length==0 && $j(event.target).closest('.dropDown').length==0) { $j('.dropDown').fadeOut(150); $j('.dropDownBtn').children('a').removeClass('icon-button-active'); $j('.dropDownBtn').removeClass('btnSelected'); } } ); $j('.dropDownBtn').off('click.dropDownBtn'); $j('.dropDownBtn').on('click.dropDownBtn', function(event) { if ($j(this).hasClass('disabled')) return; var pos = false; var dropDown = $j(this).children('.dropDown'); if (this.dataDropDown) { // dropDown = this.dataDropDown; } else { pos = true; } this.dataDropDown = dropDown; var that = this; if (!$j(this).children('.dropDown').is(':visible') && !$j(this).children('a').hasClass('button-disabled')) { $j('.dropDown').fadeOut(150); $j('.dropDownBtn').removeClass('btnSelected'); if (dropDown.css('position') == 'fixed') { var pos = $j(that).offset(); if (!dropDown.data('positioned') || dropDown.data('oldpos').top != pos.top || dropDown.data('oldpos').left != pos.left) { var apos = {top: $j(window).scrollTop(),left: $j(window).scrollLeft()}; dropDown.css('top',(pos.top+$j(that).outerHeight()-apos.top)+'px'); dropDown.css('left',(pos.left-apos.left)+'px'); dropDown.data('positioned',true); dropDown.data('oldpos',pos); dropDown.closest('.ui-dialog-content').css('overflow','visible'); dropDown.closest('.ui-dialog').css('overflow','visible'); } } dropDown.fadeIn(150,function() { $j(this).scrollTop(0); if (dropDown.width()+dropDown.offset().left > $j(document).width()) { dropDown.css('left',($j(document).width() - dropDown.width() - dropDown.offset().left)+'px'); } if (dropDown.css('overflow-y') == 'auto' && (dropDown.css('max-height') == 'none' || dropDown.data('autoheight'))) { var h = Math.max(200,$j(window).height() - (dropDown.offset().top - $j(window).scrollTop())-15); dropDown.css('max-height', h+'px'); dropDown.data('autoheight',true); } var pos = $j(this).find('.dropDownPanel li.marked').position(); if (pos && pos.top) { $j(this).scrollTop(Math.max(0,pos.top-($j(this).height()/2))); } }); $j(this).addClass('btnSelected'); $j(this).trigger('dropDownOpened',{}); if (typeof YAHOO != 'undefined' && YAHOO) event.stopPropagation(); } else if ($j(event.target).closest('.dropDown').length==0) { $j('.dropDown').fadeOut(150); $j('.dropDownBtn').removeClass('btnSelected'); $j(this).trigger('dropDownClosed',{}); if (dropDown.css('position') == 'fixed') { dropDown.closest('.ui-dialog-content').css('overflow','auto'); dropDown.closest('.ui-dialog').css('overflow','hidden'); } } } ); $j('.ui-dialog-content form input[type="text"]').off('keydown.preventEnter'); $j('.ui-dialog-content form input[type="text"]').on('keydown.preventEnter',function(e) { if (e.which == 13) e.preventDefault(); return e.which !== 13; }); $j(".simple-tips .close").off('click.simpletips'); $j(".simple-tips .close").on('click.simpletips',function(){ $j(".simple-tips").slideToggle(); }); if (edubar) { edubar.initSmartLinks($j('#bar_mainDiv')); } } function barWndSize() { var bh = $j('#edubar .edubarHeader').outerHeight(); var bw = $j('#edubar .edubarSidebar').width(); var h = $j(window).height() - (bh ? bh : 0); var w = $j(window).width().w - (bw ? bw: 0); return {width: w, height: h}; } function barWndResize() { var h = barWndSize().height; if (document.getElementById('bar_mainDiv')) { var elem = document.getElementById('bar_mainDiv'); //if ($j(elem).height() < h) { $j(elem).css('min-height',h+'px'); //} } if (document.getElementById('fitheight') != null) { if ($j('#fitheight').height() != h) { $j('#fitheight').css('min-height',h+'px'); } } if ($j('#edubar div.edubarHeaderTitle').length > 0) { $j('#edubar div.edubarHeaderTitle').width($j(window).width()-($j(window).width()-$j('#edubar .edubarQuickmenu').position().left)-$j('#edubar .edubarHeaderTitle').position().left-30); } } function wndResize() { barWndResize(); } function wndSize() { return barWndSize(); } function barInitPage() { barRefreshPage(); barWndResize(); barHandleHashAction(); $j(window).off('resize.edubar'); $j(window).on('resize.edubar',function() { barWndResize(); }); } /* ================================= edubar funkcie ======================================= */ function barRemoveDomElem(elem, sebaNie) { var children = $j(elem).children(); for (var i=0;i'); barSrcLoading[src] = 'loading'; barInitializeJsLoad(); $j.ajax({ dataType: "script", url: src, success: function() { barSrcLoading[src] = 'done'; barJsLoadingDone(); }, error: function(a,b,err) { //console.log('error loading '+src+';'+err); barSrcLoading[src] = 'done'; barJsLoadingDone(); } }); } window.barLoadedJsLibraries[src] = true; } else { if (onload) { onload(); } if (onalreadyloaded) { onalreadyloaded(); } } } function barCssLoad(src) { if (!barJsLibraryIsLoaded(src)) { $j.ajaxSetup({cache: true}); jQuery( document.createElement('link') ).attr({ href: src, media: 'screen', type: 'text/css', rel: 'stylesheet' }).appendTo('head'); window.barLoadedJsLibraries[src] = true; } } function barSmartLoadPage(src, forceReload) { if (!edubar) window.location = src; edubar.smartLoadPage(src, forceReload, forceReload); } function barSmartReloadPage() { if (!edubar) document.location.reload(true); edubar.smartLoadPage(window.location.href, true, true); } function barSmartLoadScript(src, method) { if (!edubar) { src = src + (src.indexOf('?') == -1 ? '?' : '&') + 'barNoSkin=1&barContentOnly=1'; if (!method) method = 'GET'; $j.ajax({ type: method, url: src, data: {}, success: function(data) { $j('body').append(''); } }); return; } edubar.smartLoadScript(src, method); } function barShowSchoolYearSelector() { $j('#edubarSchoolYear').show(); } function barHideSchoolYearSelector() { $j('#edubarSchoolYear').hide(); } function barShowMessage(msg, duration) { if (!duration) duration = 10000; $j('body').children('.barMessageText').remove(); $j('').appendTo($j('body')).fadeIn('fast').delay(duration).fadeOut('fast',function() { $j(this).remove(); }); } var barUrlToModule = {}; var edubar = null; $j.widget('edupage.edubar',{ options: { PSID: '', portalMainUrl: '', edupageUrl: '', erid: '', sessionPingInterval: 600, sessionPingUrl: '', somNaPortali: false, urlToModule: {}, chatVisible: false, loggedUser: '', lang: '', hasActiveModuleSkin: false, syncIntervalMultiplier: 1 }, menuOpened: null, defaultHeadHtml: '', lastLoadedLocation: '', lastSyncTime: 0, lastSessionPingTime: 0, openedChatWindows: {}, switchAccount: function(edudata) { var thisObj = this; window.location = thisObj.options.portalMainUrl+'/pauth.php?akcia=edupageChange&rid='+encodeURIComponent(edudata)+'&PSID='+thisObj.options.PSID+'&fe='+thisObj.options.edupage; }, switchToAdmin: function() { barNewDialog({ 'source': '/portal/?cmd=SwitchToAdmin' }); }, _create: function() { var thisObj = this; edubar = this; barUrlToModule = this.options.urlToModule; this.defaultHeadHtml = $j('head').html(); this.element.find('.edubarFeedbackBtn').on('click',function() { barNewDialog({source: thisObj.options.edupageUrl+'/znamky/?jwgc=ZnamkyFeedbackDialog'}); }); this.element.find('.edubarChangeEdurowBtn').on('click',function() { thisObj.switchAccount($j(this).attr('data-rowid')); }); this.element.find('.switchToAdminBtn').on('click',function() { thisObj.switchToAdmin(); }); this.element.find('.edubarChatBtn').on('click',function() { thisObj.toggleChat(); }); this.element.find('ul.edubarMenulist.level1').each(function() { $j(this).width($j(this).children('li').length*70); }); this.element.find('ul.edubarMenulist > li').hoverIntent({ 'over': function() { $j(this).siblings('li').find('ul.edubarMenulist').hide(); $j(this).children('ul.edubarMenulist').show(); }, 'out': function() { $j(this).children('ul.edubarMenulist').hide(); }, 'timeout': 250 }); this.element.find('ul.edubarMenulist > li').click(function() { $j(this).siblings('li').find('ul.edubarMenulist').hide(); $j(this).children('ul.edubarMenulist').show(); }); this.element.find('.edubarProfilebox .display').on('click',function() { thisObj.element.find('.edubarProfilebox .profilemenu').css('display','block'); $j(document).off('click.edubarProfilebox'); $j(document).on('click.edubarProfilebox',function(event) { if ($j(event.target).closest('.edubarProfilebox').length==0) { $j(document).off('click.edubarProfilebox'); thisObj.element.find('.edubarProfilebox .profilemenu').css('display',''); } }); }); this.element.find('.edubarHideCalloutBtn').on('click',function() { $j('#bar_protoUserCallout').fadeOut('fast'); }); this.element.find('#edubarNewItemBtn').on('click',function() { var thisObj = this; var dialog = barNewDialog({ title: ls(3278), source: '/timeline/?cmd=creator', dialogClass: 'whiteDialog', height: 518 }); }); setTimeout(function() { var btn = $j('#bar_protoUserCallout'); var kontoBtn = thisObj.element.find('.barKontoBtn'); if (kontoBtn.length>0) { var pos = kontoBtn.offset(); btn.offset({left: pos.left-100, top: pos.top+20}); $j('#bar_protoUserCallout').fadeIn('slow'); } },1000); this.element.find('.edubarHideCalloutBtn').on('click',function() { $j('#bar_protoUserCallout').fadeOut('fast'); }); this.element.find('.profilemenu a.switchChildBtn').on('click',function() { var studentid = $j(this).attr('data-sid'); $j.get('/login/switchchild?studentid='+studentid, function(data) { document.location.reload(true); }); }); this.element.find('#edubarSchoolYear select').on('change',function() { thisObj.switchSchoolYear($j(this).val()); }); this.hashChange(); this.initSmartLinks(this.element); this.initGlobalEvents(); if (thisObj.options.sessionPingInterval > 0 && !thisObj.options.somNaPortali) { setTimeout(function() { thisObj.sessionPing(); },thisObj.options.sessionPingInterval*1000); } this.initCheckTimer(); if (this.options.syncIntervalMultiplier) { this.syncIntervalMultiplier = Math.min(5,Math.max(0.5,parseFloat(this.options.syncIntervalMultiplier))); } this.lastLoadedLocation = window.location.pathname+window.location.search; $j(window).on('load',function() { thisObj.initSmartLinks($j('#bar_mainDiv')); thisObj.initSyncInterval(); if (sessionStorage && sessionStorage.getItem('chatOpened') == '1') { thisObj.openChat(); } }); var pom = {}; for (var x in this.options.urlToModule) { if (!pom[x]) pom[x] = {}; for (var url in this.options.urlToModule[x]) { pom[x][barEncLink(url)] = 1; } } for (var x in pom) { for (var url in pom[x]) { this.options.urlToModule[x][url] = 1; } } this.selectModule([window.location.pathname+window.location.search]); }, checkTimeoutId: null, initCheckTimer: function() { var self = this; this.lastSessionPingTime = (new Date()).getTime(); this.checkTimerId = setTimeout(function() { self.checkTimer(); }, 1000); }, switchSchoolYear: function(year) { var self = this; this.element.find('#edubarSchoolYear').css('opacity','0.5'); $j.post('/znamky/?what=setyear',{znamky_yearid: year}, function(data) { self.element.find('#edubarSchoolYear').css('opacity','1'); self.element.find('#edubarSchoolYear select').val(data); barSmartReloadPage(); }); }, checkTimer: function() { var self = this; if ((new Date()).getTime() - this.lastSessionPingTime > this.options.sessionPingInterval*1000*1.3) { this.sessionPing(true); } this.checkTimerId = setTimeout(function() { self.checkTimer(); }, 1000); }, initSmartLinks: function(elem) { var thisObj = this; elem.find('a.edubarSmartLink').off('click.smartlink'); elem.find('a.edubarSmartLink').on('click.smartlink',function(event) { if (event.which != 1) return; var src = $j(this).attr('href'); if (!src) return; if (src == '/dashboard/eb.php?mode=reports') { event.preventDefault(); thisObj.smartLoadScript(src); return; } if ($j(this).hasClass('edubarLinkToSkin')) return; if (!$j(this).hasClass('edubarLinkToSkin') && thisObj.options.hasActiveModuleSkin) return; event.preventDefault(); thisObj.smartLoadPage(src); }); elem.find('form.edubarSmartLoadFrm').off('submit.smartlink'); elem.find('form.edubarSmartLoadFrm').on('submit.smartlink',function(event) { event.preventDefault(); var src = $j(this).attr('action'); src += (src.indexOf('?') == -1 ? '?' : '&')+$j(this).serialize(); thisObj.smartLoadPage(barEncLink(src)); return false; }); }, initGlobalEvents: function() { var thisObj = this; $j(document).off('click.edubar'); $j(document).on('click.edubar',function(event) { if ($j(event.target).closest('ul.edubarMenulist').length == 0) { thisObj.element.find('ul.edubarMenulist.level1').hide(); } }); $j(window).off('hashchange.edubar'); $j(window).on('hashchange.edubar',function(e) { thisObj.hashChange(); }); $j(window).off('popstate.edubar'); $j(window).on('popstate.edubar',function(e) { if (thisObj.smartLinksHashChanged) { thisObj.smartLinksHashChanged = false; return; } if (!e.originalEvent.state || !e.originalEvent.state.eduSmartHref) { setTimeout(function() { if (thisObj.smartLinksHashChanged) { thisObj.smartLinksHashChanged = false; return; } if (!e.cancelBarHandler) { thisObj.smartLoadPage(window.location.pathname+window.location.search, true); e.stopImmediatePropagation(); } else { thisObj.lastLoadedLocation = window.location.pathname+window.location.search; } },100); return; } var href = e.originalEvent.state.eduSmartHref; thisObj.smartLoadPage(href, true); e.stopImmediatePropagation(); }); $j(window).off('storage.edubar'); $j(window).on('storage.edubar',function(event) { thisObj.handleStorageEvent(event); }); }, smartLoadPage: function(href, doNotStoreState, forceReaload) { var startTime = new Date(); var thisObj = this; if (this.lastLoadedLocation == href && !forceReaload) return; var buevent = jQuery.Event( "beforeunload" ); buevent.originalEvent = {'returnValue': ''}; $j(window).trigger(buevent); if (buevent.isDefaultPrevented()) return; if (buevent.originalEvent.returnValue != '') { if (!confirm(buevent.originalEvent.returnValue)) { return; } } $j('#edubar').find('#quickIntroBtn').remove(); var hashPos = href.indexOf('#'); var hash = ''; if (hashPos != -1) { hash = href.substr(hashPos+1); href = href.substr(0,hashPos);//+'?'+hash; } src = href + (href.indexOf('?') == -1 ? '?' : '&') + 'barNoSkin=1'; $j('#edubarLogo').fadeOut('fast'); barHideSchoolYearSelector(); $j('body').append('
'); $j('body').append('
'+ls(3358)+'
'); $j.get(src, function(data) { barTrackTiming('EdubarPageLoad', 'data downloaded', ((new Date()).getTime()-startTime.getTime()), src); var hstart = data.indexOf('%%%head%%%'); var hend = hstart == -1 ? -1 : data.indexOf('%%%head%%%', hstart+10); var headCnt = ''; if (hstart != -1 && hend != -1) { var headCnt = data.substr(hstart+10, hend == -1 ? 0 : hend-hstart-10); data = data.substr(0,hstart)+data.substr(hend+10); $j('head').html(thisObj.defaultHeadHtml+headCnt); } if (!doNotStoreState) { if (window.history.pushState) { window.history.pushState({'eduSmartHref': href}, null, href); } } thisObj.selectModule([href]); //$j(document).off(); //kvoli tomu blblo jquery draggable $j(window).off(); $j('body').off('keypress'); $j('body').off('keydown'); var bodyElems = $j('body').children(); for (var i=0;i
'); $j('body').append('
'+ls(3358)+'
'); src = src + (src.indexOf('?') == -1 ? '?' : '&') + 'barNoSkin=1&barContentOnly=1'; if (!method) method = 'GET'; $j.ajax({ type: method, url: src, data: {}, success: function(data) { $j('#barSmartLinkLoadingDiv').remove(); $j('#barSmartLinkLoadingText').remove(); $j('#edubarLogo').fadeIn('fast'); $j('body').append(''); } }); }, smartLinksHashChanged: false, hashChange: function() { var thisObj = this; var hash = window.location.hash; if (hash != '#' && hash != '') thisObj.smartLinksHashChanged = true; return; }, selectModule: function(modUrls) { var self = this; var currentModule = ''; for (var m in this.options.urlToModule) { var url = this.options.urlToModule[m]; if (!url) continue; var jeSelected = false; for (var i=0;i li[data-module="'+et(m)+'"]').toggleClass('active',jeSelected); } for (var i=0;i 0 && $j(this).siblings('.edubarMenuitem.active').length == 0) { $j(this).toggleClass('active',true); } }) }, sessionPing: function(doNotCreateTimeout) { var thisObj = this; var url = this.options.sessionPingUrl; this.lastSessionPingTime = (new Date()).getTime(); var gpids = []; $j('.asc-gadget-jsc').each(function() { var gjsc = this.ASC_gjsc; if (gjsc && gjsc.ASC_gpid) { gpids.push(gjsc.ASC_gpid); } }); $j.ajax({ type: 'post', url: url, data: {'gpids': gpids.join(';')}, success: function(data) { if (data == 'notlogged') { thisObj.sessionNotLogged(); //document.barLogoutForm.submit(); return; } else if (data == 'OK') { return; } obj = $j.parseJSON(data); if (obj.status == 'notlogged') { thisObj.sessionNotLogged(); //document.barLogoutForm.submit(); return; } }, global: false }); if (thisObj.options.sessionPingInterval > 0 && !doNotCreateTimeout) { setTimeout(function() { thisObj.sessionPing(); },thisObj.options.sessionPingInterval*1000); } }, sessionNotLoggedDlg: null, sessionNotLogged: function() { if (this.sessionNotLoggedDlg) return; var self = this; var s = ''; s += ''; s += '

'+et(ls(4111))+'

'; s += '
'; s += ''; s += '
'; this.sessionNotLoggedDlg = barNewDialog({ 'title': ls(1017), 'content': s, 'width': 350, 'close': function() { self.sessionNotLoggedDlg = null; document.barLogoutForm.submit(); } }); var yuidlg = this.sessionNotLoggedDlg.data('yuiDialog'); if (yuidlg) { this.sessionNotLoggedDlg.closest('.yui-panel').find('a.container-close').remove();//css('display','none !important');//remove(); this.sessionNotLoggedDlg.find('.closeBtn').on('click',function() { self.sessionNotLoggedDlg = null; document.barLogoutForm.submit(); }); } }, toggleChat: function() { var elem = $j('#bar_chatPanel'); if (elem.length == 0) { this.openChat(); } else { this.closeChat(); } }, openChat: function() { var self = this; var s = ''; var parentElem = $j('#bar_mainDiv').parent(); var chatElem = $j(s).appendTo(parentElem).fadeIn('fast'); $j('#bar_mainDiv').css('margin-right','180px'); $j.post('/chat/?cmd=ChatList', function(data) { chatElem.html(data); chatElem.removeClass('loading-background'); self.initSmartLinks($j('#bar_chatPanel')); }); $j('head').append(''); if (sessionStorage) sessionStorage.setItem('chatOpened','1'); }, closeChat: function() { $j('#bar_chatPanel').fadeOut('fast',function() { $j('#bar_chatPanel').remove(); }); $j('#bar_mainDiv').css('margin-right','0'); $j('#fixedRightCss').remove(); if (sessionStorage) sessionStorage.removeItem('chatOpened'); }, registerChatWindow: function(chatid, wnd) { this.openedChatWindows[chatid] = wnd; this.initSyncInterval(); this._trigger('chatopened', null, {'chatid': chatid, 'wnd': wnd}); }, unregisterChatWindow: function(chatid) { delete this.openedChatWindows[chatid]; this._trigger('chatclosed', null, {'chatid': chatid}); }, isOpenedChatWindow: function(chatid) { return !!this.openedChatWindows[chatid]; }, openedChatWindowsCount: function(chatid) { var count = 0; for (var x in this.openedChatWindows) { count++; } return count; }, openChatWindow: function(chatid) { if ($j('#barChatWindow'+chatid).length > 0) { $j('#barChatWindow'+chatid).find('input.textInput').focus(); return; } var self = this; var s = ''; var parentElem = $j('#bar_mainDiv').parent(); var windowElem = $j(s).appendTo(parentElem); windowElem.css('top',$j(window).height()-310); windowElem.css('left',$j(window).width()-190-260*(edubar.openedChatWindowsCount()+1)); windowElem.fadeIn('fast'); $j.post('/chat/?cmd=ChatWindow&chatid='+chatid, function(data) { windowElem.html(data); windowElem.removeClass('loading-background'); windowElem.data('chat-list',self); }); }, currentSync: 0, currentTimeoutID: null, syncInterval: 90000, syncIntervalMultiplier: 1, initSyncInterval: function() { var self = this; if (this.currentTimeoutID) { clearTimeout(this.currentTimeoutID); } var interval = 90000; var chatujem = false; for (var x in this.openedChatWindows) { var wnd = this.openedChatWindows[x]; interval = 60000; if (wnd.element.find('.textInput').is(':focus')) { interval = 10000; chatujem = true; break; } } if (!chatujem) { interval = interval*self.syncIntervalMultiplier; } this.getGlobalOpenedChats(true); this.syncInterval = interval; self.currentSync++; var index = self.currentSync; this.currentTimeoutID = setTimeout(function() { self.dataSyncTimer(index); }, interval); }, dataSyncTimer: function(index) { if (this.currentSync != index) return; this.currentTimeoutID = null; this.dataSync(); }, dataSync: function() { var self = this; var chats = []; for (var chatid in this.openedChats) { chats.push(this.openedChats[chatid]); } var postData = { 'akcia': 'sync', 'openedChats': chats.join(';') }; var cd = new Date(); var syncing = localStorage.getItem('edubarSyncing'); if (syncing && syncing>=cd.getTime()-this.syncInterval*1.2) { self.initSyncInterval(); return; } this.lastSyncTime = cd.getTime(); var globalSyncData = this.getLastGlobalSync(); if (globalSyncData) { self.dataSyncReceived(globalSyncData); self.initSyncInterval(); return; } localStorage.setItem('edubarSyncing',cd.getTime()); $j.ajax({ type: 'post', dataType: 'json', url: '/chat/?cmd=ChatList', data: postData, success: function(data) { self.setLastGlobalSync(data); self.dataSyncReceived(data); localStorage.removeItem('edubarSyncing'); if (data.syncIntervalMultiplier) { self.syncIntervalMultiplier = Math.min(5,Math.max(0.5,parseFloat(data.syncIntervalMultiplier))); } self.initSyncInterval(); }, global: false, error: function() { localStorage.removeItem('edubarSyncing'); self.initSyncInterval(); } }); }, edubarSyncData: null, edubarLastSync: null, handleStorageEvent: function(event) { var self = this; var origEvent = event.originalEvent; var newValue = origEvent.newValue; if (!newValue) return; if (origEvent.key == 'edubarSyncData') { self.edubarSyncData = newValue; } else if (origEvent.key == 'edubarLastSync') { self.edubarLastSync = newValue; } else if (origEvent.key == 'edubarGetOpenedChats') { var chats = {}; for (var chatid in this.openedChatWindows) { var wnd = this.openedChatWindows[chatid]; if (!wnd) continue; chats[chatid] = chatid+'|'+wnd.options.lastSprava; } localStorage.setItem('edubarOpenedChats', JSON.stringify(chats)); localStorage.removeItem('edubarOpenedChats'); } else if (origEvent.key == 'edubarOpenedChats') { var chats = JSON.parse(newValue); for (var chatid in chats) { this.openedChats[chatid] = chats[chatid]; } } }, openedChats: {}, getGlobalOpenedChats: function(clear) { if (clear) { this.openedChats = {}; } localStorage.setItem('edubarGetOpenedChats','1'); localStorage.removeItem('edubarGetOpenedChats'); for (var chatid in this.openedChatWindows) { var wnd = this.openedChatWindows[chatid]; if (!wnd) continue; this.openedChats[chatid] = chatid+'|'+wnd.options.lastSprava; } return this.openedChats; }, setLastGlobalSync: function(data) { var date = new Date(); localStorage.setItem('edubarLastSync',date.getTime()); localStorage.setItem('edubarSyncData',JSON.stringify(data)); localStorage.removeItem('edubarSyncData'); localStorage.removeItem('edubarLastSync'); }, getLastGlobalSync: function(interval) { var date = new Date(); var lastSync = this.edubarLastSync ? this.edubarLastSync : localStorage.getItem('edubarLastSync'); var pom = new Date(); pom.setTime(lastSync); if (lastSync && lastSync > date.getTime()-this.syncInterval) { var data = this.edubarSyncData ? this.edubarSyncData : localStorage.getItem('edubarSyncData'); return JSON.parse(data); } return null; }, dataSyncReceived: function(data) { var thisObj = this; if (data.timelineCount || data.timelineCount === 0) { thisObj.element.find('.edubarTimelineBtn .notif').html(data.timelineCount > 0 ? data.timelineCount : '').toggle(data.timelineCount>0); } if (data.chatCount || data.chatCount === 0) { thisObj.element.find('.edubarChatBtn .notif').html(data.chatCount > 0 ? data.chatCount : '').toggle(data.chatCount>0); } this._trigger('datasync', null, data); }, timelineDataReceived: function(data) { this._trigger('timelinesync', null, data); } }); function barHandleHashAction() { if (window.location.hash.substr(0,11) != '#edubaract_') return; var action = window.location.hash.substr(1); if (typeof window[action] == 'function') { window.location.hash = ''; window[action](); } } function barGotoUrl(url) { window.location = url; } function barTrackTiming(category, variable, time, label) { if (typeof _gaq != 'undefined' && _gaq && time >= 0 && time < 3600000) { _gaq.push(['_trackTiming', category, variable, time, label]); } } function showProtoUserCallout() { zn_showPopup('bar_protoUserCallout',getX(document.getElementById('barKontoBtn'))-120,getY(document.getElementById('barKontoBtn'))+15); } function barEncLink(url) { var qs = url.indexOf('?'); if (qs == -1) return url; var qe = url.indexOf('#',qs); var query = qe != -1 ? url.substr(qs+1, qe-qs-1) : url.substr(qs+1); var ret = url.substr(0,qs); ret += '?'; ret += 'eqa='+encodeURIComponent(Base64.encode(query)); if (qe != -1) { ret += url.substr(qe); } return ret; } function staticUrl(src) { return '//static1.edupage.org/files'+src; return src; } /*=================== znamky komponenty ===============================================*/ function getXYSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } return {y: myHeight, x: myWidth}; } function getYSize() { return getXYSize().y; } function getXSize() { return getXYSize().x; } function getDocumentHeight() { var D = document; return Math.max( Math.max(D.body.scrollHeight, D.documentElement.scrollHeight), Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), Math.max(D.body.clientHeight, D.documentElement.clientHeight) ); } function getDocumentWidth() { var D = document; return Math.max( Math.max(D.body.scrollWidth, D.documentElement.scrollWidth), Math.max(D.body.offsetWidth, D.documentElement.offsetWidth), Math.max(D.body.clientWidth, D.documentElement.clientWidth) ); } function getXYScroll() { var scrOfX = 0, scrOfY = 0; if( typeof( window.pageYOffset ) == 'number' ) { //Netscape compliant scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { //DOM compliant scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { //IE6 standards compliant mode scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } return {x: scrOfX, y: scrOfY}; } function getXScroll() { return getXYScroll().x; } function getYScroll() { return getXYScroll().y; } function getY( oElement ) { var iReturnValue = 0; while( oElement != null ) { iReturnValue += oElement.offsetTop; oElement = oElement.offsetParent; } return iReturnValue; } function getX( oElement ) { var iReturnValue = 0; while( oElement != null ) { iReturnValue += oElement.offsetLeft; oElement = oElement.offsetParent; } return iReturnValue; } /*==================== langs ===================================================*/ function ls(id) { if (typeof Langs == 'undefined' || !Langs) return id.toString(); if (!Langs[id]) return id.toString(); return Langs[id]; } function lsf(id, replacements) { var txt = ls(id); for (var x in replacements) { txt = txt.replace('{'+x+'}', replacements[x]); } return txt; } function lset(id) { if (typeof Langs == 'undefined' || !Langs) return id.toString(); if (!Langs[id]) return et(id.toString()); return et(Langs[id]); } /*=================== some functions ===============================================*/ String.prototype.endsWidth = function (s) { return this.length >= s.length && this.substr(this.length - s.length) == s; }; String.prototype.ucfirst = function () { return this.substr(0,1).toUpperCase()+this.substr(1); }; String.prototype.naDvaRiadky = function(oddelovac) { if (!oddelovac) oddelovac = '
'; var pom1 = this.split(' '); var pom = []; for (var i=0;i1) { pom3[j] += ' /'; } pom.push(pom3[j]); } } if (pom.length == 1) return this; var l = this.length; var minDlzka = l; var r1 = ''; var r2 = ''; var rozbijaciIndex = l; var ret = ''; for (i=1;i/g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } function et2(text) { if (text == null) text = ''; text += ''; return text .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } function renderS(s, vars) { var matches = s.match(new RegExp('\{#?!?[a-z0-9A-Z_\.]+\}','g'));//(?:\([^\)]*\))? if (!matches) return s; for (var i=0;i'; s += et(nazov); if (sortParams["sortBy"] == field) { s += ' '+(sortParams["sortDir"] == 'desc' ? '▼' : '▲')+''; } s += ''; return s; } function esandbox(iframe, content) { var doc = iframe[0].contentDocument; doc.write(content); var oHead = doc.getElementsByTagName("head")[0]; var arrStyleSheets = document.getElementsByTagName("style"); for (var i = 0; i < arrStyleSheets.length; i++) { oHead.appendChild(arrStyleSheets[i].cloneNode(true)); } var arrStyleSheets = document.getElementsByTagName("link"); for (var i = 0; i < arrStyleSheets.length; i++) { oHead.appendChild(arrStyleSheets[i].cloneNode(true)); } $j(oHead).append(''); $j(iframe).height($j(doc).outerHeight()); setTimeout(function() { $j(iframe).height($j(doc).outerHeight()); },100); } var Latinise={}; Latinise.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","Ƌ":"D","DZ":"DZ","DŽ":"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","Lj":"L","Ł":"L","LJ":"LJ","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ń":"N","Ň":"N","Ņ":"N","Ṋ":"N","Ṅ":"N","Ṇ":"N","Ǹ":"N","Ɲ":"N","Ṉ":"N","Ƞ":"N","Nj":"N","Ñ":"N","NJ":"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","Ʋ":"V","Ṽ":"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","dž":"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":"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":"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":"ff","ffi":"ffi","ffl":"ffl","fi":"fi","fl":"fl","ij":"ij","œ":"oe","st":"st","ₐ":"a","ₑ":"e","ᵢ":"i","ⱼ":"j","ₒ":"o","ᵣ":"r","ᵤ":"u","ᵥ":"v","ₓ":"x"}; String.prototype.latinise=function() {return this.replace(/[^A-Za-z0-9\[\] ]/g,function(a){return Latinise.latin_map[a]||a;});}; String.prototype.latinize=String.prototype.latinise; String.prototype.isLatin=function(){return this==this.latinise();}; //Simulates PHP's date function Date.prototype.format = function(format) { var returnStr = ''; var replace = Date.replaceChars; for (var i = 0; i < format.length; i++) { var curChar = format.charAt(i); if (i - 1 >= 0 && format.charAt(i - 1) == "\\") { returnStr += curChar; } else if (replace[curChar]) { returnStr += replace[curChar].call(this); } else if (curChar != "\\"){ returnStr += curChar; } } return returnStr; }; Date.prototype.getWeekStart = function() { var d = new Date(this.getTime()); d.setDate(d.getDate()-((d.getDay()+6)%7)); return d; } Date.prototype.slovom = function(ajDatum, ajCas) { var format = ''; if (ajDatum) format += 'd.m.Y'; if (ajCas) format += ' H:i'; var ad = new Date(); ad.setUTCDate(ad.getUTCDate()-1); if (this.format('Y-m-d') == ad.format('Y-m-d')) { return ls(1734)+(format != '' ? ' '+this.format(format) : ''); } ad.setUTCDate(ad.getUTCDate()+1); if (this.format('Y-m-d') == ad.format('Y-m-d')) { return ls(1733)+(format != '' ? ' '+this.format(format) : ''); } ad.setUTCDate(ad.getUTCDate()+1); if (this.format('Y-m-d') == ad.format('Y-m-d')) { return ls(3280)+(format != '' ? ' '+this.format(format) : ''); } if (!ajDatum) format = 'd.m.Y'+format; if (!this.dniVTyzdni) {this.dniVTyzdni = [ ls(1703), ls(1704), ls(1705), ls(1706), ls(1707), ls(1708), ls(1709) ]; } return this.dniVTyzdni[(this.getDay()+6)%7].toLowerCase()+' '+this.format(format); } Date.parse = function(str) { var ad = new Date(); var f = new RegExp('^[0-9]+\.[0-9]+\.?([0-9]+)?$','gi'); if (f.test(str)) { var pom = str.split('.'); if (pom.length < 3) { pom.push(ad.getFullYear().toString()); } if (pom[2].length != 2 && pom[2].length != 4) { pom[2] = ad.getFullYear().toString(); } if (pom[2].length == 2) { pom[2] = pom[2]*1 > 50 ? '19'+pom[2] : '20'+pom[2]; } return new Date(pom[2]*1, pom[1]*1-1, pom[0]*1,0,0,0); } f = new RegExp('^[0-9]+/[0-9]+(/[0-9]+)?$','gi'); if (f.test(str)) { var pom = str.split('/'); if (pom.length < 3) { pom.push(ad.getFullYear()); } if (pom[2].length == 2) { pom[2] = pom[2]*1 > 50 ? '19'+pom[2] : '20'+pom[2]; } return new Date(pom[2]*1, pom[0]*1-1, pom[1]*1,0,0,0); } f = new RegExp('^[0-9]+-[0-9]+-[0-9]+$','gi'); if (f.test(str)) { var pom = str.split('-'); return new Date(pom[0]*1, pom[1]*1-1, pom[2]*1,0,0,0); } if (str.toLowerCase() == ls(1733).toLowerCase()) { //dnes return ad; } if (str.toLowerCase() == ls(1439).toLowerCase()) { return new Date(ad.getUTCFullYear(), ad.getUTCMonth(), ad.getUTCDate()+1,0,0,0); } if (str.toLowerCase() == ls(1734).toLowerCase()) { return new Date(ad.getUTCFullYear(), ad.getUTCMonth(), ad.getUTCDate()-1,0,0,0); } return false; } Date.parseTime = function(str) { var ad = new Date(); var pom = str.split(':'); if (pom.length < 3) { pom.push('00'); } ad.setHours(pom[0]*1); ad.setMinutes(pom[1]*1); ad.setSeconds(pom[2]*1); return ad; } Date.fromDbString = function(str) { if (str === null) str = ''; var pom = str.split(' '); if (pom.length == 0) return false; if (pom.length == 1) { pom.push('00:00:00'); } var dates = pom[0].split('-'); if (dates.length < 3) dates = ['1999','01','01']; var times = pom[1].split(':'); if (times.length < 3) times.push('00'); if (times.length < 3) times.push('00'); if (times.length < 3) times.push('00'); var d = new Date(); for (var i =0;i<3;i++) { if (dates[i].charAt(0) == '0') dates[i] = dates[i].substr(1); if (times[i].charAt(0) == '0') times[i] = times[i].substr(1); } d.setFullYear(parseInt(dates[0]), parseInt(dates[1])-1, parseInt(dates[2])); d.setHours(parseInt(times[0]),parseInt(times[1]), parseInt(times[2])); return d; } Date.replaceChars = { 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)], 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)], 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)], longDays: [ls(1709), ls(1703), ls(1704),ls(1705),ls(1706),ls(1707),ls(1708)], // Day d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); }, D: function() { return Date.replaceChars.shortDays[this.getDay()]; }, j: function() { return this.getDate(); }, l: function() { return Date.replaceChars.longDays[this.getDay()]; }, N: function() { return (this.getDay() +6)%7+1; }, 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'))); }, w: function() { return this.getDay(); }, z: function() { var d = new Date(this.getFullYear(),0,1); return Math.ceil((this - d) / 86400000); }, // Fixed now // Week W: function() { var d = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - d) / 86400000) + d.getDay() + 1) / 7); }, // Fixed now // Month F: function() { return Date.replaceChars.longMonths[this.getMonth()]; }, m: function() { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); }, M: function() { return Date.replaceChars.shortMonths[this.getMonth()]; }, n: function() { return this.getMonth() + 1; }, t: function() { var d = this; return new Date(d.getFullYear(), d.getMonth()+1, 0).getDate() }, // Fixed now, gets #days of date // Year L: function() { var year = this.getFullYear(); return (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)); }, // Fixed now o: function() { var d = new Date(this.valueOf()); d.setDate(d.getDate() - ((this.getDay() + 6) % 7) + 3); return d.getFullYear();}, //Fixed now Y: function() { return this.getFullYear(); }, y: function() { return ('' + this.getFullYear()).substr(2); }, // Time a: function() { return this.getHours() < 12 ? 'am' : 'pm'; }, A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; }, B: function() { return Math.floor((((this.getUTCHours() + 1) % 24) + this.getUTCMinutes() / 60 + this.getUTCSeconds() / 3600) * 1000 / 24); }, // Fixed now g: function() { return this.getHours() % 12 || 12; }, G: function() { return this.getHours(); }, h: function() { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); }, H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); }, i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); }, s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); }, u: function() { var m = this.getMilliseconds(); return (m < 10 ? '00' : (m < 100 ? '0' : '')) + m; }, // Timezone e: function() { return "Not Yet Supported"; }, I: function() { return "Not Yet Supported"; }, O: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; }, P: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + ':00'; }, // Fixed now T: function() { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result;}, Z: function() { return -this.getTimezoneOffset() * 60; }, // Full Date/Time c: function() { return this.format("Y-m-d\\TH:i:sP"); }, // Fixed now r: function() { return this.toString(); }, U: function() { return this.getTime() / 1000; } }; var EdubarUtils = {}; EdubarUtils.replaceUrls = function(ret) { // http://, https://, ftp:// var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|]/gim; // www. sans http:// or https:// var pseudoUrlPattern = /(^|[^\/])(www\.[\S]+(\b|$))/gim; //vyhladame este odkazy: ret = ret.replace(urlPattern, '$&').replace(pseudoUrlPattern, '$1$2'); return ret; } EdubarUtils.doGetCaretPosition = function(oField) { var iCaretPos = 0; if (oField.selectionStart || oField.selectionStart == '0') { iCaretPos = oField.selectionStart; } else if (window.getSelection) { sel = window.getSelection(); if (sel.rangeCount) { range = sel.getRangeAt(0); if (range.commonAncestorContainer.parentNode == oField) { iCaretPos = range.endOffset; } else if (range.commonAncestorContainer.parentNode && range.commonAncestorContainer.parentNode.parentNode == oField) { var parentText = $j(range.commonAncestorContainer.parentNode.parentNode).text(); var nodeText = $j(range.commonAncestorContainer.parentNode).text(); iCaretPos = range.endOffset + parentText.indexOf(nodeText); } else { iCaretPos = range.endOffset; } } } else if (document.selection) { oField.focus (); var oSel = document.selection.createRange (); oSel.moveStart ('character', -oField.value.length); iCaretPos = oSel.text.length; } return (iCaretPos); } EdubarUtils.doSetCaretPosition = function(oField, iCaretPos) { if (document.selection) { oField.focus (); var oSel = document.selection.createRange (); try { oSel.moveStart ('character', -oField.value.length); oSel.moveStart ('character', iCaretPos); oSel.moveEnd ('character', 0); oSel.select (); } catch (e) { } } else if (oField.selectionStart || oField.selectionStart == '0') { oField.selectionStart = iCaretPos; oField.selectionEnd = iCaretPos; oField.focus (); } else if (oField.setSelectionRange) { oField.setSelectionRange(iCaretPos, iCaretPos); } else if (oField.createTextRange) { var range = oField.createTextRange(); range.collapse(true); range.moveEnd('character', iCaretPos); range.moveStart('character', iCaretPos); range.select(); } else if (window.getSelection) { var sel = window.getSelection(); try { sel.collapse(oField, iCaretPos); } catch (e) { } } } EdubarUtils.mozePreskocit = function(oField,kam) { var selStart = this.doGetCaretPosition(oField); var selEnd = selStart; var val = oField.value ? oField.value : $j(oField).text(); var moze = false; if (kam == 'hore' && ((selStart == 0 && selEnd == 0))) moze = true; if (kam == 'dole' && ((selStart >= val.length && selEnd >= val.length))) { moze = true } if (kam == 'dolava' && ((selStart == 0 && selEnd == 0))) moze = true; if (kam == 'doprava' && ((selStart >= val.length && selEnd >= val.length))) moze = true; if ($j(oField).hasClass('ui-autocomplete-input') && (kam == 'hore' || kam == 'dole')) { if (event && event.which == 13) { moze = true; } else if ($j(oField).data('ignorable_open') && (!$j(oField).data('is_open') || $j(oField).data('itemCount') <=1)) { moze = true; } else if (kam == 'dole' && $j(oField).data('incoming_open') ) { moze = false; } else if ($j(oField).data('is_open')) { moze = false; } } if ($j(oField).hasClass('ui-autocomplete-input') && moze) { $j(oField).autocomplete('close'); } return moze; } EdubarUtils.kurzorNaKoniec = function(oField){ oField.focus(); var val = oField.value ? oField.value : $j(oField).html(); this.doSetCaretPosition(oField, val.length); } EdubarUtils.kurzorNaZaciatok = function(oField) { oField.focus(); this.doSetCaretPosition(oField, 0); } EdubarUtils.indexOf = function(arr, elt /*, from*/) { var len = arr.length >>> 0; var from = Number(arguments[2]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in arr && arr[from] == elt) return from; } return -1; }; EdubarUtils.getLoggedUser = function() { if (!edubar || !edubar.options || !edubar.options.loggedUser) return null; return edubar.options.loggedUser; } EdubarUtils.getUserType = function(userid) { if (userid.substr(0,6) == 'Ucitel') return 'Ucitel'; if (userid.substr(0,6) == 'Studen') return 'Student'; if (userid.substr(0,5) == 'Rodic') return 'Rodic'; if (userid.substr(0,5) == 'Admin') return 'Admin'; return ''; } EdubarUtils.getLoggedUserType = function() { if (!edubar) return ''; return this.getUserType(edubar.options.loggedUser); return ''; } EdubarUtils.isStudent = function () { if (this.getLoggedUserType() == 'Student') { return this.getLoggedUser().substr(7); } return null; } EdubarUtils.isStudentOrParent = function () { if (edubar && edubar.options.loggedChild) { return edubar.options.loggedChild; } return null; } EdubarUtils.isRodic = function () { if (this.getLoggedUserType() == 'Rodic') { return this.getLoggedUser().substr(5); } return null; } EdubarUtils.isUcitel = function () { if (this.getLoggedUserType() == 'Ucitel') { return this.getLoggedUser().substr(6); } return null; } EdubarUtils.isAdmin = function () { if (this.getLoggedUserType() == 'Admin') { return true; } return false; } EdubarUtils.formatTimeDiff = function(time) { var r = Math.floor(time/1000); var d = Math.floor(r/(24*3600)); r = r-d*(24*3600); var h = Math.floor(r/3600); r = r-h*3600; var m = Math.floor((r)/60); r = r-m*60; var s = Math.floor(r); var ret = ''; if (d>0) { ret += d.toString() + ' '+ls(1465).substr(0,1)+' '; /*if (d == 1) else if (d <= 4) ret += d.toString() + ' dni '; else ret += d.toString() + ' dní ';*/ } if (h>0) ret += (h<10 ? '0' : '')+h.toString()+':'; ret += (m<10 ? '0' : '')+m.toString()+':'; ret += (s<10 ? '0' : '')+s.toString(); return ret; } EdubarUtils.showAlert = function(msg) { var thisObj = this; var s = ''; s += '
'; s += msg; s += '
'; $j(s).appendTo('body').fadeIn(300).delay(10000).fadeOut(300, function(){ $j(this).remove(); }); }; EdubarUtils.getLang = function() { if (edubar && edubar.options && edubar.options.lang) return edubar.options.lang; return ''; } EdubarUtils.hexToRGB = function(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; } EdubarUtils.sortObject = function(obj, fields) { var ret = []; for (var id in obj) { ret.push(obj[id]); } ret.sort(function(a,b) { if (!fields) { return a.localeCompare(b); } for (var i=0;i parseFloat(bval)) { cmp = 1; } else if (parseFloat(aval) < parseFloat(bval)) { cmp = -1; } } else { aval = aval.toString(); bval = bval.toString(); cmp = aval.localeCompare(bval); } if (cmp != 0) return cmp; } return 0; }); return ret; } EdubarUtils.countObject = function(obj) { var poc = 0; for (var id in obj) { poc++; } return poc; } EdubarUtils.getVideoLink = function(id) { var lang = edubar && edubar.options.lang ? edubar.options.lang : 'en'; if (lang == 'sk' || lang == 'cz') { if (id == '11_preparations') return 'http://www.triednakniha.sk/#!/videos/241'; if (id == '12_preparations_withstudent') return 'http://www.triednakniha.sk/#!/videos/242'; if (id == '03_teachingplans') return 'http://www.triednakniha.sk/#!/videos/5'; if (id == '13_elearning_test') return 'http://www.triednakniha.sk/#!/videos/202'; return 'http://triednakniha.sk/video'; } else if (lang == 'de') { if (id == '11_preparations') return 'http://klassenbuch.edupage.org/#!/videos/222'; if (id == '12_preparations_withstudent') return 'http://klassenbuch.edupage.org/#!/videos/223'; if (id == '03_teachingplans') return 'http://klassenbuch.edupage.org/#!/videos/10'; if (id == '13_elearning_test') return 'http://klassenbuch.edupage.org/#!/videos/224'; return 'http://klassenbuch.edupage.org/video'; } else { if (id == '11_preparations') return 'http://classregister.edupage.org/#!/videos/231'; if (id == '12_preparations_withstudent') return 'http://classregister.edupage.org/#!/videos/232'; if (id == '03_teachingplans') return 'http://classregister.edupage.org/#!/videos/120'; if (id == '13_elearning_test') return 'http://classregister.edupage.org/#!/videos/233'; } return 'http://classregister.edupage.org/video'; } EdubarUtils.hexToRgb = function(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; }; EdubarUtils.componentToHex = function(c) { var hex = Math.min(255,Math.max(0,Math.round(c))).toString(16); return hex.length == 1 ? "0" + hex : hex; }; EdubarUtils.rgbToHex = function(r, g, b) { return "#" + this.componentToHex(r) + this.componentToHex(g) + this.componentToHex(b); }; EdubarUtils.mergeColors = function(color1,color2, pos) { if (color1 == '') { if (color2 == '') return '#ffffff'; return color1; } var rgb1 = this.hexToRgb(color1); var rgb2 = this.hexToRgb(color2); if (!rgb1 || !rgb2) { return color1; } var r = Math.max(0,Math.min(255,Math.round((rgb1.r*(1-pos)+rgb2.r*pos)))); var g = Math.max(0,Math.min(255,Math.round((rgb1.g*(1-pos)+rgb2.g*pos)))); var b = Math.max(0,Math.min(255,Math.round((rgb1.b*(1-pos)+rgb2.b*pos)))); return this.rgbToHex(r,g,b); } EdubarUtils.hsv2rgb = function(h, s, v) { var rgb, i, data = []; if (s === 0) { rgb = [v,v,v]; } else { h = h / 60; i = Math.floor(h); data = [v*(1-s), v*(1-s*(h-i)), v*(1-s*(1-(h-i)))]; switch(i) { case 0: rgb = [v, data[2], data[0]]; break; case 1: rgb = [data[1], v, data[0]]; break; case 2: rgb = [data[0], v, data[2]]; break; case 3: rgb = [data[0], data[1], v]; break; case 4: rgb = [data[2], data[0], v]; break; default: rgb = [v, data[0], data[1]]; break; } } return '#' + rgb.map(function(x){ return ("0" + Math.round(x*255).toString(16)).slice(-2); }).join(''); }; EdubarUtils.rgb2hsv = function(r, g, b) { var rr, gg, bb, r = r / 255, g = g / 255, b = b / 255, h, s, v = Math.max(r, g, b), diff = v - Math.min(r, g, b), diffc = function(c){ return (v - c) / 6 / diff + 1 / 2; }; if (diff == 0) { h = s = 0; } else { s = diff / v; rr = diffc(r); gg = diffc(g); bb = diffc(b); if (r === v) { h = bb - gg; }else if (g === v) { h = (1 / 3) + rr - bb; }else if (b === v) { h = (2 / 3) + gg - rr; } if (h < 0) { h += 1; }else if (h > 1) { h -= 1; } } return { h: Math.round(h * 360), s: Math.round(s * 100), v: Math.round(v * 100) }; } EdubarUtils.rgbToHsl = function(r, g, b){ r /= 255, g /= 255, b /= 255; var max = Math.max(r, g, b), min = Math.min(r, g, b); var h, s, l = (max + min) / 2; if(max == min){ h = s = 0; // achromatic }else{ var d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); switch(max){ case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } return {h: h, s: s, l:l}; } EdubarUtils.hslToRgb = function(h, s, l){ var r, g, b; if(s == 0){ r = g = b = l; // achromatic } else { function hue2rgb(p, q, t){ if(t < 0) t += 1; if(t > 1) t -= 1; if(t < 1/6) return p + (q - p) * 6 * t; if(t < 1/2) return q; if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; return p; } var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1/3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1/3); } return {r:r * 255, g: g * 255, b: b * 255}; } EdubarUtils.adjustBrightness = function(color, vall, vals) { var rgb = this.hexToRgb(color); if (!rgb) return color; var hsl = this.rgbToHsl(rgb.r, rgb.g, rgb.b); if (vall) hsl.l = hsl.l*vall; if (vals) hsl.s = hsl.s*vals; rgb = this.hslToRgb(hsl.h, hsl.s, hsl.l); return this.rgbToHex(rgb.r, rgb.g, rgb.b); //return this.hsv2rgb(hsv.h, hsv.s, hsv.v); } EdubarUtils.getQueryParameters = function(url) { var pos = url.indexOf('?'); var script = pos == -1 ? url : url.substr(0,pos); var ret = {}; var regExp = new RegExp('^(http.?://[^/]*)?/([^/]*)/.*$','gi'); var moduleParams = regExp.exec(script); ret.module = moduleParams ? moduleParams[2] : ''; ret.params = {}; var query = pos == -1 ? '' : url.substr(pos+1); var a = query.split('&'); if (a == "") return ret; var b = EdubarUtils.parseQueryParams(query); ret.params = b; return ret; } EdubarUtils.parseQueryParams = function(query) { var a = query.split('&'); var b = {}; for (var i = 0; i < a.length; ++i) { var p=a[i].split('='); if (p.length != 2) continue; if (p[0] == 'eqa') { var b2 = EdubarUtils.parseQueryParams(Base64.decode(decodeURIComponent(p[1].replace(/\+/g, " ")))); for (var x in b2) { b[x] = b2[x]; } } else { b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " ")); } } return b; } EdubarUtils.nl2br = function(str, is_xhtml) { var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '
' : '
'; return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2'); } EdubarUtils.getZnamkyPohladBtn = function(pohlad, triedaid, predmetid, planid, obdobie) { if (!planid) planid = ''; if (!obdobie) obdobie = ''; var cestaEnabled = true;//edubar && (edubar.options.server == 'edupage15' || edubar.options.edupage == 'ascgreenfield'); var osnovaEnabled = true;//edubar && (edubar.options.edupage == 'ascgreenfield' || edubar.options.server == 'edupage15'); var s = ''; s += ''; var items = []; if (EdubarUtils.isAdmin()) { if (pohlad=='kurz' || pohlad=='plan') { items.push({ 'id': 'kurz', 'img': '/plany/pics/icons/pohlad_kurz.png', 'url': '/plany/?pohlad=kurz&planid='+planid+'&triedaid='+triedaid+'&predmetid='+predmetid, 'name': ls(3891) }); items.push({ 'id': 'plan', 'img': '/plany/pics/icons/pohlad_plan.png', 'url': '/plany/?pohlad=plan&planid='+planid+'&triedaid='+triedaid+'&predmetid='+predmetid, 'name': ls(3662) }); } else { items.push({ 'id': 'uvod', 'img': '/znamky/pics/area_32.png', 'url': '/znamky/', 'name': ls(3976) }); items.push({ 'id': 'znamky', 'img': '/znamky/pics/znamky.png', 'url': '/znamky/?what=zobraztriedu&p='+(predmetid)+'&t='+(triedaid), 'name': ls(1131) }); items.push({ 'id': 'poznamky', 'img': '/global/pics/ui/note_32.png', 'url': '/znamky/?what=PoznamkyTriedy&triedaid='+triedaid+'&predmetid=', 'name': ls(4829) }); if (cestaEnabled) { items.push({ 'id': 'cesta', 'img': '/znamky/pics/cesta.png', 'url': '/znamky/?what=ZnamkyCestaTrieda&triedaid='+triedaid+'&predmetid='+predmetid+'&obdobie='+obdobie, 'name': ls(4910) }); } items.push({ 'id': 'kompetencie', 'img': '/znamky/pics/skills_fav_32.png', 'url': '/znamky/?what=KompetencieManager', 'name': ls(4224) }); if (osnovaEnabled) { items.push({ 'id': 'osnova', 'img': '/znamky/pics/responsability_assign_32.png', 'url': '/znamky/?what=OsnovaHodin', 'name': ls(6010) }); } } } else { items.push({ 'id': 'znamky', 'img': '/znamky/pics/znamky.png', 'url': '/znamky/?what=zobraztriedu&p='+(predmetid)+'&t='+(triedaid), 'name': ls(1131) }); items.push({ 'id': 'poznamky', 'img': '/global/pics/ui/note_32.png', 'url': '/znamky/?what=PoznamkyTriedy&triedaid='+triedaid+'&predmetid=', 'name': ls(4829) }); if (cestaEnabled) { items.push({ 'id': 'cesta', 'img': '/znamky/pics/cesta.png', 'url': '/znamky/?what=ZnamkyCestaTrieda&triedaid='+triedaid+'&predmetid='+predmetid+'&obdobie='+obdobie, 'name': ls(4910) }); } items.push({ 'id': 'kompetencie', 'img': '/znamky/pics/skills_fav_32.png', 'url': '/znamky/?what=kompetencie&t='+triedaid+'&p='+predmetid+(planid ? '&planid='+planid : ''), 'name': ls(4224) }); items.push({ 'id': 'kurz', 'img': '/plany/pics/icons/pohlad_kurz.png', 'url': '/plany/?pohlad=kurz&planid='+planid+'&triedaid='+triedaid+'&predmetid='+predmetid, 'name': ls(3891) }); items.push({ 'id': 'plan', 'img': '/plany/pics/icons/pohlad_plan.png', 'url': '/plany/?planid='+planid+'&triedaid='+triedaid+'&predmetid='+predmetid, 'name': ls(3662) }); } var ss = ''; s += ''; s += ''; return s; } EdubarUtils.switchRodicDieta = function(studentid, doneFunc) { $j('body').append('
'+ls(3358)+'
'); $j.get('/login/switchchild?studentid='+studentid, function(data) { $j('#barSmartLinkLoadingText').remove(); if (doneFunc) doneFunc(); }); }; EdubarUtils.formatFileSize = function(size) { var t = size + ' B'; if (size > 1000) t = Math.round(size / 1024) + ' KB'; if (size > 1000000) t = Math.round(size / 1024 / 1024) + ' MB'; return t; } EdubarUtils.strtr = function(str, from, to) { var fr = '', i = 0, j = 0, lenStr = 0, lenFrom = 0, tmpStrictForIn = false, fromTypeStr = '', toTypeStr = '', istr = ''; var tmpFrom = []; var tmpTo = []; var ret = ''; var match = false; // Received replace_pairs? // Convert to normal from->to chars if ( typeof from === 'object') { for (fr in from) { if (from.hasOwnProperty(fr)) { tmpFrom.push(fr); tmpTo.push(from[fr]); } } from = tmpFrom; to = tmpTo; } // Walk through subject and replace chars when needed lenStr = str.length; lenFrom = from.length; fromTypeStr = typeof from === 'string'; toTypeStr = typeof to === 'string'; for ( i = 0; i < lenStr; i++) { match = false; if (fromTypeStr) { istr = str.charAt(i); for ( j = 0; j < lenFrom; j++) { if (istr == from.charAt(j)) { match = true; break; } } } else { for ( j = 0; j < lenFrom; j++) { if (str.substr(i, from[j].length) == from[j]) { match = true; // Fast forward i = (i + from[j].length) - 1; break; } } } if (match) { ret += toTypeStr ? to.charAt(j) : to[j]; } else { ret += str.charAt(i); } } return ret; } var EduSettings = {}; EduSettings.getZaciatocnyMesiacRoku = function() { var turnover = edubar && edubar.options.year_turnover ? edubar.options.year_turnover : ''; if (!turnover) return 9; var month = Date.fromDbString(turnover).format('n'); if (month == 1) { return 1; } if (month != 8) return month; return 9; } EduSettings.getNazovSkolskehoRoku = function(rok) { var month = this.getZaciatocnyMesiacRoku(); if (month == 1) { return rok; } return rok+' / '+(rok+1); } EduSettings.getPoradieMesiacov = function() { var m = this.getZaciatocnyMesiacRoku()-1; var ret = []; for (var i=0;i<12;i++) { if (edubar && EdubarUtils.indexOf(['sk','cz'],edubar.options.school_country) != -1 && ((m+i)%12+1==7 || (m+i)%12+1==8)) continue; ret.push((m+i)%12+1); } return ret; } /*=================== edubarSections ===============================================*/ function barHideEdubar(anim) { var doAnimation = anim == null ? true : anim; if (doAnimation) { $j('#header').animate({height:0},300, function() {$j('#header').css('display','none')}); $j('#barHeaderMargin').animate({height:0},300); $j('#skinSidebar').css('display','block'); $j('#skinSidebar').animate({height:'100%'},300); } else { $j('#header').css('display','none'); $j('#skinSidebar').css('display','block'); $j('#skinSidebar').css('height','100%'); $j('#barHeaderMargin').css('height','0px'); } } function barShowEdubar() { $j('#header').css('display','block') $j('#header').animate({height:22},300); $j('#barHeaderMargin').animate({height:43},300); $j('#skinSidebar').animate({height:0},300,function() {$j('#skinSidebar').css('display','none')}); } function barSaveSkinSettings(skinData) { if (!skinData) { var frm = document.getElementById('edubarSkinSettingsFrm'); var skinData = $j(frm).serialize(); } $j.post('/customize/skinSettings.php', skinData, function(data) { if (data == 'ok') { document.location.reload(true); } else { alert('Nepodarilo sa uložiť nastavenia. Chybové hlásenie: '+data); } }); } function barRefreshSkinSettings() { var frm = document.getElementById('edubarSkinSettingsFrm'); frm.akcia.value = 'refreshSettings'; var skinData = $j(frm).serialize(); frm.akcia.value = 'changeSettings'; $j.post('/customize/skinSettings.php', skinData, function(data) { $j(data).appendTo('head'); }); } function barResetSkinSettings() { var data = {akcia: 'resetSettings'}; $j.post('/customize/skinSettings.php', data, function(data) { if (data == 'ok') { document.location.reload(true); } else { alert('Nepodarilo sa uložiť nastavenia. Chybové hlásenie: '+data); } }); } function barProcessSkinColor(val) { if (val.substr(0,1) == '#') { return val; } else if (val.substr(0,3) == 'rgb') { return val; } else if (val.substr(0,5) == 'theme') { return $j('.'+val).css('color'); } return val; } WebFontConfig = { google: { families: [] } }; function barLoadGoogleFont(fontName) { WebFontConfig.google.families.push(fontName+'::latin,latin-ext'); var wf = document.createElement('script'); wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'; wf.type = 'text/javascript'; wf.async = 'true'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wf, s); } function barAdminBtnListClick(groupid) { $j('#barSkinVolbaBtn .cp_groupDiv').hide(); $j('#barAdminBtn'+groupid).show(); $j('ul.barAdminBtnList > li').removeClass('selected'); $j('#barAdminBtnLi'+groupid).addClass('selected'); localStorage.setItem('barAdminBtnSelection',groupid); } /*==================== edubar dialogs ===================================================*/ var barDialogs = new Array(); function barOpenDialog(dlgId, dialogSrc, title, onCloseFunc, onBeforeCloseFunc) { barNewDialog({ 'id': dlgId, 'source': dialogSrc, 'title': title, 'close': onCloseFunc, 'beforeClose': onBeforeCloseFunc }); } function barNewDialog(params) { var useYui = $j('body > .yui-dialog').length > 0; var dialogSrc = params.source ? params.source : ''; var dialogClass = params.dialogClass ? params.dialogClass : ''; var postData = params.postData ? params.postData : {}; var dialogWidth = params.width ? params.width : 820; var onCloseFunc = params.close ? params.close : null; var onLoadFunc = params.onload ? params.onload : null; var onBeforeCloseFunc = params.beforeClose ? params.beforeClose : null; var dlgid = params.id ? params.id : ''; var buttons = params.buttons ? params.buttons : {}; var title = params.title ? params.title : ''; var height = params.height ? params.height: 'auto'; var resizeable = params.resizeable ? params.resizeable: true; var newDiv = $j('
').appendTo('body'); var returnFunc = params.returnFunc ? params.returnFunc : null; var modal = params.modal === false ? false : true; var dialogContent = params.content ? params.content : ''; if (dlgid != '') { newDiv.attr('id',dlgid); } else { if (!window.dlgid) window.dlgid = 0; window.dlgid++; dlgid = 'dlg'+(window.dlgid).toString(); newDiv.attr('id',dlgid); } if (dialogSrc != '') { newDiv.html('
'); } else { newDiv.html(dialogContent); var str = ''; for (var x in buttons) { var btn = buttons[x]; var cls = btn.buttonClass ? btn.buttonClass : 'button-blue'; var onclick = btn.type == 'close' ? 'barCloseDialog(this)' : (btn.click ? btn.click : ''); str += ''; } if (str != '') { newDiv.append('
'+str+'
'); } newDiv.addClass('dialog'); } if (useYui) { //var yuidlg = new YAHOO.widget.Dialog(dlgid); var yuidlg = new YAHOO.widget.Dialog('yuidlg'+dlgid,{modal:modal}); yuidlg.setHeader(title); yuidlg.setBody('
'); yuidlg.render(document.body); $j('#jdlg'+dlgid).replaceWith(newDiv); yuidlg.center(); newDiv.data('yuiDialog',yuidlg); newDiv.addClass('ui-dialog-content'); } else { newDiv.dialog({ 'modal': modal, 'dialogClass': dialogClass, 'width': dialogWidth+'px', 'height': height, 'maxHeight': $j(window).height()*0.98, 'resizeable': resizeable, 'close': function() { barDialogs.pop().remove(); $j('.tipsy').remove(); if (onCloseFunc) {onCloseFunc();} }, 'title': title, 'beforeClose': function() { if (onBeforeCloseFunc) { onBeforeCloseFunc(); } } }); } newDiv.data('returnFunc',returnFunc); barDialogs.push(newDiv); //postData["asDialog"] = 1; if (dialogSrc != '') { if (dialogSrc.indexOf('asDialog') == -1) { dialogSrc += (dialogSrc.indexOf('?') == -1 ? '?' : '&')+'asDialog=1'; } newDiv.data('source',dialogSrc); newDiv.data('postData',postData); $j.post(dialogSrc, postData, function(data) { if (data != '') { iconsSelectedImg = ''; newDiv.html(data); var str = ''; for (var x in buttons) { var btn = buttons[x]; var cls = btn.buttonClass ? btn.buttonClass : 'button-blue'; var onclick = btn.type == 'close' ? 'barCloseDialog(this)' : (btn.click ? btn.click : ''); str += ''+et(x)+''; } if (str != '') { newDiv.append('
'+str+'
'); } newDiv.addClass('dialog'); if (!useYui) { if (newDiv.height() > $j(window).height()) { newDiv.dialog('option','height',$j(window).height()*0.98); } newDiv.css('max-height',($j(window).height()*0.98-52)+'px'); newDiv.closest('.ui-dialog').css('position','fixed'); newDiv.dialog("option", "position", "center"); } else { yuidlg.center(); } barRefreshPage(); if (onLoadFunc) { onLoadFunc(newDiv); } } }); } else { if (!useYui) { if (newDiv.height() > $j(window).height()) { newDiv.dialog('option','height',$j(window).height()*0.98); } newDiv.css('max-height',($j(window).height()*0.98-52)+'px'); newDiv.closest('.ui-dialog').css('position','fixed'); newDiv.dialog("option", "position", "center"); } else { yuidlg.center(); } barRefreshPage(); if (onLoadFunc) { onLoadFunc(newDiv); } } newDiv.closest('.ui-dialog').css('position','fixed'); $j('.tipsy').remove(); $j('.dropDown').fadeOut(150); $j('.dropDownBtn').children('a').removeClass('icon-button-active'); return newDiv; } function barCloseDialog(elem) { if ($j(elem).closest('.yui-dialog').length>0) { var elem = $j(elem).closest('.ui-dialog-content'); elem.data('yuiDialog').hide(); } else { $j(elem).closest('.ui-dialog-content').dialog('close'); } } function barCenterDialog(elem) { if (elem.closest('.ui-dialog-content').data('ui-dialog')) { elem.closest('.ui-dialog-content').dialog("option","position", "centrer"); } } function barReloadDialog(elem, onLoadFunc) { var dlg = $j(elem).closest('.ui-dialog-content'); var dialogSrc = dlg.data('source'); var postData = dlg.data('postData'); dlg.append('
'); $j.post(dialogSrc, postData, function(data) { if (data != '') { dlg.html(data); dlg.toggleClass('dialog', true); if (dlg.height() > $j(window).height()) { dlg.dialog('option','height',$j(window).height()*0.98); } dlg.css('max-height',($j(window).height()*0.98-52)+'px'); dlg.closest('.ui-dialog').css('position','fixed'); dlg.dialog("option", "position", "center"); barRefreshPage(); if (onLoadFunc) { onLoadFunc(dlg); } } }); } function barGetDialogReturnFunc(elem) { if (elem.closest('.ui-dialog-content').data('returnFunc')) { return elem.closest('.ui-dialog-content').data('returnFunc'); } return null; } var iconsSelectedImg = ''; function bariconClicked(imgSrc, thumbSrc, w,h) { iconsSelectedImg = imgSrc; barDialogs[barDialogs.length-1].dialog("close"); } function barOpenLoginDialog(msg, onLoginComplete) { function dlgLoadFunc(dlg) { if (msg) { dlg.find('.loginMsgDiv').append('
'+msg+'
'); } if (onLoginComplete) { dlg.find('form').on('submit',function(event) { event.preventDefault(); $j.post($j(this).attr('action')+'asAjax=1', $j(this).serialize(), function(data) { if (data.substr(0,7) == 'loginok') { var pom = data.split(';'); edupage = pom[1]; onLoginComplete(edupage, pom[2], pom[3]); } else { dlg.html(data); dlgLoadFunc(dlg); dlg.dialog('options','position','center'); } }); return false; }); } }; var dlg = barNewDialog({ 'source': '/login/form', 'title': 'Prihlásenie', 'width': '450', 'onload': dlgLoadFunc }); } function barChangeLang(elem) { window.location=$j(elem).attr('data-l'); } function barShowMessageBox(msg) { var s = ''; s += ''; s += '

{!msg}

'; s += '
'; s += '
'; s += ''; s += '
'; dlg = barNewDialog({ 'title': et(ls(2315)), 'content': renderS(s, {msg: msg}), 'width': 350, 'close': function() { } }); } /** * * Base64 encode / decode * http://www.webtoolkit.info/ * **/ var Base64 = { // private property _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", // public method for encoding encode : function (input) { if (typeof btoa == 'function') return btoa(input); var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = Base64._utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }, // public method for decoding decode : function (input) { if (atob) return atob(input); var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } output = Base64._utf8_decode(output); return output; }, // private method for UTF-8 encoding _utf8_encode : function (string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, // private method for UTF-8 decoding _utf8_decode : function (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i < utftext.length ) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } }