/* --------------------------------------------------------------------------------- file-start: js/ads/holder.js */ var H_DEV = 0; function holder(divID, options) { var div=null,place=this; if (this instanceof holder){ if (typeof divID == "string"){ div = document.getElementById(divID); if(!div && !holder.isDomReady){ holder.list.add(function(){new holder(divID, options);});return; } } else { div = divID; divID = div.id; } if (holder.places[divID]) return holder.places[divID]; place.div = div; place.options = {}; place.loaded=0; options.d = divID; holder.merge(place.options, holder.options, options); holder.places[divID] = place; if (!options.nocall) holder.list.add(function(){place.load()}); return place; } else { return holder.places[divID]; } } holder.prototype = { load: function(){ var place=this,str='',vars={b:'block',s:'segment',r:'rnd',d:'d',u:'user',f:'f',h:'h'},row=place.options; if(place.loaded==1) row.rnd = Math.round(Math.random()*1000000000); for(i in vars)if(row[vars[i]])str+='&'+i+row[vars[i]]; holder.loadScript(holder.host + 's?ta' + str); place.loaded = 1; } } holder.merge = function() { var options, name, copy, target = arguments[0] || {}; for (i = 1 ; i < arguments.length; i++ ) if ( (options = arguments[i]) != null ) for (name in options ) if (options.hasOwnProperty(name) && options[name] !== undefined) target[name] = options[name]; return target; }; holder.loaded = function() { holder.isDomReady = true; holder.list.call(true); } holder.onload = function(func) { if (document.addEventListener) { document.addEventListener("DOMContentLoaded", func, false); return; } /*@cc_on @*/ /*@if (@_win32) var id='__ie_onloadA'+Math.round(Math.random()*1000000); document.write(''); var scr = document.getElementById(id); scr.onreadystatechange = function() { if (/loaded|complete/.test(this.readyState)) {this.onreadystatechange = null;window.setTimeout(func, 10);} }; /*@end @*/ if (/WebKit/i.test(navigator.userAgent)) { var _tmr = setInterval(function(){if (/loaded|complete/.test(document.readyState)){clearInterval(_tmr);func();}}, 20); } } holder.loadScript = function(src, func){ var scr = document.createElement("SCRIPT"); scr.async = "async"; scr.src = src; var head = document.getElementsByTagName('HEAD')[0]; if (!head) return; if (func) { scr.onload = scr.onreadystatechange = function(evt){ if (!scr.readyState || scr.readyState == 'loaded' || scr.readyState == 'complete') { scr.onload = scr.onreadystatechange = null; func(scr); } } } head.appendChild(scr); } holder.funcs = function(ready){this.list=[];this.ready=ready ? true: false} holder.funcs.prototype = { add: function(func){this.ready ? func() : this.list[this.list.length]=func;}, call: function(ready){ this.ready = ready ? true : false; var len = this.list.length; for (var i = 0; i < len; i++) this.list[i](); this.list.splice(0,len); } } holder.flashVer = function(){ var n=navigator,f='Shockwave Flash',m,d; if ((m=n.mimeTypes)&&(m=m["application/x-shockwave-flash"])&&m.enabledPlugin&&(n=n.plugins)&&n[f]){ d=n[f].description; } else if(window.ActiveXObject){ try{ d=(new ActiveXObject((f+'.'+f).replace(/ /g,''))).GetVariable('$version'); }catch(e){}} return d ? d.match(/(\d+)/)[0] : 0; } holder.flash = function(src, width, height, version, options, bn_url){ var isObject = !!window.ActiveXObject; var html = '', widthHeight = 'width="' + (width||'100%') + '" height="' + (height||'100%') + '"'; var params = holder.merge({}, {allowScriptAccess: "always", wmode: "opaque"}, options); if (typeof(bn_url)!='undefined') src += '?' + (typeof(flashVar)!='undefined' ? flashVar : 'bn_url=' + escape(bn_url)) params[isObject ? 'movie' : 'src'] = src; for (i in params) html += isObject ? '' : i + '="' + params[i] + '" '; return isObject ? '' + html + '<\/object>' : '<\/embed>'; } holder.img = function(href, options){ var str = ''; for(name in options) str += ' '+name+'="'+options[name]+'"' return ''; } holder.addElement = function(tag, parent, style, html){ var o = document.createElement(tag); holder.merge(o.style, style); if (parent) parent.appendChild(o); if (html) o.innerHTML = html; return o; } holder.addDiv = function(parent, style, html){ return holder.addElement("DIV", parent, style, html) } holder.switchVis=function(el){ el.style.visibility=(el.style.visibility=='hidden')?'visible':'hidden'; } holder.module = function(name){ if(this instanceof holder.module){ if(name && !holder.modules[name]){ this.name = name; this.list = new holder.funcs(); holder.modules[name] = this; this.load(); } } return holder.modules[name]; } holder.module.prototype = { ready: 0, onload: function(func){ if (this.ready==2) func(); else this.list.add(func); }, loaded: function(){ this.ready = 2; this.list.call(true); }, load: function(){ holder.loadScript((H_DEV ? '' : 'http://i.holder.com.ua/modules/') + this.name+'.js');//'http://i.holder.com.ua/modiles/'+ this.ready = 1; } } holder.start = function(){ holder.version = 1; holder.places = {}; holder.modules = {}; holder.options = {rnd: Math.round(Math.random()*100000000),nocall:0}; holder.options[(self!=top) ? 'f' : 'h'] = escape((self!=top) ? document.referrer : window.location.href); if (!holder.flashVer()) holder.options['noflash'] = 1; holder.host = H_DEV ? 'http://192.168.0.31:8109/' : "http://h.holder.com.ua/"; holder.isDomReady = false; holder.list = new holder.funcs(); holder.onload(holder.loaded); } if (typeof holder.version=='undefined') holder.start(); ; /* file-end: js/ads/holder.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/jquery/jquery.lj.repostbutton.js */ LJ.UI.registerTemplate('templates-CleanHtml-PaidRepost', " {{html LJ.mltext(\'paidrepost.button.label\')}} {{if !($data.owner)}}{{html $data.cost}}{{/if}} {{html LJ.mltext(\'paidrepost.button.label.done\')}}{{if !($data.owner)}}{{html $data.cost}}{{/if}} {{html $data.count}} ", 'JQuery.stat'); LJ.UI.registerTemplate('templates-CleanHtml-Repost', " {{html LJ.mltext(\'repost.button.label\')}} {{html LJ.mltext(\'entry.reference.label.reposted\')}} {{html $data.count}} ", 'JQuery.stat'); LJ.UI.registerTemplate('templates-CleanHtml-reposted', "{{if $data.content}} {{each ($value.users || $data.users)}}{{if !((!$index) && !($value.dropComma || $data.dropComma))}}, {{/if}}{{html ($value.user || $data.user)}}{{/each}} {{else}}
{{html LJ.mltext(\'repost.popup.head\')}}
{{/if}}", 'JQuery.stat'); /** * @name $.lj.repostbutton * @requires $.ui.core, $.ui.widget, $.lj.basicWidget, $.lj.bubble * @class Represents repost button * @author dmitry.petrov@sup.com (Dmitry Petrov), anazarov@sup.com (Alexander Nazarov) */ ;(function ($) { 'use strict'; /** @lends $.lj.repostbutton.prototype */ $.widget('lj.repostbutton', $.lj.basicWidget, { options: { classNames: { active: 'repost-button-active', inactive: 'repost-button-inactive', popupLoad: 'b-reposted-popup-load', popupNomore: 'b-reposted-popup-footer-hide', repostError: 'repost-error' }, selectors: { counterParent: '.lj-button-c', button: '.lj-button-b', counter: '.lj-like-item-count', buttonLink: '.lj-button-link', popupContent: '.b-reposted-popup-content', popupFooter: '.b-reposted-popup-footer', popupMore: '.b-reposted-popup-footer > a' }, templates: { popup: 'templates-CleanHtml-reposted' }, url: '', reposted: false, cost: 0, budget: 0, paid: false }, _create: function() { $.lj.basicWidget.prototype._create.apply(this); if (!this.options.url) { console.warn(this.widgetName, ': no url in options, initialization won\'t continue'); } this._journal = LJ.get('currentJournal'); this._count = null; this._remote = LJ.get('remoteUser'); this._reposted = this.options.reposted; this._el('buttonLink'); this._href = this.element.find(this._s('button')).data('href'); this._href = LJ.Util.Journal.parseLink(this._href) || {}; if (!this._canRepost()) { this.element.addClass(this._cl('inactive')); this._buttonLink.removeAttr('title'); this._lock(); } this._popup = null; this._popupContent = null; this._popupLocked = false; this._lastUser = null; this._el('counterParent'); this._el('counter'); if (!Number(this._counter.html())) { this._hideCounter(); } this._bindControls(); }, _hideCounter: function () { this._counterParent.addClass('empty'); }, _showCounter: function () { this._counterParent.removeClass('empty'); }, _bindControls: function() { var repost = this; this.element.on('click', this._s('button'), this._onUpdateButton.bind(this)); this._counterParent.one('click', function() { if ( !Number(repost._counter.html()) ) { return; } repost._popup = repost._tmpl('popup'); repost._el('popupFooter', repost._popup); repost._popupContent = repost._popup.find(repost._s('popupContent')); repost._popup.bubble({ showOn: 'click', align: 'side', alwaysShowUnderTarget: true, target: repost._counterParent }) .on('bubblehide', function () { repost._lastUser = null; repost._popupContent.empty(); repost._popupFooter.removeClass(repost._cl('popupNomore')); }) .on('bubbleshow', function () { repost._loadRepostedList(); }) .on('click', repost._s('popupMore'), repost._loadRepostedList.bind(repost)); Function.defer(function() { repost._popup.bubble('show'); }); }); $.lj.basicWidget.prototype._bindControls.apply(repost); }, _loadRepostedList: function(ev) { var repost = this; if (ev) { ev.preventDefault(); } if (this._popupLocked) { return; } this._popupLocked = true; this._popupContent.addClass(this._cl('popupLoad')); LJ.Api.call('repost.get_list', { url: this.options.url, last: this._lastUser }, function(answer) { repost._popupContent.removeClass(repost._cl('popupLoad')); repost._popupLocked = false; if (answer.error) { repost._handleAnswer(answer); } else { repost._render(answer.users, answer.nomore, answer.count); repost._lastUser = answer.last; } }); }, _render: function(users, nomore, count) { var repost = this; /* Display users */ if (users.length > 0) { repost._tmpl('popup', { content: true, dropComma: !!repost._lastUser, users: users }).appendTo(repost._popupContent); } this._updateCounter(count); /* Hide 'Show More' button */ if (nomore) { repost._popupFooter.addClass(repost._cl('popupNomore')); } }, _onUpdateButton: function(ev) { if (!this.locked()) { this.toggleRepost(); } ev.preventDefault(); }, _handleAnswer: function(answer) { if (answer.hasOwnProperty('delete')) { if (answer.message) { this._showMessage(answer.message); } /* LJSUP-13479: Repost type or cost changed */ if ( this.paid !== Boolean(answer.paid) || this.paid && (this.cost !== answer.cost) ) { this.element.replaceWith(LJ.Likes.renderRepostButton(this.options.url, answer)); return; } } if (answer.error) { if (answer.error.message) { this._showMessage(answer.error.message); } if (answer.error.data) { // Redraw button completely with new data this.element.replaceWith(LJ.Likes.renderRepostButton(this.options.url, answer.error.data)); return; } } else { this._updateButton( !this._reposted ); } if (!answer.hasOwnProperty('count') && answer.hasOwnProperty('delete')) { answer.count = this._count - 1; } this._updateCounter(answer.count); this._unlock(); }, _showMessage: function (message) { var errorBubble = $('
', { 'class': this._cl('repostError'), text: message }) .bubble({ target: this.element, align: 'center', hide: function () { errorBubble.remove(); } }) .bubble('show'); }, _updateButton: function(reposted) { this._reposted = reposted; this.element.toggleClass(this._cl('active'), this._reposted); }, _updateCounter: function (count) { if (typeof count !== 'undefined') { this._count = Number(count); this._counter.html(this._count); } if (!Number(this._counter.html())) { this._hideCounter(); } else { this._showCounter(); } }, _canRepost: function () { if (LJ.get('preview')) { return false; } if (!this._remote) { return false; } if (LJ.get('remote_is_identity')) { return false; } if (this._remote === this._href.journal) { return false; } return true; }, toggleRepost: function() { var repost = this, args = { url: this.options.url }; if (!this._canRepost()) { return; } if (this._count === null) { this._count = parseInt( this._el('counter').html(), 10) || 0; } this._lock(); if (this._reposted) { LJ.Api.call('repost.delete', args, function (answer) { /* LJSUP-12559: Reload page when repost is deleted in remote user's journal */ if (!answer.error && !answer.reposted && repost._journal === repost._remote && !location.href.match(/\/friends(?:friends|times)?\b/)) { location.reload(); } else { repost._handleAnswer(answer); } }); } else { args.timezone = LJ.Util.Date.timezone(); if (this.options.paid) { args.cost = this.options.cost; } LJ.Api.call('repost.create', args, this._handleAnswer.bind(this)); } } }); }(jQuery)); ; /* file-end: js/jquery/jquery.lj.repostbutton.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/jquery/jquery.lj.photouploader.js */ /* --------------------------------------------------------------------------------- file-start: js/lib/jquery-ui/jquery.ui.mouse.min.js */ /*! jQuery UI - v1.8.24 - 2012-09-28 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.mouse.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);; /* file-end: js/lib/jquery-ui/jquery.ui.mouse.min.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/lib/jquery-ui/jquery.ui.sortable.min.js */ /*! jQuery UI - v1.8.24 - 2012-09-28 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.sortable.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ (function(a,b){a.widget("ui.sortable",a.ui.mouse,{widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f)return e=a(this),!1});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}return this.currentItem=e,this._removeCurrentsFromItems(),!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(f.instance!==this.currentContainer)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(!b)return;a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+jf&&b+ka[this.floating?"width":"height"]?l:f0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return e||(b.style.visibility="hidden"),b},update:function(a,b){if(e&&!d.forcePlaceholderSize)return;b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.containers[d].floating?this.items[i].item.offset().left:this.items[i].item.offset().top;Math.abs(j-h)0?"down":"up")}if(!g&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[d],g?this._rearrange(b,g,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):c.helper=="clone"?this.currentItem.clone():this.currentItem;return d.parents("body").length||a(c.appendTo!="parent"?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(d[0]),d[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(d[0].style.width==""||c.forceHelperSize)&&d.width(this.currentItem.width()),(d[0].style.height==""||c.forceHelperSize)&&d.height(this.currentItem.height()),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=a(b.containment)[0],d=a(b.containment).offset(),e=a(c).css("overflow")!="hidden";this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(e?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(e?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var f=b.pageX,g=b.pageY;if(this.originalPosition){this.containment&&(b.pageX-this.offset.click.leftthis.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.topthis.containment[3]?h-this.offset.click.topthis.containment[2]?i-this.offset.click.left=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f', '', '', '', '', '', '', '
'].join(""); }; // Private: getFlashVars builds the parameter string that will be passed // to flash in the flashvars param. SWFUpload.prototype.getFlashVars = function () { // Build a string from the post param object var paramString = this.buildParamString(); var httpSuccessString = this.settings.http_success.join(","); // Build the parameter string return ["movieName=", encodeURIComponent(this.movieName), "&uploadURL=", encodeURIComponent(this.settings.upload_url), "&useQueryString=", encodeURIComponent(this.settings.use_query_string), "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), "&httpSuccess=", encodeURIComponent(httpSuccessString), "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), "&params=", encodeURIComponent(paramString), "&filePostName=", encodeURIComponent(this.settings.file_post_name), "&fileTypes=", encodeURIComponent(this.settings.file_types), "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), "&buttonWidth=", encodeURIComponent(this.settings.button_width), "&buttonHeight=", encodeURIComponent(this.settings.button_height), "&buttonText=", encodeURIComponent(this.settings.button_text), "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), "&buttonAction=", encodeURIComponent(this.settings.button_action), "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), "&buttonCursor=", encodeURIComponent(this.settings.button_cursor) ].join(""); }; // Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload // The element is cached after the first lookup SWFUpload.prototype.getMovieElement = function () { if (this.movieElement == undefined) { this.movieElement = document.getElementById(this.movieName); } if (this.movieElement === null) { if (SWFUpload.debug) throw "Could not find Flash element"; } return this.movieElement; }; // Private: buildParamString takes the name/value pairs in the post_params setting object // and joins them up in to a string formatted "name=value&name=value" SWFUpload.prototype.buildParamString = function () { var postParams = this.settings.post_params; var paramStringPairs = []; if (typeof(postParams) === "object") { for (var name in postParams) { if (postParams.hasOwnProperty(name)) { paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString())); } } } return paramStringPairs.join("&"); }; // Public: Used to remove a SWFUpload instance from the page. This method strives to remove // all references to the SWF, and other objects so memory is properly freed. // Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state. // Credits: Major improvements provided by steffen SWFUpload.prototype.destroy = function () { try { // Make sure Flash is done before we try to remove it this.cancelUpload(null, false); // Remove the SWFUpload DOM nodes var movieElement = null; movieElement = this.getMovieElement(); if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE // Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround) for (var i in movieElement) { try { if (typeof(movieElement[i]) === "function") { movieElement[i] = null; } } catch (ex1) {} } // Remove the Movie Element from the page try { movieElement.parentNode.removeChild(movieElement); } catch (ex) {} } // Remove IE form fix reference window[this.movieName] = null; // Destroy other references SWFUpload.instances[this.movieName] = null; delete SWFUpload.instances[this.movieName]; this.movieElement = null; this.settings = null; this.customSettings = null; this.eventQueue = null; this.movieName = null; return true; } catch (ex2) { return false; } }; // Public: displayDebugInfo prints out settings and configuration // information about this SWFUpload instance. // This function (and any references to it) can be deleted when placing // SWFUpload in production. SWFUpload.prototype.displayDebugInfo = function () { this.debug( [ "---SWFUpload Instance Info---\n", "Version: ", SWFUpload.version, "\n", "Movie Name: ", this.movieName, "\n", "Settings:\n", "\t", "upload_url: ", this.settings.upload_url, "\n", "\t", "flash_url: ", this.settings.flash_url, "\n", "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", "\t", "http_success: ", this.settings.http_success.join(", "), "\n", "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", "\t", "file_post_name: ", this.settings.file_post_name, "\n", "\t", "post_params: ", this.settings.post_params.toString(), "\n", "\t", "file_types: ", this.settings.file_types, "\n", "\t", "file_types_description: ", this.settings.file_types_description, "\n", "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", "\t", "debug: ", this.settings.debug.toString(), "\n", "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", "\t", "button_width: ", this.settings.button_width.toString(), "\n", "\t", "button_height: ", this.settings.button_height.toString(), "\n", "\t", "button_text: ", this.settings.button_text.toString(), "\n", "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", "\t", "button_action: ", this.settings.button_action.toString(), "\n", "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", "Event Handlers:\n", "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n" ].join("") ); }; /* Note: addSetting and getSetting are no longer used by SWFUpload but are included the maintain v2 API compatibility */ // Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used. SWFUpload.prototype.addSetting = function (name, value, default_value) { if (value == undefined) { return (this.settings[name] = default_value); } else { return (this.settings[name] = value); } }; // Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found. SWFUpload.prototype.getSetting = function (name) { if (this.settings[name] != undefined) { return this.settings[name]; } return ""; }; // Private: callFlash handles function calls made to the Flash element. // Calls are made with a setTimeout for some functions to work around // bugs in the ExternalInterface library. SWFUpload.prototype.callFlash = function (functionName, argumentArray) { argumentArray = argumentArray || []; var movieElement = this.getMovieElement(); var returnValue, returnString; // Flash's method if calling ExternalInterface methods (code adapted from MooTools). try { returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + ''); returnValue = eval(returnString); } catch (ex) { if (SWFUpload.debug) throw "Call to " + functionName + " failed"; } // Unescape file post param values if (returnValue != undefined && typeof returnValue.post === "object") { returnValue = this.unescapeFilePostParams(returnValue); } return returnValue; }; /* ***************************** -- Flash control methods -- Your UI should use these to operate SWFUpload ***************************** */ // WARNING: this function does not work in Flash Player 10 // Public: selectFile causes a File Selection Dialog window to appear. This // dialog only allows 1 file to be selected. SWFUpload.prototype.selectFile = function () { this.callFlash("SelectFile"); }; // WARNING: this function does not work in Flash Player 10 // Public: selectFiles causes a File Selection Dialog window to appear/ This // dialog allows the user to select any number of files // Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names. // If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around // for this bug. SWFUpload.prototype.selectFiles = function () { this.callFlash("SelectFiles"); }; // Public: startUpload starts uploading the first file in the queue unless // the optional parameter 'fileID' specifies the ID SWFUpload.prototype.startUpload = function (fileID) { this.callFlash("StartUpload", [fileID]); }; // Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index. // If you do not specify a fileID the current uploading file or first file in the queue is cancelled. // If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter. SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) { if (triggerErrorEvent !== false) { triggerErrorEvent = true; } this.callFlash("CancelUpload", [fileID, triggerErrorEvent]); }; // Public: stopUpload stops the current upload and requeues the file at the beginning of the queue. // If nothing is currently uploading then nothing happens. SWFUpload.prototype.stopUpload = function () { this.callFlash("StopUpload"); }; /* ************************ * Settings methods * These methods change the SWFUpload settings. * SWFUpload settings should not be changed directly on the settings object * since many of the settings need to be passed to Flash in order to take * effect. * *********************** */ // Public: getStats gets the file statistics object. SWFUpload.prototype.getStats = function () { return this.callFlash("GetStats"); }; // Public: setStats changes the SWFUpload statistics. You shouldn't need to // change the statistics but you can. Changing the statistics does not // affect SWFUpload accept for the successful_uploads count which is used // by the upload_limit setting to determine how many files the user may upload. SWFUpload.prototype.setStats = function (statsObject) { this.callFlash("SetStats", [statsObject]); }; // Public: getFile retrieves a File object by ID or Index. If the file is // not found then 'null' is returned. SWFUpload.prototype.getFile = function (fileID) { if (typeof(fileID) === "number") { return this.callFlash("GetFileByIndex", [fileID]); } else { return this.callFlash("GetFile", [fileID]); } }; // Public: addFileParam sets a name/value pair that will be posted with the // file specified by the Files ID. If the name already exists then the // exiting value will be overwritten. SWFUpload.prototype.addFileParam = function (fileID, name, value) { return this.callFlash("AddFileParam", [fileID, name, value]); }; // Public: removeFileParam removes a previously set (by addFileParam) name/value // pair from the specified file. SWFUpload.prototype.removeFileParam = function (fileID, name) { this.callFlash("RemoveFileParam", [fileID, name]); }; // Public: setUploadUrl changes the upload_url setting. SWFUpload.prototype.setUploadURL = function (url) { this.settings.upload_url = url.toString(); this.callFlash("SetUploadURL", [url]); }; // Public: setPostParams changes the post_params setting SWFUpload.prototype.setPostParams = function (paramsObject) { this.settings.post_params = paramsObject; this.callFlash("SetPostParams", [paramsObject]); }; // Public: addPostParam adds post name/value pair. Each name can have only one value. SWFUpload.prototype.addPostParam = function (name, value) { this.settings.post_params[name] = value; this.callFlash("SetPostParams", [this.settings.post_params]); }; // Public: removePostParam deletes post name/value pair. SWFUpload.prototype.removePostParam = function (name) { delete this.settings.post_params[name]; this.callFlash("SetPostParams", [this.settings.post_params]); }; // Public: setFileTypes changes the file_types setting and the file_types_description setting SWFUpload.prototype.setFileTypes = function (types, description) { this.settings.file_types = types; this.settings.file_types_description = description; this.callFlash("SetFileTypes", [types, description]); }; // Public: setFileSizeLimit changes the file_size_limit setting SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) { this.settings.file_size_limit = fileSizeLimit; this.callFlash("SetFileSizeLimit", [fileSizeLimit]); }; // Public: setFileUploadLimit changes the file_upload_limit setting SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) { this.settings.file_upload_limit = fileUploadLimit; this.callFlash("SetFileUploadLimit", [fileUploadLimit]); }; // Public: setFileQueueLimit changes the file_queue_limit setting SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) { this.settings.file_queue_limit = fileQueueLimit; this.callFlash("SetFileQueueLimit", [fileQueueLimit]); }; // Public: setFilePostName changes the file_post_name setting SWFUpload.prototype.setFilePostName = function (filePostName) { this.settings.file_post_name = filePostName; this.callFlash("SetFilePostName", [filePostName]); }; // Public: setUseQueryString changes the use_query_string setting SWFUpload.prototype.setUseQueryString = function (useQueryString) { this.settings.use_query_string = useQueryString; this.callFlash("SetUseQueryString", [useQueryString]); }; // Public: setRequeueOnError changes the requeue_on_error setting SWFUpload.prototype.setRequeueOnError = function (requeueOnError) { this.settings.requeue_on_error = requeueOnError; this.callFlash("SetRequeueOnError", [requeueOnError]); }; // Public: setHTTPSuccess changes the http_success setting SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) { if (typeof http_status_codes === "string") { http_status_codes = http_status_codes.replace(" ", "").split(","); } this.settings.http_success = http_status_codes; this.callFlash("SetHTTPSuccess", [http_status_codes]); }; // Public: setHTTPSuccess changes the http_success setting SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) { this.settings.assume_success_timeout = timeout_seconds; this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]); }; // Public: setDebugEnabled changes the debug_enabled setting SWFUpload.prototype.setDebugEnabled = function (debugEnabled) { this.settings.debug_enabled = debugEnabled; this.callFlash("SetDebugEnabled", [debugEnabled]); }; // Public: setButtonImageURL loads a button image sprite SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) { if (buttonImageURL == undefined) { buttonImageURL = ""; } this.settings.button_image_url = buttonImageURL; this.callFlash("SetButtonImageURL", [buttonImageURL]); }; // Public: setButtonDimensions resizes the Flash Movie and button SWFUpload.prototype.setButtonDimensions = function (width, height) { this.settings.button_width = width; this.settings.button_height = height; var movie = this.getMovieElement(); if (movie != undefined) { movie.style.width = width + "px"; movie.style.height = height + "px"; } this.callFlash("SetButtonDimensions", [width, height]); }; // Public: setButtonText Changes the text overlaid on the button SWFUpload.prototype.setButtonText = function (html) { this.settings.button_text = html; this.callFlash("SetButtonText", [html]); }; // Public: setButtonTextPadding changes the top and left padding of the text overlay SWFUpload.prototype.setButtonTextPadding = function (left, top) { this.settings.button_text_top_padding = top; this.settings.button_text_left_padding = left; this.callFlash("SetButtonTextPadding", [left, top]); }; // Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button SWFUpload.prototype.setButtonTextStyle = function (css) { this.settings.button_text_style = css; this.callFlash("SetButtonTextStyle", [css]); }; // Public: setButtonDisabled disables/enables the button SWFUpload.prototype.setButtonDisabled = function (isDisabled) { this.settings.button_disabled = isDisabled; this.callFlash("SetButtonDisabled", [isDisabled]); }; // Public: setButtonAction sets the action that occurs when the button is clicked SWFUpload.prototype.setButtonAction = function (buttonAction) { this.settings.button_action = buttonAction; this.callFlash("SetButtonAction", [buttonAction]); }; // Public: setButtonCursor changes the mouse cursor displayed when hovering over the button SWFUpload.prototype.setButtonCursor = function (cursor) { this.settings.button_cursor = cursor; this.callFlash("SetButtonCursor", [cursor]); }; /* ******************************* Flash Event Interfaces These functions are used by Flash to trigger the various events. All these functions a Private. Because the ExternalInterface library is buggy the event calls are added to a queue and the queue then executed by a setTimeout. This ensures that events are executed in a determinate order and that the ExternalInterface bugs are avoided. ******************************* */ SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) { // Warning: Don't call this.debug inside here or you'll create an infinite loop if (argumentArray == undefined) { argumentArray = []; } else if (!(argumentArray instanceof Array)) { argumentArray = [argumentArray]; } var self = this; if (typeof this.settings[handlerName] === "function") { // Queue the event this.eventQueue.push(function () { this.settings[handlerName].apply(this, argumentArray); }); // Execute the next queued event setTimeout(function () { self.executeNextEvent(); }, 0); } else if (this.settings[handlerName] !== null) { if (SWFUpload.debug) throw "Event handler " + handlerName + " is unknown or is not a function"; } }; // Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout // we must queue them in order to garentee that they are executed in order. SWFUpload.prototype.executeNextEvent = function () { // Warning: Don't call this.debug inside here or you'll create an infinite loop var f = this.eventQueue ? this.eventQueue.shift() : null; if (typeof(f) === "function") { f.apply(this); } }; // Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have // properties that contain characters that are not valid for JavaScript identifiers. To work around this // the Flash Component escapes the parameter names and we must unescape again before passing them along. SWFUpload.prototype.unescapeFilePostParams = function (file) { var reg = /[$]([0-9a-f]{4})/i; var unescapedPost = {}; var uk; if (file != undefined) { for (var k in file.post) { if (file.post.hasOwnProperty(k)) { uk = k; var match; while ((match = reg.exec(uk)) !== null) { uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16))); } unescapedPost[uk] = file.post[k]; } } file.post = unescapedPost; } return file; }; // Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working) SWFUpload.prototype.testExternalInterface = function () { try { return this.callFlash("TestExternalInterface"); } catch (ex) { return false; } }; // Private: This event is called by Flash when it has finished loading. Don't modify this. // Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded. SWFUpload.prototype.flashReady = function () { // Check that the movie element is loaded correctly with its ExternalInterface methods defined var movieElement = this.getMovieElement(); if (!movieElement) { this.debug("Flash called back ready but the flash movie can't be found."); return; } this.cleanUp(movieElement); this.queueEvent("swfupload_loaded_handler"); }; // Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE. // This function is called by Flash each time the ExternalInterface functions are created. SWFUpload.prototype.cleanUp = function (movieElement) { // Pro-actively unhook all the Flash functions try { if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); for (var key in movieElement) { try { if (typeof(movieElement[key]) === "function") { movieElement[key] = null; } } catch (ex) { } } } } catch (ex1) { } // Fix Flashes own cleanup code so if the SWFMovie was removed from the page // it doesn't display errors. window["__flash__removeCallback"] = function (instance, name) { try { if (instance) { instance[name] = null; } } catch (flashEx) { } }; }; /* This is a chance to do something before the browse window opens */ SWFUpload.prototype.fileDialogStart = function () { this.queueEvent("file_dialog_start_handler"); }; /* Called when a file is successfully added to the queue. */ SWFUpload.prototype.fileQueued = function (file) { file = this.unescapeFilePostParams(file); this.queueEvent("file_queued_handler", file); }; /* Handle errors that occur when an attempt to queue a file fails. */ SWFUpload.prototype.fileQueueError = function (file, errorCode, message) { file = this.unescapeFilePostParams(file); this.queueEvent("file_queue_error_handler", [file, errorCode, message]); }; /* Called after the file dialog has closed and the selected files have been queued. You could call startUpload here if you want the queued files to begin uploading immediately. */ SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) { this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]); }; SWFUpload.prototype.uploadStart = function (file) { file = this.unescapeFilePostParams(file); this.queueEvent("return_upload_start_handler", file); }; SWFUpload.prototype.returnUploadStart = function (file) { var returnValue; if (typeof this.settings.upload_start_handler === "function") { file = this.unescapeFilePostParams(file); returnValue = this.settings.upload_start_handler.call(this, file); } else if (this.settings.upload_start_handler != undefined) { if (SWFUpload.debug) throw "upload_start_handler must be a function"; } // Convert undefined to true so if nothing is returned from the upload_start_handler it is // interpretted as 'true'. if (returnValue === undefined) { returnValue = true; } returnValue = !!returnValue; this.callFlash("ReturnUploadStart", [returnValue]); }; SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) { file = this.unescapeFilePostParams(file); this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]); }; SWFUpload.prototype.uploadError = function (file, errorCode, message) { file = this.unescapeFilePostParams(file); this.queueEvent("upload_error_handler", [file, errorCode, message]); }; SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) { file = this.unescapeFilePostParams(file); this.queueEvent("upload_success_handler", [file, serverData, responseReceived]); }; SWFUpload.prototype.uploadComplete = function (file) { file = this.unescapeFilePostParams(file); this.queueEvent("upload_complete_handler", file); }; /* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the internal debug console. You can override this event and have messages written where you want. */ SWFUpload.prototype.debug = function (message) { this.queueEvent("debug_handler", message); }; /* ********************************** Debug Console The debug console is a self contained, in page location for debug message to be sent. The Debug Console adds itself to the body if necessary. The console is automatically scrolled as messages appear. If you are using your own debug handler or when you deploy to production and have debug disabled you can remove these functions to reduce the file size and complexity. ********************************** */ // Private: debugMessage is the default debug_handler. If you want to print debug messages // call the debug() function. When overriding the function your own function should // check to see if the debug setting is true before outputting debug information. SWFUpload.prototype.debugMessage = function (message) { if (this.settings.debug) { var exceptionMessage, exceptionValues = []; // Check for an exception object and print it nicely if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") { for (var key in message) { if (message.hasOwnProperty(key)) { exceptionValues.push(key + ": " + message[key]); } } exceptionMessage = exceptionValues.join("\n") || ""; exceptionValues = exceptionMessage.split("\n"); exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: "); SWFUpload.Console.writeLine(exceptionMessage); } else { SWFUpload.Console.writeLine(message); } } }; SWFUpload.Console = {}; SWFUpload.Console.writeLine = function (message) { var console, documentForm; try { console = document.getElementById("SWFUpload_Console"); if (!console) { documentForm = document.createElement("form"); document.getElementsByTagName("body")[0].appendChild(documentForm); console = document.createElement("textarea"); console.id = "SWFUpload_Console"; console.style.fontFamily = "monospace"; console.setAttribute("wrap", "off"); console.wrap = "off"; console.style.overflow = "auto"; console.style.width = "700px"; console.style.height = "350px"; console.style.margin = "5px"; documentForm.appendChild(console); } console.value += message + "\n"; console.scrollTop = console.scrollHeight - console.clientHeight; } catch (ex) { alert("Exception: " + ex.name + " Message: " + ex.message); } }; ; /* file-end: js/swfupload/swfupload.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/swfupload/swfobject.js */ /* SWFObject v2.2 is released under the MIT License */ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab 0) { this.cancelUpload(); stats = this.getStats(); } }; SWFUpload.queue.uploadStartHandler = function (file) { var returnValue; if (typeof(this.queueSettings.user_upload_start_handler) === "function") { returnValue = this.queueSettings.user_upload_start_handler.call(this, file); } // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value. returnValue = (returnValue === false) ? false : true; this.queueSettings.queue_cancelled_flag = !returnValue; return returnValue; }; SWFUpload.queue.uploadCompleteHandler = function (file) { var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler; var continueUpload; if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) { this.queueSettings.queue_upload_count++; } if (typeof(user_upload_complete_handler) === "function") { continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true; } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) { // If the file was stopped and re-queued don't restart the upload continueUpload = false; } else { continueUpload = true; } if (continueUpload) { var stats = this.getStats(); if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) { this.startUpload(); } else if (this.queueSettings.queue_cancelled_flag === false) { this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]); this.queueSettings.queue_upload_count = 0; } else { this.queueSettings.queue_cancelled_flag = false; this.queueSettings.queue_upload_count = 0; } } }; }; /* file-end: js/swfupload/swfupload.queue.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/jquery/jquery.fotki.js */ /* --------------------------------------------------------------------------------- file-start: js/core/string.js */ ;(function () { 'use strict'; LJ.define('LJ.String'); /** * Add leading zeros to number until it will have correct length * @param {*} str Any string or value that will be stringified * @param {Number} length Needed length * @param {String} symbol Symbol for padding * @return {String} Padded value * * @example * var padded = LJ.string.pad('hello', 8, ' '); // => ' hello'; */ LJ.String.pad = function (str, length, symbol) { str = str.toString(); if (typeof length === 'undefined') { throw new Error('You should provide padding string length'); } if (typeof symbol === 'undefined') { throw new Error('You should provide padding symbol'); } if (str.length >= length) { return str; } while (str.length < length) { str = symbol + str; } return str.length === length ? str : str.slice(-length); }; /** * Capitalize string * @param {String} str String to be capitalized * @return {String} Capitalized string * * @example * LJ.String.capitalize('HELLO'); // => "Hello" */ LJ.String.capitalize = function (str) { var length; if (typeof str !== 'string') { throw new Error('You should provide string as argument'); } length = str.length; if (length === 0) { return str; } else if (length === 1) { return str.toUpperCase(); } else { return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); } }; /** * Add http:// if not present * @param {String} str Input string * * @return {String} Link with default protocol (http://) if needed */ LJ.String.linkify = function(str) { var rxLink = new RegExp('^(?:([a-zA-Z]+):)?//'), alternative = /^[a-zA-Z]+:/, // mailto: rxEmptyProtocol = /^:\/\//; // ://yandex.ru var defaultProtocol = alternative.test(str) ? '' : 'http://'; return rxLink.test(str) ? str : defaultProtocol + (rxEmptyProtocol.test(str) ? str.replace('://', '') : str); }; /** * Split by char(s), trim all values, remove empty elements * * @param {String} str String to split * @param {String} char Character(s) to use for splitting * @return {Array} Array of splitted values */ LJ.String.smartSplit = function(str, char) { if (typeof char === 'undefined') { char = ','; } return str.split(char).map(function(item) { return item.trim(); }).filter(Boolean); }; }()); ; /* file-end: js/core/string.js ----------------------------------------------------------------------------------*/ /** * @author dmitry.petrov@sup.com (Dmitry Petrov) * @fileoverview Library function to deal with new photohosting */ (function($) { 'use strict'; /** * @name $.fotki * @namespace Library should encapsulate all operations on photos * and albums on the new photos. */ $.fotki = $.fotki || { /** * @type Boolean */ options: { selectors: { }, classNames: { }, urls: { sendDataTo: '/__rpc_fotki_imgs?func=update_photos', getAlbum: '/__rpc_fotki_imgs?func=get_photos' }, tmpl: { htmlImg: '{photo_title}', linkOpen: '', linkClose: '' } }, _selector: function(name) { return this.options.selectors[name]; }, _className: function(name) { return this.options.classNames[name]; } }; /** @lends $.fotki */ $.extend($.fotki, { /** * Generate array with html markup for photos. * * @param {Array.Object|Object} data photos data. Function uses only photo_id and photo_title fields. If * param is not an array, we assume, that we should render a single photo, and all data is in this object. * @param {string} size Desired size of the photos. The string comes as multiple attributes for img tag. * @param {Object=} If data is an array, then this parameter is used and required. Array contains urls * of images, keys are photo ids. */ makePhotosHTML: function(data, size, resizedUrls) { var resultHtml = [], photoData, photoTemplate = this.options.tmpl.htmlImg, index, length, html; /* single image */ if ( !data.length ) { data.size = size; photoData = photoTemplate.supplant(data); if (data.hasOwnProperty('photo_link') && data.photo_link !== '') { photoData = this.options.tmpl.linkOpen.supplant(data) + photoData + this.options.tmpl.linkClose; } resultHtml.push(photoData); return resultHtml; } for (index = 0, length = data.length; index < length; index++) { photoData = data[index] || {}; photoData.photo_src = resizedUrls[photoData.photo_id]; photoData.photo_title = photoData.photo_title || ''; photoData.size = size; html = photoTemplate.supplant(photoData); if (photoData.hasOwnProperty('photo_link') && photoData.photo_link !== '') { html = this.options.tmpl.linkOpen.supplant(photoData) + html + this.options.tmpl.linkClose; } resultHtml.push(html); } return resultHtml; }, /** * Updated generator of photos html * @param {Object[]} resizesData Photos data from server after resizing. * @param {Array} data Photos data. Contains src and title, * Notice: only title is needed * @param {Object} params Additional params from sizeSelect * @param {String} params.type Selected value in the sizeList, e.g. 300/custom/original * @param {String} params.attributes String with width and height attributes (for image tag), * e.g. "width='300' height='200'" * * @return {String[]} Array of html strings to insert */ photosHTML: function (resizesData, data, params) { var size = 'width="{width}" height="{height}"', insertOriginalLink = params.insertOriginalLink, imgTmpl = '{title}', imgWithLinkTmpl = '' + imgTmpl + ''; return data.map(function (photoData) { var id = photoData.photo_id, title = photoData.photo_title, data = resizesData[id] || {}, obj; obj = { id: id, title: title, // if user provided link - insert it, otherwise check params.insertOriginalLink // and insert original image url if needed: #LJSUP-15091 url: photoData.photo_link || (insertOriginalLink ? data.photo_orig : null), src: data.image_url, // if type is 'custom' we need to provide attributes from sizeList, // not from the server attributes: params.type === 'custom' ? params.attributes.trim() : size.supplant({width: data.width, height: data.height}) }; if (obj.url) { // add protocol to link if it hasn't been provided obj.url = LJ.String.linkify(obj.url); return imgWithLinkTmpl.supplant(obj); } else { return imgTmpl.supplant(obj); } return (obj.url ? imgWithLinkTmpl : imgTmpl).supplant(obj); }); }, /** * Get array of urls of photos with some size. This is a part of fotki API extracted from lj.photouploader. * All the API should be there in the future. * * @param {Array} photoData Array with photos data. The only used field is photo_id * @param {Function} callback Callback is fired, when data comes from the server. * @param {string='original'} size The desired size of images. */ getImgUrls: function(photoData, callback, size) { var request = { type: 'add', required_size: size || 'original' }; photoData = photoData || []; request.photos_data = photoData.map(function(el) { return { photo_id: el.photo_id}; }); $.ajax(this.options.urls.sendDataTo, { type: 'POST', data : { data_to_update: JSON.stringify(request) }, dataType: 'json', success: function(response) { var resizedUrls = response.result; if (resizedUrls) { callback(resizedUrls); } } }); }, /** * Get array of photos from specified album. * * @param {number} album_id Album id. * @param {Function} callback Callback is fired, when data comes from the server. * @param {number=} offset The offset to count the photos in the album. Default is 0. * @param {string='original'} size The desired size of images. * @param {number=} count The number of photos to retrieve. */ getAlbumContents: function(album_id, callback, offset, size, count) { var request = { album_id: parseInt(album_id, 10) || 0 }; if (arguments.length >= 3) { request.start = parseInt(offset, 10) || 0; } if (arguments.length >= 4) { request.required_size = size; } if (arguments.length >= 5) { request.count = parseInt(count, 10) || 0; } $.ajax(this.options.urls.getAlbum, { type: 'GET', data : request, dataType: 'json', success: callback }); } }); }(jQuery)); ; /* file-end: js/jquery/jquery.fotki.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/jquery/fotki/jquery.lj.sizeSelect.js */ ;(function($) { "use strict"; var ml = LJ.ml; $.widget( 'lj.sizeSelect', $.lj.basicWidget, { options: { render: true, //if flag is false then component tries to build markup by itself selectors: { sizeList: '.b-pics-size-list', customSizeList: '.b-pics-custom-options', customWidthField: '#image-width', customHeightField: '#image-height', backToDefaultSize: '.b-pics-back-to-default' }, classNames: { container: 'b-pics-side-options' }, tmpl: { header: '' + '' + '
' + '' + '' + '{fotki.album.default.sizes}' + '
' }, ml: { resize: 'fotki.album.custom.size' }, // predefined sizes from server sizeData: [], // current value value: 'original', // default value that will be set on reset defaultValue: 'original' }, _create: function() { var that = this; $.lj.basicWidget.prototype._create.call( this ); // list of available sizes this._sizes = []; // save predefined sizes this.options.sizesData.forEach(function ( sizeData ) { var size = sizeData.size.toString(); that._sizes.push( size ); if ( sizeData.is_default ) { that.options.defaultValue = size; } }); // add 'custom' size to the list of available sizes this._sizes.push('custom'); if (this.options.render) { this._createNodes(); } this.element.addClass( this._cl('container') ); this._el('customWidthField').labeledPlaceholder(); this._el('customHeightField').labeledPlaceholder(); this._bindControls(); this.reset(); }, _createNodes: function() { var that = this, tmpl = this.options.tmpl, sizeList = []; // header sizeList.push(tmpl.header); // list items sizeList.push( this.options.sizesData.map(function (sizeData) { return tmpl[sizeData.is_default ? 'selected' : 'common'].supplant(sizeData); }) ); // last, list item sizeList.push( tmpl.last.supplant({ text: this._ml('resize'), size: 'custom' }) ); // footer sizeList.push(tmpl.footer); this.element.html(sizeList.join(' ').supplant(Site.ml_text)); }, _bindControls: function() { $.lj.basicWidget.prototype._bindControls.call( this ); this.element.on('change', this._s('sizeList'), this._change.bind(this)); this.element.on('click', this._s('backToDefaultSize'), this._backFromCustom.bind(this)); }, /** * Reset widget state to default */ reset: function() { this._clearCustomFields(); this._setOption('value', 'default'); }, /** * Set currently selected value as default */ updateDefault: function () { this._setOption('defaultValue', this.options.value); }, /** * Currently selected value in the list */ selectedValue: function() { return this.options.value; }, /** * Width and heght attributes string * @return {String} String with width/height attributes for image, or empty string (if width/height is empty) */ attributes: function () { var width, height, result, value = this.options.value; if (value === 'custom') { width = $.trim( this._el('customWidthField').val() ); height = $.trim( this._el('customHeightField').val() ); result = width.length === 0 || isNaN(width) ? '' : ' width="' + width + '"'; result += height.length === 0 || isNaN(height) ? '' : ' height="' + height + '"'; } else { result = isNaN(value) ? '' : ' width="' + value + '"'; } return result; }, /** * Size list change handler * @param {Object} e jQuery event object */ _change: function (e) { this._setOption('value', $(e.target).val()); }, /** * Back to default size link click handler * @param {Object} e jQuery event object */ _backFromCustom: function (e) { e.preventDefault(); this._setOption('value', 'original'); }, /** * Reset custom width and height fields */ _clearCustomFields: function () { this._el('customWidthField').val(''); this._el('customHeightField').val(''); }, /** * Set value for the select box * @param {String} value Value to be selected */ _setValue: function (value) { if (value === 'custom') { this._el('sizeList').hide(); this._el('customSizeList').css('display', 'inline-block'); } else { this._el('sizeList').val(value); // hide custom fields, if custom has been set before if (this.options.value === 'custom') { this._el('customSizeList').hide(); this._el('sizeList').show(); } } this.options.value = value; }, _setOption: function (key, value) { if (value === undefined) { return; } switch (key) { case 'value': // support default if (value === 'default') { this._setValue(this.options.defaultValue); } else { // value should be a string value = value.toString(); this._setValue( this._sizes.indexOf( value ) === -1 ? 'original' : value); } break; case 'defaultValue': // value should be a string value = value.toString(); // Notice: defaultValue can't be set to custom. // If it's custom, it should be set to 'original' this.options.defaultValue = value === 'custom' || this._sizes.indexOf( value ) === -1 ? 'original' : value; break; } } }); }(jQuery)); ; /* file-end: js/jquery/fotki/jquery.lj.sizeSelect.js ----------------------------------------------------------------------------------*/ LJ.injectStyle('/* Reset\n----------------------------------------------- */\n.b-pics {\n font-family: \'Arial\', \'Helvetica\', sans-serif;\n }\n.b-pics TABLE {\n border-collapse: collapse;\n border-spacing: 0;\n }\n.b-pics UL,\n.b-pics OL,\n.b-pics LI {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n.b-pics IMG,\n.b-pics A IMG {\n border: 0;\n }\n.b-pics DL,\n.b-pics DT,\n.b-pics DD,\n.b-pics P {\n margin: 0;\n padding: 0;\n }\n.b-pics FORM,\n.b-pics FIELDSET {\n margin: 0;\n padding: 0;\n border: 0;\n }\n.b-pics A:link,\n.b-pics A:visited,\n.b-pics A:hover,\n.b-pics A:active {\n text-decoration: underline !important;\n }\n\n/* Elements\n----------------------------------------------- */\n.b-pics H1 {\n margin-bottom: 15px;\n }\n.b-pics H2 {\n padding: 0;\n margin: 0;\n font-size: 18px;\n color: #000;\n }\n.b-pics .b-pics-title {\n margin-bottom: 7px;\n }\n.b-pics H5,\n.b-pics P,\n.b-pics LABEL {\n line-height: 16px;\n font-size: 12px;\n }\n/* Form elements */\n.b-pics-input-text,\n.b-pics-textarea,\n.b-pics-input-submit,\n.b-pics-select {\n padding: 0;\n margin: 0;\n vertical-align: middle;\n font-family: \'Arial\', \'Helvetica\', sans-serif;\n font-size: 12px;\n outline: none;\n }\n.b-pics-btn {\n overflow: visible;\n padding-left: 5px;\n padding-right: 5px;\n vertical-align: middle;\n font-family: \'Arial\', \'Helvetica\', sans-serif;\n font-size: 12px;\n outline: none;\n }\n.b-pics-photo-counter,\n.b-pics-remove-control-photo,\n.b-pics-remove-control,\n#js .b-pics-btn-no-js {\n display: none;\n }\n#js .b-pics-remove-control,\n#js .b-pics-remove-control-photo {\n display: block;\n }\n#js .b-pics-photo-counter {\n display: inline;\n }\n.b-pics-input-text {\n width: 470px;\n padding: 1px 3px;\n font-size: 12px;\n }\n.placeholder-label {\n line-height: 16px;\n font-size: 12px;\n color: #AAA !important;\n }\n.b-pics-input-text::-webkit-input-placeholder,\n.b-pics-textarea::-webkit-input-placeholder {\n color: #AAA;\n }\n.b-pics-input-text:-moz-placeholder,\n.b-pics-textarea:-moz-placeholder {\n color: #AAA;\n }\n.b-pics-input-text-album-name {\n width: 128px;\n margin-right: -8px;\n }\n.b-pics-input-text-title {\n padding: 2px 3px;\n font-size: 16px;\n }\n.b-pics-textarea {\n width: 99%;\n height: 70px;\n padding: 3px;\n font-size: 12px;\n }\n.b-pics-select {\n width: 120px;\n }\n.b-pics-input-submit {\n padding: 2px 5px;\n }\n.b-pics-cancel {\n margin-left: 2px;\n }\n.b-pics-select-album .b-pics-select,\n.b-pics-select-album .b-pics-input-text {\n margin-top: -2px;\n }\n.b-pics-select-album {\n margin: 0 20px 0 0;\n }\n.b-pics-original {\n margin: 0 20px 0 0;\n }\n .b-popup-pics-paste .b-pics-original {\n display: none;\n }\n.b-pics-original,\n.b-pics-link-field {\n display: none;\n }\n.b-popup-pics-links .b-pics-original,\n.b-popup-pics-links .b-pics-link-field {\n display: block;\n display: inline-block;\n }\n\n/* Arrows for gallery */\n.i-gallery-arr,\n.i-gallery-arr-brdr-outer,\n.i-gallery-arr-brdr-inner,\n.i-gallery-arr-bg {\n position: absolute;\n width: 0;\n height: 0;\n font: 0/0 serif;\n }\n.i-gallery-arrb.i-gallery-arr,\n.i-gallery-arrbl.i-gallery-arr,\n.i-gallery-arrbr.i-gallery-arr {\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n border-top: 7px solid #7087B5;\n }\n.i-gallery-arrb .i-gallery-arr-brdr-outer,\n.i-gallery-arrbl .i-gallery-arr-brdr-outer,\n.i-gallery-arrbr .i-gallery-arr-brdr-outer {\n bottom: 4px;\n left: -7px;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n border-top: 7px solid #CCC;\n }\n.i-gallery-arrb .i-gallery-arr-bg,\n.i-gallery-arrbl .i-gallery-arr-bg,\n.i-gallery-arrbr .i-gallery-arr-bg {\n bottom: 2px;\n left: -7px;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n border-top: 7px solid #FFF;\n }\n.i-gallery-arrbl {\n bottom: -7px;\n left: 50%;\n margin-left: -7px;\n }\n/* Preloader */\n.b-pics-preloader .preloader {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n width: 11px;\n height: 3px;\n margin-left: -6px;\n background: url(/img/preloader-s.gif?ver=1) no-repeat;\n font-size: 0;\n }\n .b-pics-preloader .b-pics-preloader-inner {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n }\n .b-pics-preloader-visible INPUT,\n .b-pics-preloader-visible BUTTON,\n .b-pics-preloader-visible A,\n .b-pics-preloader-visible I {\n visibility: hidden;\n }\n .b-pics-preloader-visible I.preloader {\n visibility: visible;\n display: block;\n }\n .b-pics-preloader-visible .b-pics-cancel {\n color: #CCC;\n cursor: default;\n }\n/* Fade out */\n.b-pics-fadeout {\n position: absolute;\n top: 0;\n right: 0;\n width: 70px;\n height: 30px;\n background: url(/img/fadeout-big.png?ver=1) no-repeat;\n }\n/* Beta */\n.b-beta {\n position: relative;\n top: -0.8em;\n margin: 0 0 0 0.4em;\n vertical-align: baseline;\n font-weight: normal;\n font-size: 0.5em;\n font-style: italic;\n color: #999;\n }\n\n/* Catalogue wrapper\n----------------------------------------------- */\n.b-catalogue {\n padding: 0 0 20px;\n }\n .b-catalogue .b-catalogue-beta {\n padding: 0;\n margin: 0 0 0 3px;\n font-size: 12px;\n font-weight: normal;\n font-style: italic;\n color: #999;\n }\n\n/* Layout\n----------------------------------------------- */\n.l-content {\n width: 612px;\n }\n.l-content.l-content-nowidget {\n width: 940px;\n }\n.l-navigation {\n min-height: 20px;\n }\n .l-navigation:after {\n content: \".\";\n display: block;\n clear: both;\n visibility: hidden;\n line-height: 0;\n height: 0;\n }\n.l-sidebar {\n width: 300px;\n }\n.b-pics-section {\n float: left;\n line-height: 34px;\n vertical-align: middle;\n }\n.b-pics-side {\n float: right;\n line-height: 34px;\n vertical-align: middle;\n }\n\n/* Promo block\n----------------------------------------------- */\n.b-pics-promo {\n color: #FFF;\n }\n .b-pics-promo A:link,\n .b-pics-promo A:visited,\n .b-pics-promo A:hover,\n .b-pics-promo A:active {\n border: none;\n color: #FFF !important;\n }\n .b-pics-promo .l-content,\n .b-pics-promo .l-sidebar {\n min-height: 260px;\n background: #4E92C1;\n -webkit-border-radius: 10px;\n -moz-border-radius: 10px;\n border-radius: 10px;\n }\n .b-pics-promo .l-content {\n overflow: hidden;\n width: 230px;\n margin: 0 0 10px;\n padding: 30px 70px 30px 320px;\n background-image: url(/img/widget/pics/promo-bg.png?v=20029);\n background-repeat: no-repeat;\n }\n .b-pics-promo .l-sidebar {\n position: relative;\n width: 240px;\n padding: 30px;\n }\n .b-pics-promo .l-sidebar H2 {\n margin-bottom: 15px;\n }\n .b-pics-promo .l-sidebar UL LI {\n margin: 0 0 10px 20px;\n list-style: disc;\n line-height: 18px;\n font-size: 14px;\n }\n .b-pics-promo H2 {\n margin: 0 0 10px;\n line-height: 28px;\n font-size: 24px;\n font-weight: normal;\n font-style: normal;\n color: #FFF;\n }\n .b-pics-promo P {\n margin: 0 0 10px 0;\n padding: 0;\n line-height: 18px;\n font-size: 14px;\n color: #FFF;\n }\n .b-pics-promo .b-pics-promo-btn {\n width: 247px;\n height: 44px;\n padding: 20px 10px 0 10px;\n margin: 0 0 0 -5px;\n background: url(/img/btn-add-promo.png?v=13801) no-repeat;\n text-align: center;\n line-height: 20px;\n font-size: 18px;\n color: #FFF;\n }\n\n/* Breadcrumbs\n----------------------------------------------- */\n.b-pics-breadcrumbs {\n min-height: 20px;\n font-size: 12px;\n }\n .b-pics-breadcrumbs H2 {\n display: inline;\n font-size: 12px;\n color: #000;\n }\n .b-pics-breadcrumbs A {\n border: none !important;\n }\n\n/* Pager\n----------------------------------------------- */\n.b-pics-pager-wrapper {\n width: 100%;\n min-height: 20px;\n text-align: right;\n }\n.b-pics-pager {\n padding: 0;\n margin: 5px 0 0 0;\n font-size: 11px;\n line-height: 11px;\n }\n .b-pics-pager A {\n border: none !important;\n }\n .l-content .b-pics-pager {\n float: right;\n }\n .b-pics-pager I {\n font-style: normal;\n }\n .b-pics-pager-first,\n .b-pics-pager-last,\n .b-pics-pager-prev,\n .b-pics-pager-next {\n display: inline-block;\n width: 16px;\n height: 16px;\n padding: 0;\n vertical-align: -4px;\n background-image: url(/img/arrow-spotlight.gif?v=16423);\n background-repeat: no-repeat;\n font: 0/0 serif;\n cursor: pointer;\n }\n .b-pics-pager-first {\n margin: 0 5px 0 0;\n background-position: 0 -32px;\n }\n .b-pics-pager-last {\n margin: 0 0 0 5px;\n background-position: -16px -32px;\n }\n .b-pics-pager-prev {\n margin: 0 10px 0 0;\n background-position: 0 0;\n }\n .b-pics-pager-next {\n margin: 0 0 0 10px;\n background-position: -16px 0;\n }\n .b-pics-pager-disabled {\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=45)\";\n filter: alpha(opacity=45);\n -moz-opacity: 0.45;\n opacity: 0.45;\n cursor: default;\n }\n .b-popup-pics .b-pics-pager {\n float: none;\n display: inline-block;\n vertical-align: top;\n }\n\n/* Pics inner\n----------------------------------------------- */\n.b-pics-inner {\n position: relative;\n margin: 0 0 10px 0;\n padding: 5px;\n border: 1px solid #CCC;\n -webkit-border-radius: 7px;\n -moz-border-radius: 7px;\n border-radius: 7px;\n }\n .b-pics-inner .b-pics-album-img {\n min-height: 100px;\n margin: 10px 0 0 0;\n text-align: center;\n }\n .b-pics-inner .b-pics-album-img IMG {\n max-width: 600px;\n }\n .b-pics-inner .b-pics-album-img A {\n border: none;\n }\n\n/* Navigation\n----------------------------------------------- */\n\n.b-pics-add-selected-options .b-pics-size-select {\n display: block;\n margin: 0.75em 0;\n } \n.b-pics .b-pics-nav {\n margin-bottom: 10px;\n }\n.b-pics-nav:after {\n content: \".\";\n display: block;\n clear: both;\n visibility: hidden;\n line-height: 0;\n height: 0;\n }\n.b-pics-nav LI {\n position: relative;\n float: left;\n padding: 0 0 0 7px;\n margin: 0 0 0 7px;\n border-left: 1px solid #A5A5A5;\n white-space: nowrap;\n line-height: 16px;\n font-size: 12px;\n }\n.b-pics-nav LI.first {\n padding-left: 0;\n margin-left: 0;\n border: none;\n }\n.b-pics-nav LI.b-pics-side {\n float: right;\n }\n .b-pics-nav LI A {\n border: none;\n text-decoration: underline;\n }\n .b-pics-nav LI .cover-name {\n display: none;\n color: #7F7F7F;\n }\n .b-pics-nav LI.cover A {\n display: none;\n }\n .b-pics-nav LI.cover .cover-name {\n display: inline-block;\n }\n.b-pics-nav LI.last {\n border: none;\n }\n\n/* Bar\n----------------------------------------------- */\n.b-pics-bar {\n position: relative;\n height: 1.8em;\n margin: 0;\n padding: 7px 10px;\n border: 1px solid #E6E6E6;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n background: #F6F6F6;\n font-size: 12px;\n }\n.b-pics-bar:after {\n content: \".\";\n display: block;\n clear: both;\n visibility: hidden;\n line-height: 0;\n height: 0;\n }\n .b-pics-bar .b-pics-title {\n white-space: nowrap;\n margin-bottom: 0;\n }\n.b-pics-bar-footer {\n height: auto;\n margin: 10px 0 0 0;\n background: #FFF;\n }\n.b-pics-bar .b-pics-nav {\n position: relative;\n top: 3px;\n margin-bottom: 0;\n }\n\n/* Pics list albums\n----------------------------------------------- */\n.b-pics .b-pics-list-albums {\n padding: 0 20px;\n margin: 0 0 20px -33px;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item {\n position: relative;\n display: inline-block;\n width: 110px;\n margin: 23px 0 0 35px;\n vertical-align: top;\n text-align: center;\n }\n .b-pics-list-album LI.b-pics-list-albums-item {\n border: 1px solid #CCC;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item A {\n text-decoration: none !important;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item .b-pics-list-albums-img {\n position: relative;\n display: block;\n width: 100px;\n height: 100px;\n padding: 4px;\n margin-bottom: 8px;\n background: #FFF;\n border: 1px solid #CCC;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n text-align: center;\n }\n .b-pics-list-album LI.b-pics-list-albums-item .b-pics-list-albums-img {\n margin: 16px;\n padding: 0;\n border: 0;\n }\n .b-pics-list-albums-item .b-pics-list-albums-nopreview {\n display: table-cell;\n width: 100px;\n height: 100px;\n vertical-align: middle;\n }\n .b-pics-list-albums-item .b-pics-list-albums-nopreview I {\n font-style: normal;\n color: #aaa;\n }\n .b-pics-nav.b-pics-button-disabled A,\n .b-pics-control-disabled {\n cursor: default;\n color: #CCC !important;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item .b-pics-list-albums-img:before {\n position: absolute;\n top: 1px;\n right: -3px;\n display: block;\n width: 100px;\n height: 100px;\n padding: 4px;\n background: #FFF;\n border: 1px solid #CCC;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n text-align: center;\n content: \" \";\n z-index: -10;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item .b-pics-list-albums-img:after {\n position: absolute;\n top: 3px;\n right: -5px;\n display: block;\n width: 100px;\n height: 100px;\n padding: 4px;\n background: #FFF;\n border: 1px solid #CCC;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n text-align: center;\n content: \" \";\n z-index: -20;\n }\n .b-pics-list-albums LI.b-pics-list-albums-cover .b-pics-list-albums-img {\n padding: 4px;\n margin-bottom: 8px;\n }\n .b-pics-list-albums-selection {\n position: absolute;\n left: 65px;\n bottom: 2px;\n z-index: 2;\n margin: 0 0 0 -5px;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item .b-pics-list-albums-img IMG {\n max-width: 100px;\n max-height: 100px;\n vertical-align: top;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item H3 {\n max-height: 50px;\n overflow: hidden;\n font-style: normal;\n font-size: 14px;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item H3 A {\n border: none;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item P {\n padding: 0;\n margin: 0;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item-none {\n height: 131px;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item-none A {\n display: block;\n width: 109px;\n height: 109px;\n margin: 10px;\n cursor: pointer;\n border: 1px solid #CCC;\n background: url(/img/pics/upload-images.png?v=20510) 50% 20% no-repeat;\n }\n .b-pics-list-albums LI.b-pics-list-albums-item-none A SPAN {\n display: inline-block;\n position: relative;\n top: 65px;\n padding: 0 10px;\n font-size: 11px;\n font-weight: normal;\n text-align: center;\n color: #CCC;\n }\n\n/* Pics list album\n----------------------------------------------- */\n.b-pics-list-album LI.b-pics-list-albums-item .b-pics-list-albums-img:before,\n.b-pics-list-album LI.b-pics-list-albums-item .b-pics-list-albums-img:after {\n display: none;\n content: \"\";\n }\n.b-pics .b-pics-list-album {\n padding: 0;\n margin: 15px 0;\n }\n .b-pics-list-album LI.b-pics-list-albums-item {\n width: 131px;\n margin: 7px;\n }\n/*.b-pics-list-album LI.b-pics-list-albums-item .b-pics-list-albums-img {\n padding: 16px;\n }\n*/\n\n/* Widget pics friends update\n----------------------------------------------- */\n.w-pics-friends-upd {\n padding: 15px;\n margin-bottom: 15px;\n background: #F6F6F6;\n border: 1px solid #E6E6E6;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n .w-pics-friends-upd H2 {\n padding: 0;\n margin: 0 0 7px 0;\n font-weight: bold;\n font-size: 14px;\n color: #000;\n }\n .w-pics-friends-upd-list {\n overflow: hidden;\n }\n .w-pics-friends-upd-list LI {\n padding: 8px 0;\n margin: 1px 0 -1px 0;\n border-bottom: 1px solid #E6E6E6;\n line-height: 16px;\n font-size: 12px;\n }\n .w-pics-friends-upd-list LI P {\n margin: 0;\n padding: 0;\n }\n .w-pics-friends-upd-list LI .time-upd {\n padding-top: 2px;\n font-size: 11px;\n color: #999;\n }\n\n/* Widget pics list albums\n----------------------------------------------- */\n.b-pics .w-pics-list-albums {\n position: relative;\n padding: 15px;\n margin-bottom: 15px;\n border: 1px solid #E6E6E6;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n background: #F6F6F6;\n font-size: 12px;\n z-index: 0;\n }\n .b-pics .w-pics-list-albums .pager {\n position: absolute;\n top: -25px;\n right: 0;\n margin: 0;\n }\n .w-pics-list-albums H2 {\n padding: 0;\n margin: 0 0 15px 0;\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n color: #000;\n }\n .w-pics-list-albums .manage {\n float: right;\n padding: 0;\n margin: 0;\n }\n .w-pics-list-albums .b-pics-list-albums {\n padding: 0;\n margin: 0;\n }\n .w-pics-list-albums .b-pics-list-albums LI.b-pics-list-albums-item {\n display: block;\n width: auto;\n overflow: hidden;\n margin: 0 0 10px 0;\n text-align: left;\n }\n .w-pics-list-albums .b-pics-list-albums LI.b-pics-list-albums-item H3 {\n margin-bottom: 5px;\n }\n .w-pics-list-albums .b-pics-list-albums LI.b-pics-list-albums-item H3 A {\n border: none;\n }\n .w-pics-list-albums .b-pics-list-albums LI.b-pics-list-albums-item .b-pics-list-albums-img {\n float: left;\n margin-right: 15px;\n }\n\n/* Widget pics list photos\n----------------------------------------------- */\n.b-pics .w-pics-list-photos {\n position: relative;\n padding: 15px 20px;\n margin: 0 0 15px 0;\n border: 1px solid #E6E6E6;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n background: #F6F6F6;\n font-size: 12px;\n z-index: 0;\n }\n .b-pics .w-pics-list-photos .pager {\n position: absolute;\n top: -27px;\n right: 0;\n }\n .w-pics-list-photos H2 {\n margin-bottom: 20px;\n }\n .w-pics-list-photos H2 A {\n border: none;\n }\n .w-pics-list-photos .b-pics-list-photos {\n overflow: hidden;\n }\n .w-pics-list-photos LI.b-pics-list-photos-item {\n float: left;\n display: inline;\n width: 100px;\n height: 100px;\n margin: 0 14px 20px;\n }\n .w-pics-list-photos LI.b-pics-list-photos-item .b-pics-list-photos-img IMG {\n max-width: 100px;\n max-height: 100px;\n vertical-align: top;\n }\n\n/* Widget pics storage\n----------------------------------------------- */\n.w-pics-storage {\n padding: 15px;\n background: #F6F6F6;\n border: 1px solid #E6E6E6;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n .w-pics-storage H2 {\n padding: 0;\n margin: 0 0 20px 0;\n font-weight: bold;\n font-size: 14px;\n color: #000;\n }\n .w-pics-storage H3 {\n padding: 10px 0 0 0;\n margin: 0;\n font-style: normal;\n font-weight: bold;\n font-size: 18px;\n color: #999;\n }\n .w-pics-storage H4 {\n padding: 0;\n margin: 0;\n font-weight: bold;\n font-size: 22px;\n }\n .w-pics-storage P {\n clear: both;\n margin-top: 8px;\n }\n .w-pics-storage P A {\n border: none;\n }\n .w-pics-storage .w-pics-storage-pic {\n float: left;\n margin: 0 5px 15px 0;\n }\n\n/* Widget pics beta\n----------------------------------------------- */\n.w-pics-beta {\n min-height: 160px;\n padding: 30px 40px 205px 40px;\n margin: 0;\n background: #F6F6F6 url(/img/ljpics-beta.jpg?ver=1) no-repeat 0 100%;\n border: 1px solid #E6E6E6;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n }\n .w-pics-beta H2 {\n padding: 0;\n margin: 0 0 15px 0;\n line-height: 30px;\n font-size: 22px;\n color: #000;\n }\n .w-pics-beta P {\n margin-bottom: 10px;\n line-height: 18px;\n font-size: 14px;\n color: #000;\n }\n .w-pics-beta .w-pics-beta-list {\n \n }\n .w-pics-beta .w-pics-beta-list LI {\n margin-bottom: 2px;\n line-height: 18px;\n font-size: 14px;\n color: #000;\n }\n\n/* Popups\n----------------------------------------------- */\n.b-popup {\n text-align: left;\n font-family: \'Arial\', sans-serif;\n }\n .b-popup:after {\n content: \" \";\n display: block;\n height: 0;\n line-height: 0;\n clear: both;\n visibility: hidden;\n }\n .b-popup A:link,\n .b-popup A:visited,\n .b-popup A:hover,\n .b-popup A:active {\n border: none;\n text-decoration: underline;\n }\n.b-popup-pics {\n top: 0;\n left: 0;\n margin: auto 50%;\n z-index: 3999;\n }\n.b-pics-album .b-popup-pics {\n top: -1px;\n left: -1px;\n }\n .b-popup-pics .b-popup-outer {\n background: #F6F6F6;\n }\n .b-popup-pics .b-popup-inner {\n padding: 10px;\n border: none;\n -webkit-border-radius: 0;\n -moz-border-radius: 0;\n border-radius: 0;\n background: #F6F6F6;\n }\n .b-popup-pic .b-popup-outer,\n .b-popup-pic .b-popup-inner {\n background: #000;\n border: none;\n -webkit-border-radius: 0;\n -moz-border-radius: 0;\n border-radius: 0;\n }\n .b-popup-pic .b-popup-inner {\n position: relative;\n padding: 40px;\n }\n .b-popup-pics .b-popup-noclosecontrol .b-popup-outer,\n .b-popup-pics .b-popup-noclosecontrol .b-popup-inner {\n background: #FFF;\n }\n .b-popup-pics H2 { \n display: inline-block;\n padding-right: 5px;\n margin-right: 30px;\n margin-bottom: 15px;\n line-height: 16px;\n font-size: 14px;\n font-weight: bold;\n color: #000;\n }\n .b-popup-pics .i-popup-close {\n background-image: url(/img/popup-cls.png?v=13801);\n }\n .b-popup-pic .i-popup-close {\n width: 13px;\n height: 15px;\n background-image: url(/img/popup-cls-big.png?v=13801);\n }\n .b-popup-pics-gallery-list {\n top: 2px;\n right: 2px;\n }\n /* Arrows */\n .b-popup-pics .b-pics-arrows {\n position: fixed;\n top: 50%;\n width: 69px;\n height: 93px;\n margin-top: -46px;\n background: #000 url(/img/popup-arr-nav.png?v=13801) no-repeat 0 50%;\n cursor: pointer;\n opacity: 0.6;\n }\n .b-popup-pics .b-pics-arr-next {\n right: 0;\n background-position: -198px 50%;\n -webkit-border-top-left-radius: 5px;\n -webkit-border-bottom-left-radius: 5px;\n -moz-border-radius-topleft: 5px;\n -moz-border-radius-bottomleft: 5px;\n border-top-left-radius: 5px;\n border-bottom-left-radius: 5px;\n }\n .b-popup-pics .b-pics-arr-prev {\n left: 0;\n background-position: 22px 50%;\n -webkit-border-top-right-radius: 5px;\n -webkit-border-bottom-right-radius: 5px;\n -moz-border-radius-topright: 5px;\n -moz-border-radius-bottomright: 5px;\n border-top-right-radius: 5px;\n border-bottom-right-radius: 5px;\n }\n .b-popup-pics .b-pics-arr-next:hover,\n .b-popup-pics .b-pics-arr-prev:hover {\n -webkit-transition: opacity 0.2s ease-in;\n -moz-transition: opacity 0.2s ease-in;\n -o-transition: opacity 0.2s ease-in;\n transition: opacity 0.2s ease-in;\n opacity: 1;\n }\n .b-popup-pics .b-pics-arr-disabled,\n .b-popup-pics .b-pics-arr-disabled:hover {\n -webkit-transition: 0;\n -moz-transition: 0;\n -o-transition: 0;\n transition: 0;\n cursor: default;\n }\n /* Remove popup */\n .b-pics-remove-content {\n max-width: 300px;\n text-align: left;\n }\n .b-pics-remove-content H5,\n .b-pics-add-content H5 {\n padding: 0;\n margin: 0 0 10px 0;\n font-weight: bold;\n font-size: 14px;\n color: #000;\n }\n .b-pics-remove-content .b-pics-submit-options {\n padding-top: 5px !important;\n border: none;\n }\n /* Bubble */\n .b-popup-pics .i-bubble {\n padding: 4px 10px;\n font-size: 10px;\n }\n.b-popup-pics-add-img-size {\n margin-bottom: 10px;\n }\n\n/* Privacy\n----------------------------------------------- */\n.b-pics-privacy {\n height: 16px;\n text-align: right;\n }\n.b-popup-pics .b-pics-privacy {\n display: inline-block;\n margin: 0 2px 0 3px;\n }\n .b-pics-privacy .b-pics-privacy-icon {\n display: block;\n width: 19px;\n height: 15px;\n margin: 3px 0 0;\n background: url(/img/widget/pics/settings.gif?v=21472) no-repeat 2px 0;\n vertical-align: top;\n font-size: 0;\n cursor: pointer;\n }\n .b-pics-privacy .b-pics-privacy-icon-lock {\n cursor: default;\n background-position: 2px -61px;\n }\n .b-pics-privacy .b-pics-privacy-icon-fr {\n background-position: 2px -16px;\n }\n .b-pics-privacy .b-pics-privacy-icon-pr {\n height: 11px;\n margin-top: 2px;\n background-position: 0 -32px;\n }\n .b-pics-privacy .b-pics-privacy-icon-gr {\n height: 16px;\n background-position: 0 -44px;\n }\n .b-pics-privacy .b-popup .b-popup-inner {\n padding: 10px 15px;\n border: 2px solid #E7E7E7;\n -webkit-border-radius: 7px;\n -moz-border-radius: 7px;\n border-radius: 7px;\n }\n .b-pics-privacy-inner {\n padding-left: 5px;\n text-align: left;\n }\n .b-pics-privacy-inner H5 {\n padding: 0;\n margin: 0 0 10px 0;\n font-weight: bold;\n font-size: 12px;\n color: #000;\n }\n .b-pics-privacy-inner UL {\n padding: 0;\n margin: 0;\n }\n .b-pics-privacy-inner UL LI {\n margin: 0 0 1px -5px;\n padding: 2px 5px;\n -webkit-border-radius: 3px;\n -moz-border-radius: 3px;\n border-radius: 3px;\n white-space: nowrap;\n list-style: none;\n font-size: 10px;\n color: #000;\n cursor: pointer;\n }\n .b-pics-privacy-inner UL LI.active,\n .b-pics-privacy-inner UL LI:hover {\n background: #C5E1F7;\n }\n\n/* Copy link */\n\n.b-pics-copy-link-inner H5 {\n margin: 0;\n font-size: 14px;\n }\n .b-pics-copy-link-icon {\n display: block;\n width: 16px;\n height: 16px;\n cursor: pointer;\n background: url(/img/widget/pics/copy-link.png?ver=1) 0 0 no-repeat;\n }\n.b-pics-copy-link-inner .b-pics-size-options-inner {\n float: left;\n padding: 2px 5px 0 0;\n }\n .b-pics-copy-link-inner .b-pics-custom-options {\n display: none;\n float: left;\n }\n.b-pics-copy-url,\n.b-pics-copy-link-inner .b-pics-size-options {\n margin-top: 10px;\n }\n.b-pics-copy-link-inner .b-pics-size-options {\n min-height: 28px;\n }\n .b-pics-copy-url LABEL {\n display: block;\n margin: 6px 0 0 0;\n }\n .b-pics-copy-url LABEL INPUT {\n width: 400px;\n }\n\n/* Submit options\n----------------------------------------------- */\n.b-pics-submit-options,\n.b-pics-summary {\n clear: both;\n min-height: 22px;\n overflow: hidden;\n padding: 10px 0 3px 0 !important;\n margin: 0 !important;\n border-top: 1px solid #BABABA;\n }\n .b-pics-summary LI {\n float: left;\n padding: 0 7px;\n border-left: 1px solid #B2B2B2;\n list-style: none;\n line-height: 16px;\n font-size: 12px;\n }\n .b-pics-summary LI.first {\n padding-left: 0;\n border: none;\n }\n.b-pics-submit-options-norule {\n border: none;\n }\n.b-pics-submit-options .b-pics-nav {\n margin-bottom: 0;\n }\n\n/* Edit fields\n----------------------------------------------- */\n.b-popup-pics-edit-fields {\n padding: 0;\n margin: 0;\n }\n .b-popup-pics-edit-fields LI {\n overflow: hidden;\n padding: 3px;\n margin: 0 -3px;\n list-style: none;\n }\n\n/* Gallery\n----------------------------------------------- */\n.b-pics-data-form {\n zoom: 1;\n }\n.b-popup-pics .b-popup-pics-gallery {\n position: relative;\n overflow: auto;\n overflow-x: hidden;\n padding: 3px 9px 6px;\n margin: 18px -9px;\n background-color: #FFF;\n }\n.b-popup-pics .b-pics-state-begin .b-popup-pics-gallery,\n.b-popup-pics .b-pics-state-processing .b-popup-pics-gallery {\n margin: 9px 0;\n padding: 0;\n background-color: transparent;\n }\n.b-popup-pics .b-popup-pics-add-several.b-pics-state-processing .b-popup-pics-gallery {\n padding: 3px 9px 6px;\n margin: 18px -9px;\n }\n .click-upload {\n float: left;\n margin-bottom: 5px;\n }\n .click-upload.b-btn {\n position: relative;\n width: 141px;\n height: 33px;\n padding: 1px;\n }\n .click-upload.b-btn SPAN,\n .click-upload .b-pics-processing-spinner {\n position: absolute;\n top: 8px;\n width: 100%;\n text-align: center;\n color: #FFF !important;\n }\n .click-upload .b-pics-processing-spinner {\n top: 5px;\n }\n .click-upload.b-btn OBJECT {\n position: relative;\n }\n \n .b-popup-pics .b-popup-pics-gallery .click-upload {\n position: relative;\n float: left;\n width: 106px;\n height: 106px;\n padding: 4px;\n margin-right: 9px;\n background: #FFF;\n border: 1px solid #CCC;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n z-index: 1;\n }\n .b-popup-pics .b-popup-pics-gallery .click-upload A {\n display: block;\n width: 104px;\n height: 104px;\n border: 1px solid #CCC;\n background: url(/img/preloader-s.gif?ver=1) no-repeat center;\n }\n .b-popup-pics .b-popup-pics-gallery-list {\n padding: 0;\n margin: 0 -9px;\n }\n .b-popup-pics .b-popup-pics-gallery-list LI {\n position: relative;\n float: left;\n padding: 16px;\n margin: 7px 9px;\n background: #FFF;\n border: 1px solid #CCC;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n list-style: none;\n cursor: move;\n }\n .b-popup-pics .b-popup-pics-add-one .b-popup-pics-gallery-list LI {\n float: none;\n }\n .b-popup-pics .b-popup-pics-add-one .b-popup-pics-gallery-list LI IMG {\n text-align: center;\n margin: 0 auto;\n }\n .b-popup-pics .b-popup-pics-add-one .b-popup-pics-gallery-list .b-popup-pics-inserted {\n padding: 0;\n border: none;\n }\n .b-popup-pics .b-popup-pics-add-one .b-popup-pics-gallery-list .b-popup-pics-inserted .i-thumb-close,\n .b-popup-pics .b-popup-pics-add-one .b-popup-pics-gallery-list .b-popup-pics-inserted .b-pics-list-albums-selection {\n display: none;\n }\n .b-popup-pics .b-popup-pics-gallery-list LI IMG {\n position: relative;\n display: block;\n width: 100px;\n height: 100px;\n padding: 0;\n margin: 0;\n border: none;\n vertical-align: top;\n cursor: default;\n }\n .b-popup-pics .b-popup-pics-gallery-list LI .i-gallery-arr {\n display: none;\n }\n .b-popup-pics .b-popup-pics-gallery-list .i-thumb-close {\n top: 3px;\n right: 2px;\n cursor: pointer;\n }\n .b-popup-pics .b-popup-pics-gallery-list LI.selected {\n background: #E7E7E7;\n }\n .b-popup-pics .b-popup-pics-gallery-list LI.selected .i-gallery-arr {\n display: block;\n }\n\n/* Upload\n----------------------------------------------- */\n\n.b-popup-pics-upload .b-pics-header-select-album,\n.b-popup-pics-upload .b-popup-pics-add-header,\n.b-popup-pics-add .b-popup-pics-list-header,\n.b-popup-pics-upload .pics-item-list {\n display: none;\n }\n.b-popup-pics .b-popup-pics-upload {\n width: 790px;\n }\n.b-popup-pics .b-popup-pics-upload:after {\n content: \".\";\n display: block;\n clear: both;\n visibility: hidden;\n line-height: 0;\n height: 0;\n }\n .b-popup-pics .b-popup-pics-upload .i-bubble {\n margin: 6px 15px !important;\n font-size: 12px\n }\n .b-popup-pics .b-popup-pics-upload-error .i-bubble {\n margin: 15px 0 !important;\n }\n.b-pics-upload-wrapper {\n overflow:hidden;\n }\n.b-popup-pics .b-pics-upload {\n margin-bottom: 12px;\n padding: 0 0 0 17px;\n overflow: hidden;\n font-size: 12px;\n }\n .b-popup-pics .b-pics-upload .b-pics-upload-total {\n float: left;\n margin-top: 6px;\n margin-bottom: 7px;\n }\n .b-popup-pics .b-pics-upload .b-pics-upload-filename {\n float: right;\n margin-top: 6px;\n margin-bottom: 7px;\n color: #999;\n }\n .b-popup-pics .b-pics-upload .b-pics-upload-progress-bar {\n clear: both;\n overflow: hidden;\n height: 5px;\n background: #E9F3FF;\n background: -moz-linear-gradient(top, #E9F3FF 0%, #FFFFFF 25%, #BEDCFF 50%, #B3D3F8 75%, #B9D8FD 100%);\n background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#E9F3FF), color-stop(25%,#FFFFFF), color-stop(50%,#BEDCFF), color-stop(75%,#B3D3F8), color-stop(100%,#B9D8FD));\n background: -webkit-linear-gradient(top, #E9F3FF 0%,#FFFFFF 25%,#BEDCFF 50%,#B3D3F8 75%,#B9D8FD 100%);\n background: -o-linear-gradient(top, #E9F3FF 0%,#FFFFFF 25%,#BEDCFF 50%,#B3D3F8 75%,#B9D8FD 100%);\n background: -ms-linear-gradient(top, #E9F3FF 0%,#FFFFFF 25%,#BEDCFF 50%,#B3D3F8 75%,#B9D8FD 100%);\n filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#E9F3FF\', endColorstr=\'#B9D8FD\',GradientType=0 );\n background: linear-gradient(top, #E9F3FF 0%,#FFFFFF 25%,#BEDCFF 50%,#B3D3F8 75%,#B9D8FD 100%);\n border-top: 1px solid #A6C5EA;\n border-left: 1px solid #A2C1E6;\n border-right: 1px solid #A2C1E6;\n border-bottom: 1px solid #A8C8ED;\n -webkit-border-radius: 3px;\n -moz-border-radius: 3px;\n border-radius: 3px;\n font-size: 0;\n }\n .b-popup-pics .b-pics-upload .b-pics-upload-progress-bar-inner {\n height: 5px;\n margin: -1px;\n background: #D1E6FF;\n background: -moz-linear-gradient(top, #D1E6FF 0%, #FFFFFF 25%, #7DB8FF 50%, #65A4EE 75%, #74B3FD 100%);\n background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#D1E6FF), color-stop(25%,#FFFFFF), color-stop(50%,#7DB8FF), color-stop(75%,#65A4EE), color-stop(100%,#74B3FD));\n background: -webkit-linear-gradient(top, #D1E6FF 0%,#FFFFFF 25%,#7DB8FF 50%,#65A4EE 75%,#74B3FD 100%);\n background: -o-linear-gradient(top, #D1E6FF 0%,#FFFFFF 25%,#7DB8FF 50%,#65A4EE 75%,#74B3FD 100%);\n background: -ms-linear-gradient(top, #D1E6FF 0%,#FFFFFF 25%,#7DB8FF 50%,#65A4EE 75%,#74B3FD 100%);\n filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#D1E6FF\', endColorstr=\'#74B3FD\',GradientType=0 );\n background: linear-gradient(top, #D1E6FF 0%,#FFFFFF 25%,#7DB8FF 50%,#65A4EE 75%,#74B3FD 100%);\n border-top: 1px solid #4B8AD4;\n border-left: 1px solid #4483CD;\n border-bottom: 1px solid #508FD9;\n -webkit-border-top-left-radius: 3px;\n -webkit-border-bottom-left-radius: 3px;\n -moz-border-radius-topleft: 3px;\n -moz-border-radius-bottomleft: 3px;\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n font-size: 0;\n }\n .b-popup-pics .b-pics-upload .b-pics-upload-progress-bar-full {\n border-right: 1px solid #4483CD;\n -webkit-border-top-right-radius: 3px;\n -webkit-border-bottom-right-radius: 3px;\n -moz-border-radius-topright: 3px;\n -moz-border-radius-bottomright: 3px;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n }\n/* Begin upload */\n.b-popup-pics-add .b-pics-upload-wrapper .i-bubble,\n.b-popup-pics-upload .b-pics-submit-options .i-bubble,\n.b-pics-state-begin .b-pics-upload,\n.b-pics-state-begin .b-pics-pager,\n.b-pics-state-begin .b-popup-pics-edit-fields,\n.b-pics-state-begin .b-popup-pics-gallery-list,\n.b-pics-state-begin .b-bubble-alert,\n.b-pics-state-begin .b-pics-processing-spinner,\n.b-pics-state-begin .b-pics-submit-options {\n display: none;\n }\n/* Processing upload */\n.b-pics-state-processing .i-bubble,\n.b-pics-state-processing .b-pics-pager,\n.b-pics-state-processing .b-popup-pics-edit-fields,\n.b-pics-state-processing .b-pics-submit-options,\n.b-pics-state-processing .b-pics-btn-upload {\n display: none;\n }\n.b-pics-state-processing .b-pics-processing-spinner {\n display: block;\n }\n/* End upload */\n.b-pics-state-end .b-pics-upload,\n.b-pics-state-end .b-pics-summary,\n.b-pics-state-end .b-pics-paste-button,\n.b-pics-state-end .b-pics-size-list,\n.b-pics-state-end .b-pics-processing-spinner {\n display: none;\n }\n/* Output (update.bml) */\n.b-pics-with-output .b-pics-save-button,\n.b-pics-without-output .b-pics-post-button {\n display: none;\n }\n.b-pics-with-output .b-pics-post-button,\n.b-pics-without-output .b-pics-save-button {\n display: block;\n }\n.b-popup-pics .b-popup-pics-add.b-popup-pics-add-many .b-pics-submit-options .i-bubble,\n.b-pics-with-output .b-pics-size-list,\n.b-pics-with-output .b-pics-size-label,\n.b-pics-with-output .b-pics-post-button {\n display: inline-block;\n vertical-align: middle;\n }\n.b-popup-pics .b-pics-size-label {\n margin: 0 6px 0 0;\n }\n/* Add\n----------------------------------------------- */\n.b-popup-pics-add .b-popup-pics-upload-header,\n.b-popup-pics-add .b-popup-pics-list-header,\n.b-popup-pics-add .b-popup-pics-paste-header,\n.b-popup-pics-add .i-thumb-close,\n.b-popup-pics-list .i-thumb-close {\n display: none;\n }\n\n.b-popup-pics .b-popup-pics-add .click-upload,\n.b-popup-pics .b-popup-pics-add .pager,\n.b-popup-pics .b-popup-pics-add .b-pics-upload,\n.b-popup-pics .b-popup-pics-add .b-pics-summary,\n.b-popup-pics .b-popup-pics-add .b-popup-pics-edit-fields,\n.b-popup-pics .b-popup-pics-add .b-pics-select-album,\n.b-popup-pics .b-popup-pics-add .b-popup-pics-gallery-list LI.selected .i-gallery-arr,\n.b-popup-pics .b-popup-pics-add .b-pics-submit-options-norule,\n.b-popup-pics .b-popup-pics-add .b-pics-save-button,\n.b-popup-pics .b-popup-pics-add .b-bubble-alert,\n.b-popup-pics .b-popup-pics-add .b-pics-privacy {\n display: none;\n }\n.b-popup-pics .b-popup-pics-add .b-popup-pics-gallery-list {\n position: relative;\n top: 0;\n left: 0;\n height: auto;\n }\n.b-popup-pics .b-popup-pics-add .b-popup-pics-gallery-list LI A {\n position: relative;\n display: block;\n text-decoration: none;\n }\n.b-popup-pics .b-popup-pics-add .b-popup-pics-gallery-list LI .remove {\n display: none;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: #000;\n background: rgba(0, 0, 0, 0.7);\n text-align: center;\n font-size: 11px;\n color: #FFF;\n }\n .b-popup-pics .b-popup-pics-list .b-popup-pics-gallery-list:after {\n content: \" \";\n display: block;\n clear: both;\n visibility: hidden;\n line-height: 0;\n height: 0;\n }\n.b-popup-pics .b-popup-pics-add .b-popup-pics-gallery {\n margin: 0 -9px;\n }\n.b-popup-pics .b-popup-pics-add .b-popup-pics-gallery-list LI:hover .remove {\n display: block;\n }\n .b-popup-pics .b-popup-pics-add .b-popup-pics-gallery-list LI .remove SPAN {\n position: absolute;\n top: 45%;\n left: 0;\n width: 100%;\n font-weight: normal;\n }\n .b-popup-pics .b-popup-pics-add .b-popup-pics-gallery-list LI .remove SPAN I {\n display: inline-block;\n width: 12px;\n height: 12px;\n margin-right: 5px;\n background: url(/img/popup-cls.png?ver=1) no-repeat;\n vertical-align: top;\n }\n/* Add one */\n.b-popup-pics .b-popup-pics-add-one .b-popup-pics-gallery-list {\n width: auto;\n min-width: 300px;\n }\n .b-popup-pics .b-popup-pics-add-one .b-popup-pics-gallery-list LI:hover .remove {\n cursor: default;\n display: none;\n }\n .b-popup-pics .b-popup-pics-add-one .b-popup-pics-gallery-list IMG {\n width: auto;\n height: auto;\n }\n/* Add several */\n.b-popup-pics .b-popup-pics-add-several .b-popup-pics-gallery {\n min-width: 745px;\n max-height: 310px;\n }\n .b-popup-pics .b-popup-pics-add-several .b-popup-pics-gallery-list {\n width: auto;\n }\n/* Add many */\n.b-popup-pics .b-popup-pics-add-many .b-popup-pics-gallery {\n min-width: 757px;\n max-height: 444px;\n }\n/* Add selected */\n.b-popup-pics-list {\n width: 770px;\n }\n.b-popup-pics .b-popup-pics-list .b-popup-pics-gallery {\n max-height: 500px;\n }\n.b-popup-pics-list .b-pics-upload-wrapper,\n.b-popup-pics-list .b-pics-paste-url,\n.b-popup-pics-list .b-popup-pics-add-header,\n.b-popup-pics-list .b-pics-summary,\n.b-popup-pics-list .b-popup-pics-edit-fields,\n.b-popup-pics-list .b-pics-submit-options.b-pics-submit-options-norule,\n.b-popup-pics-list .b-pics-select-album,\n.b-popup-pics-list .b-pics-privacy-icon,\n.b-popup-pics-list .pics-item-upload {\n display: none;\n }\n.b-popup-pics-list .b-pics-submit-options {\n display: block;\n }\n.b-pics-add-selected-custom-options,\n.b-pics-add-selected-default-options {\n margin-bottom: 8px;\n }\n.b-pics-add-selected-options .b-pics-add-selected-custom-options {\n display: none;\n }\n.b-pics-size-label {\n margin-right: 5px;\n }\n.b-popup-pics-list LI.b-popup-pics-inserted {\n padding: 0;\n }\n.b-popup-pics-list LI.b-popup-pics-inserted LABEL {\n display: inline-block;\n padding: 16px;\n }\n/* Editing\n----------------------------------------------- */\n.b-pics-edit-field {\n position: relative;\n float: left;\n min-width: 230px;\n max-width: 340px;\n overflow: hidden;\n }\n .b-pics-edit-field .b-pics-preloader {\n display: none;\n }\n .b-pics-edit-field A {\n border: none !important;\n }\n.b-pics-bar-footer .b-pics-edit-field {\n float: none;\n width: auto;\n height: auto !important;\n }\n.b-pics-submit-options .b-pics-edit-field {\n width: auto;\n }\n.b-pics-edit-field-hover:hover {\n background: #FAF9E1 !important;\n cursor: pointer;\n }\n .b-pics-edit-field .b-pics-input-edit {\n width: 240px;\n height: 22px;\n margin-right: 2px;\n background: #E6E6E6;\n border: none;\n font-size: 18px;\n }\n .b-pics-edit-field .b-pics-input-small-edit {\n width: 200px;\n height: 16px;\n margin-right: 2px;\n background: #E6E6E6;\n border: none;\n font-size: 12px;\n }\n .b-pics-edit-field .b-pics-textarea-edit {\n width: 579px;\n padding: 4px;\n margin: 0 0 7px 0;\n background: #E6E6E6;\n border: none;\n line-height: 18px;\n }\n .b-pics-edit-field .b-pics-input-edit,\n .b-pics-edit-field .b-pics-input-text,\n .b-pics-edit-field .b-pics-textarea-edit,\n .b-pics-edit-field .b-pics-btn,\n .b-pics-edit-field .b-pics-cancel {\n display: none;\n }\nH2.b-pics-edit-empty,\n.b-pics-edit-empty {\n color: #7F7F7F;\n }\n.b-pics-edit-field-click {\n max-width: 250px;\n padding-right: 5px;\n margin: -1px 0 0 -4px;\n }\n.b-pics-bar-footer .b-pics-edit-field-click {\n width: 100%;\n max-width: 100%;\n }\n .b-pics-edit-field-click .b-editable-edit-input {\n width: 130px;\n font-size: 12px;\n }\n .b-pics-bar-footer .b-pics-edit-field-click .b-editable-edit-input {\n width: 400px;\n }\n .b-pics-bar-footer .b-pics-edit-field-click .b-pics-preloader {\n float: right;\n }\n.b-pics-submit-options .b-pics-edit-field-click {\n margin: 0;\n }\n.b-pics-edit-field-click:hover {\n background: none !important;\n }\n .b-pics-edit-field-click .b-pics-title {\n display: none;\n }\n .b-pics-edit-field-click .b-pics-input-edit,\n .b-pics-edit-field-click .b-pics-textarea-edit {\n outline: none;\n }\n .b-pics-edit-field-click .b-pics-input-edit,\n .b-pics-edit-field-click .b-pics-textarea-edit,\n .b-pics-edit-field-click .b-pics-btn,\n .b-pics-edit-field-click .b-pics-cancel {\n display: inline-block;\n vertical-align: middle;\n }\n .b-pics-edit-field-click .b-pics-photo-desc,\n .b-pics-edit-field-click .b-pics-fadeout {\n display: none;\n }\n .b-pics-edit-field-click .b-pics-preloader {\n display: inline-block;\n }\n.b-pics-edit-field-new .b-pics-select {\n display: none;\n }\n.b-pics-edit-field-new .b-pics-input-text {\n display: inline-block;\n width: 130px;\n }\n.b-pics-head {\n width: 578px;\n }\n\n/* Spinner\n----------------------------------------------- */\n.b-pics-spinner-wrap {\n display: none;\n position: fixed;\n top: 50%;\n left: 0;\n width: 100%;\n margin-top: -14px;\n text-align: center;\n line-height: 18px;\n font-size: 16px;\n color: #FFF !important;\n }\n.b-pics-spinner {\n display: inline-block;\n width: 30px;\n height: 30px;\n margin-right: 5px;\n background: url(/img/spinner.png?v=13935) no-repeat;\n vertical-align: middle;\n -moz-transform: rotate(0deg);\n -webkit-transform: rotate(0deg);\n -o-transform: rotate(0deg);\n -ms-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n.b-popup-pic-spinner .b-pics-spinner-wrap {\n display: block;\n }\n \n/* Paste url\n----------------------------------------------- */\n\n.b-popup-pics-paste .b-popup-pics-add-header,\n.b-popup-pics-paste .b-pics-privacy-icon {\n display: none;\n }\n.b-popup-pics .b-popup-pics-paste {\n width: 770px;\n }\n.b-popup-pics-header {\n position: relative;\n overflow: hidden;\n min-height: 35px;\n margin-bottom: 20px;\n padding-right: 25px;\n }\n.b-popup .b-pics-input-custom-text {\n width: 65px;\n margin: 0 7px 0 0;\n color: #AAAAAA;\n }\n.b-popup .b-pics-input-custom-text:focus {\n color: #000;\n }\n.b-popup .b-pics-back-to-default {\n margin: 0 7px 0 0;\n }\n.b-pics-paste-url {\n display: table;\n overflow: hidden;\n margin: 0 0 20px 0;\n }\n.b-pics-preview-wrapper {\n position: relative;\n display: table-cell;\n padding: 5px;\n border-radius: 5px;\n border: 1px solid #CCC;\n }\n .b-pics-preview-pic {\n display: block;\n width: 100px;\n height: 100px;\n border: 1px solid #CCC;\n }\n .b-pics-preview-image {\n display: inline;\n max-width: 100px;\n max-height: 100px;\n text-align: center;\n }\n.b-pics-add-fields {\n display: table-cell;\n padding: 0 0 0 15px;\n vertical-align: middle;\n }\n .b-pics-add-fields LABEL {\n display: block;\n margin: 10px 0 0 0;\n }\n .b-pics-add-fields LABEL:first-child {\n margin: 0;\n }\n .b-pics-add-fields .b-pics-url-field {\n width: 635px;\n height: 20px;\n }\n .g-sensor .b-pics-add-fields .b-pics-url-field {\n width: 625px;\n }\n.b-pics-options {\n clear: both;\n padding: 10px 0 0 0;\n border-top: 1px solid #AAA;\n text-align: right;\n }\n .b-pics-options LABEL,\n .b-pics-options-change {\n margin: 0 10px 0 0;\n }\n .b-pics-options-button {\n cursor: pointer;\n }\n.b-pics-option-field {\n width: 70px;\n margin-right: 10px;\n }\n.b-pics-decline-new-album {\n padding: 0 0 0 10px;\n cursor: pointer;\n color: #3F5F9E;\n }\n.b-pics-custom-options {\n display: inline-block;\n }\n.b-pics-without-output .b-popup-pics-paste-header,\n.b-pics-without-output .b-popup-pics-add-header,\n.b-pics-without-output .b-popup-pics-list-header,\n.b-pics-without-output .b-pics-size-label,\n.b-pics-without-output .b-pics-size-list {\n display: none;\n }\n.b-popup-pics-add .b-popup-pics-add-header,\n.b-pics-with-output .b-pics-size-list {\n display: inline-block;\n }\n.b-pics-with-output .b-pics-size-label {\n display: inline;\n } \n.b-popup-pics-upload .b-pics-paste-url,\n.b-popup-pics-upload .b-pics-submit-options .i-bubble,\n.b-popup-pics-add .b-pics-upload-wrapper .i-bubble, \n.b-popup-pics-add .b-pics-paste-url,\n.b-popup-pics-add .b-pics-paste-button,\n.b-popup-pics-add .b-pics-header-select-album,\n.b-pics-custom-options {\n display: none;\n }\n.b-popup-pics-paste .b-pics-summary,\n.b-popup-pics-paste .b-pics-upload-wrapper,\n.b-popup-pics-paste .b-pics-submit-options-norule,\n.b-popup-pics-paste .b-pics-select-album,\n.b-popup-pics-paste .b-pics-save-button,\n.b-popup-pics-paste .b-pics-submit-options.b-pics-submit-options-norule,\n.b-popup-pics-paste .b-popup-pics-gallery,\n.b-popup-pics-paste .b-popup-pics-edit-fields,\n.b-popup-pics-paste .b-pics-header-select-album {\n display: none;\n }\n.b-popup-pics-paste .b-pics-paste-url,\n.b-popup-pics-paste .b-pics-submit-options,\n.b-popup-pics-paste .b-pics-paste-button {\n display: block;\n }\n\n/* Paste url only */\n\n.b-popup-pics-paste-only .b-popup-pics-upload-header,\n.b-popup-pics-paste-only .b-popup-pics-list-header,\n.b-popup-pics-paste-only .b-pics-summary,\n.b-popup-pics-paste-only .b-pics-upload-wrapper,\n.b-popup-pics-paste-only .b-pics-submit-options-norule,\n.b-popup-pics-paste-only .b-pics-select-album,\n.b-popup-pics-paste-only .b-pics-save-button,\n.b-popup-pics-paste-only .b-pics-submit-options.b-pics-submit-options-norule,\n.b-popup-pics-paste-only .b-popup-pics-edit-fields,\n.b-popup-pics-paste-only .b-pics-header-select-album {\n display: none;\n }\n.b-popup-pics-paste-only .b-pics-submit-options {\n display: block;\n }\n\n/* Popup pics header */\n\n.b-popup-pics-upload .b-popup-pics-list-header,\n.b-popup-pics-upload .b-popup-pics-paste-header,\n.b-popup-pics-list .b-popup-pics-upload-header,\n.b-popup-pics-list .b-popup-pics-paste-header,\n.b-popup-pics-paste .b-popup-pics-upload-header,\n.b-popup-pics-paste .b-popup-pics-list-header, \n.b-popup-pics-dropbox {\n cursor: pointer;\n border-bottom: 1px dotted #000;\n font-weight: normal;\n }\n\n.b-popup-pics-dropbox {\n font-weight: normal !important;\n }\n\n/* Popup pics preloader */\n\n.b-popup-pics-upload .b-pics-spinner-wrapper,\n.b-popup-pics-paste .b-pics-spinner-wrapper,\n.b-popup-pics-list .b-pics-spinner-wrapper,\n.b-popup-pics-add .b-pics-spinner-wrapper {\n display: none;\n }\n.b-popup-pics-list.b-popup-pics-loading-more .b-pics-spinner-wrapper {\n display: block;\n }\n.b-pics-spinner-wrapper {\n background: none repeat scroll 0 0 #ECECEC;\n border-radius: 6px 6px 6px 6px;\n min-height: 22px;\n margin: 10px 14px 0 0;\n padding: 8px 0;\n text-align: center;\n }\n.b-pics-spinner-inner {\n color: #999999;\n font-size: 18px;\n padding: 3px 0 0 25px;\n position: relative;\n text-shadow: 2px 2px 2px #FFFFFF;\n }\n .b-pics-spinner-icon {\n background: url(/img/preloader/spinner1.gif?v=19441) no-repeat scroll 0 0 transparent;\n height: 20px;\n left: 0;\n margin: -6px 0 0;\n padding: 0;\n position: absolute;\n top: 50%;\n width: 20px;\n }\n/* Migration promo page */\n\n.b-pics-promo-wrapper {\n position: relative;\n -moz-border-radius: 6px;\n -webkit-border-radius: 6px;\n border-radius: 6px;\n background: url(/img/pics/sh.png?v=18262) no-repeat scroll 0 50% #4E92C1; \n }\n.b-pics-migration {\n margin: 0 15px 20px 0;\n }\n .b-pics-migration .b-pics-promo-box {\n display: block;\n position: absolute;\n top: 50%;\n left: 20px;\n width: 111px;\n height: 95px;\n margin-top: -39px;\n background: url(\"/img/pics/pics-promo-box.png?ver=1\") no-repeat scroll 0 0 transparent;\n }\n .b-pics-migration .b-pics-promo-content {\n position: relative;\n height: auto;\n padding: 10px 50px 10px 180px;\n outline: medium none;\n background: none;\n }\n .b-pics-migration .b-pics-promo-content DT, \n .b-pics-migration .b-pics-promo-content DD {\n margin-bottom: 5px;\n font-size: 14px;\n color: #FFF;\n }\n .b-pics-migration .b-pics-promo-content DD A {\n text-decoration: underline;\n color: #FFF;\n }\n .b-pics-migration .b-pics-promo-content DD A:hover {\n text-decoration: none !important;\n }\n\n/* Canon branding */\n\n.b-foto-branding .b-popup-pics .b-popup-inner {\n background: url(/img/pics/branding/post-upload-top-bg.png?ver=1) 0 0 no-repeat;\n }\n.b-foto-branding .b-popup-pics .b-popup-outer {\n background: url(/img/pics/branding/post-upload-bottom-bg.png?ver=1) 0 100% no-repeat #F6F6F6;\n }\n.b-foto-branding .b-popup-pics-add-one .b-popup-pics-gallery {\n min-width: 757px;\n }\n \n/* If .b-popup-pics-list-header first */\n.b-popup-pics-list-first .b-pics-header-select-album {\n display: block\n }\n.b-popup-pics-list-first .b-popup-pics-upload-header {\n display: none;\n }\n'); LJ.UI.registerTemplate('templates-Widgets-photouploader-photouploader', "

{{html LJ.mltext(\'fotki.album.upload.images\')}}

{{html LJ.mltext(\'fotki.album.add.images\')}}

{{html LJ.mltext(\'fotki.album.paste.from.album\')}}

{{html LJ.mltext(\'fotki.album.paste.url\')}}

{{html LJ.mltext(\'fotki.album.dropbox.title\')}}

{{html $data.albumList}}
{{html LJ.mltext(\'fotki.album.browse.photo\')}} ...
{{html LJ.mltext(\'fotki.album.link.click.to.upload\')}}

{{html LJ.mltext(\'fotki.album.uploading.image\')}} /

{{html LJ.mltext(\'fotki.album.add.photos\')}}

{{html LJ.mltext(\'fotki.album.no.pics\')}}

{{html LJ.mltext(\'fotki.album.load.more\')}}
{{html $data.albumList}} {{html LJ.mltext(\'fotki.album.cancel.album\')}}
{{html LJ.mltext(\'fotki.privacy\')}}
{{html $data.privacyList}}
", 'JQuery.stat'); LJ.UI.registerTemplate('templates-Widgets-photouploader-insertedItem', "
  • ", 'JQuery.stat'); LJ.UI.registerTemplate('templates-Widgets-photouploader-uploadedItem', "
  • \"\"
  • ", 'JQuery.stat'); /*global SWFUpload, swfobject */ /** * @author sergey.zhirkov@sup.com, b-vladi@cs-console.ru, dmitry.petrov@sup.com (Dmitry Petrov) * @fileoverview Upload photos dialog. */ /** * @name $.lj.photouploader * @requires $.ui.core, $.ui.widget, $.ui.sortable, $.lj.bubble, $.fotki, $.lj.sizeSelect.js, * swfupload.js (http://demo.swfupload.org/Documentation/), * swfobject.js * @class Photouploader widget. Widget is responsible for dealing with popup. * @example * <div class="with-page-content"> * ... * <a href="#" class="upload-control">Upload</a> * </div> * <script> * $('div.with-page-content') * .photouploader({ * selectors: { * uploadButton: 'a.upload-control' * } * }) * </script> * */ ;(function($, window) { 'use strict'; /** @lends $.lj.photouploader.prototype */ $.widget('lj.photouploader', { options: { // show link to original checkbox and field for url after uploading showLinkFields: true, // data that comes from server (in template) availableSpace: null, albumsData: null, sizesData: null, guid: null, state: 'begin', // 'begin' || 'processing' || 'end' _hideUploadTab: 'upload', // 'upload' || 'add' || 'paste' || 'list' progress: 0, showOn: false, // 'load' || false // if "true" will request required size of images from server and trigger // 'htmlready' event on element with html output (including "img" tags) htmlOutput: true, tracking_opendialog: '', tracking_photouploaded: '', urls: { uploadImagesTo: 'http://' + Site.picsUploadDomain + '/' + Site.remoteUser, uploaderSWF: Site.siteroot + '/js/swfupload/swfupload.swf', uploaderImage: Site.siteroot + '/img/buttons/browse.png?v=16958', spinnerImage: Site.siteroot + '/img/buttons/spinner.png?v=16898', sendDataTo: '/__rpc_fotki_imgs?func=update_photos', siteRoot: Site.siteroot }, selectors: { faderNode: 'div.b-fader', popupContainer: 'body', closeControl: 'i.i-popup-close', headers: 'div.b-popup-state-container h2', uploadButton: '.b-pics-upload-control', postButton: '.b-pics-post-button', saveButton: '.b-pics-save-button', removeButton: '.i-thumb-close', addImagesControl: 'div.click-upload div', dataForm: '.b-pics-data-form', itemCheckbox: '#photo_cb_{id}', stateContainer: 'div.b-popup-state-container', uploadProgress: 'div.b-pics-upload', progressBar: 'div.b-pics-upload-progress-bar-inner', currentCounter: 'span.b-pics-current-image', totalCounter: 'span.b-pics-total-images', imageFilename: 'p.b-pics-upload-filename', pasteImageUrl: '#paste-image-url', pasteImageLink: '#paste-image-link', pasteImagePreview: 'span.b-pics-preview-pic', photoListWrapper: 'div.b-popup-pics-gallery', photoList: 'ul.b-popup-pics-gallery-list', listItem: 'li.pics-item-list', listNoPhotos: '.b-popup-pics-gallery-nophotos', firstSelectedListItem: 'li.pics-item-list > input:checked:first', uploadedItem: 'ul.b-popup-pics-gallery-list li.pics-item-upload', insertedItem: 'ul.b-popup-pics-gallery-list li.b-popup-pics-inserted', titleField: '.b-pics-title-field', descField: '.b-pics-desc-field', linkField: '.b-pics-link-field', albumCoverCheckbox: '.b-pics-checkbox input', newAlbumField: '.b-pics-submit-options .b-pics-input-text-album-name', newAlbumFieldWrapper: '.b-pics-submit-options .input-album-name-wrapper', albumList: '.b-pics-submit-options .b-pics-select', cancelCreateAlbumBtn: '.input-album-name-wrapper span.b-pics-decline-new-album', sizeList: '.b-pics-size-options', listPageAlbumList: '.b-pics-header-select-album .b-pics-select', // backToDefaultSize: '.b-pics-back-to-default', privacyBubble: '.b-pics-privacy-inner', privacyControl: '.b-pics-privacy-icon', privacyGroup: 'li', privacyIcon: '.b-pics-privacy-icon', preloaderElem: '.b-pics-preloader', availableNow: '.b-pics-available-now', uploadHeader: '.b-popup-pics-upload-header' }, classNames: { statePrefix: 'b-pics-state-', typePrefix: 'b-popup-pics-', headerSuffix: '-header', withHtmlOutput: 'b-pics-with-output', withoutHtmlOutput: 'b-pics-without-output', showPasteOnly: 'b-popup-pics-paste-only', selectedItem: 'selected', currentTab: 'current-state', insertPhotosCountPrefix: 'b-popup-pics-add-', preloader: 'b-pics-preloader-visible', listPreloader: 'b-popup-pics-loading-more', privacy: { 'allfriends': 'b-pics-privacy-icon-fr', 'basic': 'b-pics-privacy-icon', 'public': 'b-pics-privacy-icon-pb', 'friends_': 'b-pics-privacy-icon-gr', 'private': 'b-pics-privacy-icon-pr' }, hideFirst : 'b-popup-pics-list-first', secondTab: 'b-popup-pics-list', firstTab: 'b-popup-pics-upload', stateBegin: 'b-pics-state-begin', showLinkFields: 'b-popup-pics-links' }, templates: { photouploader: 'templates-Widgets-photouploader-photouploader', insertedItem: 'templates-Widgets-photouploader-insertedItem', uploadedItem: 'templates-Widgets-photouploader-uploadedItem', clickToUploadMessage: '{fotki.album.link.click.to.upload}', uploadingMessage: '{fotki.album.uploading.message}', previewImg: '', fader: '', albumList: { header: '' }, privacyList: { header: '
      ', common: '
    • {groupname}
    • ', selected: '
    • {groupname}
    • ', footer: '
    ' } } }, // private methods _create: function() { var options = this.options; // store language vars that comes from server options.ml = Site.ml_text; // max-height of photos wrapper block. Will be calculated on photouploader show this._wrapperMaxHeight = null; this._hasFlash = ( (typeof swfobject === 'object') && swfobject.hasFlashPlayerVersion('9') ); //this flag is used only on the list tab this._currentGalleryId = null; this._listPhotosById = []; this._makeNode(); this.reset(); //we show only paste url dialog if user has basic account or migration has not finished yet this._pasteOnly = ('ljphotoEnabled' in window) && (!window.ljphotoEnabled || window.ljphotoMigrationStatus !== LJ.getConst('LJPHOTO_MIGRATION_FINISHED') || !window.ljphotoUploadEnabled); if (options.type === 'upload') { this._initSWFUpload(); /* * Fix for IE9 * After swfupload initialization $.noData.object contains string */ $.noData['object'] = true; } // set base options this._setOptions(options); this._bindEvents(); if (options.showOn === 'load') { this.show(); } // if flash is not available, remove first tab if ( !this._hasFlash ) { this._hideUploadTab(); } this._initDropbox(); }, _initDropbox: function() { var photouploader = this, header = $('.b-popup-pics-dropbox'); header.find('.b-pics-tab-dropbox').on('click', function() { if (!window.Dropbox) { LJ.dialogs.alert(LJ.ml('fotki.album.dropbox.error')); return; } if (!window.Dropbox.isBrowserSupported()) { LJ.dialogs.alert(LJ.ml('fotki.album.dropbox.not_supported')); return; } LJ.Track.event('Photouploader', 'Dropbox', 'Click'); window.Dropbox.choose({ linkType: 'preview', multiselect: true, success: function(files) { photouploader.element.trigger({ type: 'htmlready', htmlStrings: files.map(function(file) { return ''.supplant({ url: file.link.replace('www.dropbox.com', 'dl.dropboxusercontent.com') }); }) }); photouploader.hide(); LJ.Track.event('Photouploader', 'Dropbox', 'Success'); } }); }); LJ.injectScript('https://www.dropbox.com/static/api/1/dropins.js').done(function() { if (window.Dropbox) { window.Dropbox.appKey = '7ye0n6mhwlsdh9u'; } }); LJ.Event.on('photouploader:show', function(type) { var showDropboxTab = Boolean((type !== 'add') && LJ.get('fotki')); header.toggle(showDropboxTab); }); }, _hideUploadTab: function() { var cl = this.options.classNames; jQuery( this.options.selectors.uploadHeader ).css({ display: 'none' }); this._stateContainer.removeClass( cl.firstTab ).addClass( cl.secondTab ).removeClass( cl.stateBegin ); }, _initSWFUpload: function() { var options = this.options, element = this.element, templates = options.templates, urls = options.urls; templates.clickToUploadMessage = templates.clickToUploadMessage.supplant(options.ml); templates.uploadingMessage = templates.uploadingMessage.supplant(options.ml); this._flashUploader = new SWFUpload({ post_params: { form_auth: options.guid }, upload_url: urls.uploadImagesTo, flash_url: urls.uploaderSWF, button_placeholder: this._addImagesControl.get(0), button_width: 141, button_height: 33, button_cursor: SWFUpload.CURSOR.HAND, button_window_mode : SWFUpload.WINDOW_MODE.TRANSPARENT, button_text: '', prevent_swf_caching: false, file_types: '*.jpg;*.jpeg;*.png;*.gif;*.bmp;*.tif;*.tiff', file_queued_handler: function() { var counters = { totalIndex: this.getStats().files_queued, currentIndex: 1 }; element.trigger('fileQueued', counters); }, upload_start_handler: function(file) { var filename = file.name; element.trigger('uploadStart', filename); }, upload_progress_handler: function(file, bytesLoaded, bytesTotal) { var percent = Math.ceil((bytesLoaded / bytesTotal) * 90) + '%'; element.trigger('uploadProgress', percent); }, upload_error_handler: function(file, errorCode, message) { var errorMessage = ''; if (errorCode == '-220') { errorMessage = options.ml['fotki.album.upload.io.error']; } else { errorMessage = options.ml['fotki.album.upload.unknown.error'] + ': ' + errorCode + ', ' + message; } element.trigger('uploadProgress', '95%'); element.trigger('fileUploaded', { status: 'error', result: errorMessage }); }, upload_success_handler: function(file, serverData) { // cut off the extra information about chunks var responseBody = serverData.match(/\{.*\}/); element.trigger('uploadProgress', '95%'); if (responseBody) { serverData = responseBody[0]; serverData = $.parseJSON(serverData); // filename without extension serverData.photo_title = file.name.match(/(.*?)\.[^\.]*$/)[1]; element.trigger('fileUploaded', serverData); } else { element.trigger('fileUploaded', { status: 'error', result: options.ml['fotki.album.upload.unknown.error'] + ': \n' + serverData }); } } }); }, _makeNode: function() { var options = this.options, selectors = options.selectors, templates = options.templates, albumListTemplate = templates.albumList, albumList = [], albumsData = options.albumsData, currentAlbumId = options.albumId, privacyList = [], privacyData = options.privacyData, privacyListTemplate = templates.privacyList, groupTemplate = privacyListTemplate.common, group, popupNode, faderNode, i,l; if (options.type === 'upload') { albumList.push(albumListTemplate.header, albumListTemplate.footer); privacyList.push(privacyListTemplate.header); for (i = 0, l = privacyData.length; i < l; i++) { groupTemplate = (i === 0) ? privacyListTemplate.selected : privacyListTemplate.common; group = groupTemplate.supplant(privacyData[i]); privacyList.push(group); } privacyList.push(privacyListTemplate.footer); } faderNode = $(templates.fader).prependTo('body'); // LJSUP-9765: An fascinaging opera bug - if the script is called inside the form and attempts to build // DOM through innerHTML field than it will strip form elements with the first call. The second // try will produce correct results. // Last checked in Opera 11.10 for linux, opera bug DSK-346265 if (jQuery.browser.opera) { jQuery('
    '); } popupNode = LJ.UI.template(this.options.templates.photouploader, { showLinkFields: this.options.showLinkFields, albumList: albumList.join(' '), privacyList: privacyList.join(' '), availableSpace: options.availableSpace, siteRoot: options.urls.siteRoot, addToPostButtonText: LJ.ml( LJ.get('comments_page') ? 'fotki.album.comment.images' : 'fotki.album.post.images' ) }) .prependTo(selectors.popupContainer); this._closeControl = popupNode.find(selectors.closeControl); this._progressBar = popupNode.find(selectors.progressBar); this._addImagesControl = popupNode.find(selectors.addImagesControl); this._currentCounter = popupNode.find(selectors.currentCounter); this._totalCounter = popupNode.find(selectors.totalCounter); this._uploadProgress = popupNode.find(selectors.uploadProgress); this._imageFilename = popupNode.find(selectors.imageFilename); this._stateContainer = popupNode.find(selectors.stateContainer); this._photoListWrapper = popupNode.find(selectors.photoListWrapper); this._photoList = this._photoListWrapper.find(selectors.photoList); this._photoListNoPhotos = this._photoListWrapper.find(selectors.listNoPhotos); this._pasteImageUrl = popupNode.find(selectors.pasteImageUrl); this._pasteImageLink = popupNode.find(selectors.pasteImageLink); this._pasteImagePreview = popupNode.find(selectors.pasteImagePreview); this._titleField = popupNode .find(selectors.titleField) .labeledPlaceholder(); this._descField = popupNode .find(selectors.descField) .labeledPlaceholder(); this._linkField = popupNode .find(selectors.linkField) .labeledPlaceholder(); this._newAlbumField = popupNode .find(selectors.newAlbumField) .labeledPlaceholder(); this._newAlbumFieldWrapper = popupNode .find(selectors.newAlbumFieldWrapper); this._albumCoverCheckbox = popupNode.find(selectors.albumCoverCheckbox); this._albumList = popupNode.find(selectors.albumList); this._cancelCreateAlbumBtn = popupNode.find(selectors.cancelCreateAlbumBtn); this._listPageAlbumList = popupNode.find(selectors.listPageAlbumList); this._listPageAlbumList.html(this._getAlbumsData(options.albumsData)); if (options.htmlOutput) { this._sizeList = popupNode.find(selectors.sizeList).sizeSelect({ sizesData: options.sizesData }); } this._customWidthField = popupNode .find(selectors.customWidthField) .labeledPlaceholder(); this._customHeightField = popupNode .find(selectors.customHeightField) .labeledPlaceholder(); // this._backToDefaultSize = popupNode.find(selectors.backToDefaultSize); this._preloaderElem = popupNode.find(selectors.preloaderElem); this._availableNow = popupNode.find(selectors.availableNow); this._privacyIcon = popupNode.find(selectors.privacyIcon); this._privacyBubble = popupNode.find(selectors.privacyBubble) .bubble({ target: popupNode.find(selectors.privacyControl), showOn: 'click' }); this._privacyGroups = this._privacyBubble.find(selectors.privacyGroup); // TODO: create universal function with loop to remove this HELL if (currentAlbumId || albumsData.length) { this._newAlbumFieldWrapper.hide(); } this._popupNode = popupNode; this._faderNode = faderNode; this._originalLinkCheckbox = popupNode.find('#link-original'); }, /** * Adds items from array to photo list * * @param {Array} items */ _addItems: function(items) { for (var i = 0, l = items.length; i < l; i++) { this.addItem(items[i]); } }, /** * Load the gallery in the paste from gallery tab. The photos are not * cached now, so it can be improved in future. * * @param {string} album_id Album id. */ _fillGallery: function(album_id) { var selectors = this.options.selectors; if (this._currentGalleryId !== album_id) { this._photoList.find(selectors.listItem).remove(); this._currentGalleryId = album_id; this._listPhotosById = []; this._currentGalleryOffset = 0; this._currentGalleryLoading = false; this._currentGalleryFull = false; this._photoListNoPhotos.hide(); this._fetchGallery(); } }, /** * Fetch more items in the list for current gallery. The function takes the * data from the _currentGalleryId, currentGalleryOffset to fetch the required * photos. */ _fetchGallery: function() { var self = this, // Notice: // count is hardcoded and based on current amount if photos in a row: 5 // and current photo item outer height: 151px countBasedOnWrapperSize = ( Math.floor( this._wrapperMaxHeight / 151 ) + 1 ) * 5, // 20 photos - min amount of photos to fetch count = Math.max(20, countBasedOnWrapperSize); if (this._currentGalleryLoading) { return; } this._currentGalleryLoading = true; this._stateContainer.addClass(this.options.classNames.listPreloader); $.fotki.getAlbumContents(this._currentGalleryId, function(items) { if (self.options.type !== 'list') { return; } //do not insert anything if we are in another tab self._currentGalleryLoading = false; self._currentGalleryOffset += items.length; self._stateContainer.removeClass(self.options.classNames.listPreloader); if (items.length === 0) { self._currentGalleryFull = true; if (self._currentGalleryOffset === 0) { self._photoListNoPhotos.show(); } } self._addItems(items); }, this._currentGalleryOffset, 100, count); }, _setOption: function(option, value) { var photouploader = this, options = this.options, classNames = options.classNames, statePrefix = classNames.statePrefix, insertPhotosLength, insertPhotosCount, html, albumListTemplate; switch (option) { case 'type': if (value === 'upload' && this._pasteOnly) { value = 'paste'; } this._stateContainer .removeClass(classNames.typePrefix + options.type) .addClass(classNames.typePrefix + value); this._photoListNoPhotos.hide(); switch (value) { case 'list': this._stateContainer .removeClass(classNames.statePrefix + options.state) .removeClass(classNames.listPreloader); this._fillGallery(this._listPageAlbumList.val()); this._photoList.sortable('enable'); break; case 'add': options.type = value; this._stateContainer.removeClass(classNames.statePrefix + options.state); this._setOption('htmlOutput', true); insertPhotosLength = options.insertPhotosData.length; if (insertPhotosLength === 1) { insertPhotosCount = 'one'; } else if (insertPhotosLength > 1 && insertPhotosLength < 5) { insertPhotosCount = 'several'; } else { insertPhotosCount = 'many'; } this._setOption('insertPhotosCount', insertPhotosCount); this._addItems(options.insertPhotosData); this._photoList.sortable('refresh'); if (insertPhotosLength > 1) { this._photoList.sortable('enable'); } break; case 'upload': this._stateContainer.addClass(classNames.statePrefix + options.state); this._stateContainer .removeClass(classNames.insertPhotosCountPrefix + options.insertPhotosCount); break; case 'paste': if (this.options.type === 'upload') { if (this.options.state === 'processing') { if (confirm(this.options.ml['fotki.album.stop.upload'])) { this._flashUploader.cancelQueue(); this._setOption('state', 'end'); } else { return this; } } } if (this._pasteOnly) { this._stateContainer .addClass(classNames.showPasteOnly); } setTimeout(function() { photouploader._pasteImageUrl.focus(); }, 0); break; } this.options.type = value; // only for pages with available sizeList selector // Notice: sizelist is not available on scrapbook, for example if (this._sizeList) { // update state of size selector // when we are in 'paste' mode - we should set 'original' value, and 'default' otherwise this._sizeList.sizeSelect('option', 'value', value === 'paste' ? 'original' : 'default'); } break; case 'availableNow': this._availableNow.text(value); break; case 'insertPhotosCount': this._stateContainer .removeClass(classNames.insertPhotosCountPrefix + options.insertPhotosCount) .addClass(classNames.insertPhotosCountPrefix + value); break; case 'state': this._stateContainer.removeClass(statePrefix + options.state); options.state = value; if (options.type === 'upload') { switch (value) { case 'processing': this._flashUploader.setButtonDisabled(true); this._photoList.children().removeClass(classNames.selectedItem); photouploader.element.trigger({ type: 'uploading' }); break; case 'end': this._flashUploader.setButtonDisabled(false); this._flashUploader.setButtonText(options.templates.buttonText); photouploader.element.trigger({ type: 'endupload' }); if (this._changedPhotosById.length) { this.index('last'); } else { value = 'begin'; } break; } } this._stateContainer.addClass(statePrefix + value); break; case 'htmlOutput': this._stateContainer .toggleClass(classNames.withHtmlOutput, value) .toggleClass(classNames.withoutHtmlOutput, !value); break; case 'activeItem': if (options.activeItem) { options.activeItem.removeClass(options.classNames.selectedItem); } this._setOption('activeImg', value.find('img')); this._setOption('activeIndex', this._getIndex(value)); if (options.state === 'end') { value.addClass(options.classNames.selectedItem); this.load(); } break; case 'coverItem': if (value) { if (options.coverItem) { // remove old album cover this._changedPhotosById[ this._getIndex(options.coverItem) ].is_cover = 0; } // store new album cover this._changedPhotosById[ this._getIndex(value) ].is_cover = 1; } break; case 'showLinkFields': this._stateContainer .toggleClass( this.options.classNames.showLinkFields, value ); break; case 'totalIndex': this._totalCounter.text(value); break; case 'currentIndex': if (value > options.totalIndex) { photouploader.element.one('thumbnailLoaded', function() { photouploader.element.trigger('uploadFinished'); }); } else { this._currentCounter.text(value); } break; case 'progress': if (!value) { this._progressBar.stop(); this._progressBar.width(0); } else if (value > options.progress) { this._progressBar.stop(); this._progressBar.animate({ 'width': value + '%' }, 'slow'); } break; case 'filename': this._imageFilename.text(value); break; case 'albumsData': albumListTemplate = options.templates.albumList; html = this._getAlbumsData(value, options.albumId) + albumListTemplate.last.supplant(options.ml); this._albumList.html(html); break; } options[option] = value; }, _getAlbumsData: function(data, selected) { var albumData, html = '', albumListTemplate = this.options.templates.albumList, commonAlbum = albumListTemplate.common, selectedAlbum = albumListTemplate.selected, i, l; selected = selected || null; for (i = 0, l = data.length; i < l; i++) { albumData = data[i]; if (albumData.album_id === selected || (!selected && i === 0)) { html += selectedAlbum.supplant(albumData); } else { html += commonAlbum.supplant(albumData); } } return html; }, /** * Saves changes in certain photo propery (stores it in a hash object) * * @param {string} propertyName * @param {string} value */ _saveChanges: function(propertyName, value, index) { index = isNaN(index) ? this.options.activeIndex : index; var changedPhoto = this._changedPhotosById[index] || {}; changedPhoto[propertyName] = value; if (propertyName === 'album_cover') { this._setOption('coverItem', index); } this._changedPhotosById[index] = changedPhoto; }, /** * Take only selected photos from the list and paste them into the editor area. */ _postFromList: function() { var cbSel = this.options.selectors.itemCheckbox, self = this, list = (this.options.type === 'list') ? this._listPhotosById : this._changedPhotosById; this._changedPhotosById = list.filter(function(item) { var checkbox = self._photoList.find(cbSel.supplant({ id: item.photo_id })); return checkbox.get(0).checked; }); this._sendData('sendMany'); }, _bindEvents: function() { var photouploader = this, options = photouploader.options, selectors = options.selectors, classNames = options.classNames, privacyClassNames = classNames.privacy; this._photoList.sortable({ disabled: true, stop: function () { photouploader.update(); } }).disableSelection(); this.element .bind('fileQueued', function(event, counters) { photouploader .updateCounters(counters) .startUpload(); }) .bind('uploadStart', function(event, filename) { photouploader.option({ filename: filename }); photouploader._setOption('progress', 0); }) .bind('uploadProgress', function(event, percent) { photouploader.option('progress', percent.replace('%', '')); }) .bind('fileUploaded', function(event, serverData) { var flashUploader = photouploader._flashUploader; if (serverData.status === 'error') { if (options.state === 'processing') { alert( Site.ml_text[serverData.result] ? Site.ml_text[serverData.result] : serverData.result ); if (serverData.message) { console.log(serverData.message); } } photouploader._flashUploader.cancelQueue(); if (!photouploader._changedPhotosById.length) { flashUploader.setButtonDisabled(false); flashUploader.setButtonImageURL(options.urls.uploaderImage); } photouploader._setOption('state', 'end'); return false; } photouploader .updateCounters({ currentIndex: parseInt(options.currentIndex, 10) + 1 }) .option('availableNow', serverData.availableNow) .addItem(serverData); }) .bind('uploadFinished', function() { photouploader._touchPixel('photouploaded'); photouploader._setOption('state', 'end'); }) .bind('endupload', function () { photouploader._photoList.sortable('enable').sortable('refresh'); }) .bind('uploading', function () { photouploader._photoList.sortable('disable'); }) .bind('removeitem', function () { photouploader._photoList.sortable('refresh'); photouploader.update(); }) .delegate(selectors.uploadButton, 'click', function(event) { event.preventDefault(); photouploader.show(); }); this._popupNode .delegate(selectors.uploadedItem, 'click', function(event) { var currentItem = $(this); event.preventDefault(); if (options.state === 'processing') { return false; } photouploader.makeActive(currentItem); }) .delegate(selectors.closeControl, 'click', function() { var closeWithoutSaving; if ( options.state === 'processing' || ( options.state === 'end' && options.type === 'upload' && photouploader._changedPhotosById.length ) ) { closeWithoutSaving = confirm(options.ml['fotki.album.close.without.saving.confirm']); if (closeWithoutSaving) { photouploader.removeUploaded(); } else { return false; } } else if (options.type === 'paste') { photouploader.removeUploaded(); } photouploader.hide(); }) .delegate(selectors.dataForm, 'submit', function(event) { var photoSrc; event.preventDefault(); if (photouploader.options.type === 'paste') { photouploader.removeUploaded(); photoSrc = photouploader._pasteImageUrl.val(); if (photoSrc) { photouploader.element.trigger({ type: 'htmlready', htmlStrings: photouploader._makeHtml({ photo_link: photouploader._pasteImageLink.val(), photo_title: '', photo_src: photoSrc }) }); } photouploader.hide(); } else if (photouploader.options.type === 'list') { // We don't remove uploaded photos when type is 'list' // cuz user can insert photo that uploaded before photouploader._postFromList(); } else if (photouploader.options.type === 'upload') { photouploader._sendData('sendMany'); } else { photouploader._postFromList(); } }) .delegate(selectors.titleField, 'change paste keyup', function() { var title = this.value; photouploader._saveChanges('photo_title', title); options.activeImg.attr('alt', title); }) .delegate(selectors.descField, 'change paste keyup', function() { photouploader._saveChanges('photo_desc', this.value); }) .delegate(selectors.linkField, 'change paste keyup', function() { photouploader._saveChanges('photo_link', this.value); }) .delegate(selectors.albumCoverCheckbox, 'change', function() { var albumCover = ($(this).prop('checked')) ? 1 : 0; if (albumCover) { photouploader._setOption('coverItem', options.activeItem); } else { photouploader._saveChanges('is_cover', 0); } }) .delegate(selectors.albumList, 'change', function() { if (photouploader._albumList.prop('selectedIndex') === photouploader._albumList.children().length - 1) { photouploader._newAlbumFieldWrapper.show(); photouploader._newAlbumField.focus(); $(this).hide(); } }) .delegate(selectors.cancelCreateAlbumBtn, 'click', function (event) { event.preventDefault(); photouploader._albumList.show(); photouploader._newAlbumFieldWrapper.hide(); if (options.albumId) { photouploader._albumList.find('option[value=' + options.albumId + ']').prop('selected', true); } else { photouploader._albumList.find(':first').prop('selected', true); } }) .delegate(selectors.removeButton, 'click', function(event) { event.preventDefault(); event.stopPropagation(); photouploader.removeItem($(this).closest(options.selectors.uploadedItem)); }) .delegate(selectors.headers, 'click', function(event) { event.preventDefault(); event.stopPropagation(); var type = $(this) .attr('class') .match(new RegExp(classNames.typePrefix + '(.+?)' + classNames.headerSuffix), 'i')[1]; if (options.type !== type) { photouploader._setOption('type', type); this.className += ' ' + classNames.currentTab; } LJ.Storage.setItem('photouploader.type', type); }) .delegate(selectors.pasteImageUrl, 'keyup paste blur', (function (){ var tempImage = new Image(), timer, src; tempImage.onload = function () { photouploader._pasteImagePreview.html(options.templates.previewImg.supplant({ src: tempImage.src })); }; tempImage.onerror = function () { photouploader._pasteImagePreview.html(''); }; function onTimeEnd() { if (src !== tempImage.src) { tempImage.src = src; } } return function () { clearTimeout(timer); timer = setTimeout(onTimeEnd, 500); src = this.value; }; })()); this._listPageAlbumList.change(function(ev) { if (photouploader._photoList.find(selectors.firstSelectedListItem).length === 0 || confirm(LiveJournal.getLocalizedStr('fotki.album.change'))) { photouploader._fillGallery(this.value); } else { ev.preventDefault(); } }); this._photoListWrapper.bind('scroll', function() { var bottomPosition; if ( options.type !== 'list' || photouploader._currentGalleryFull || photouploader._currentGalleryLoading ) { return; } bottomPosition = photouploader._photoListWrapper.scrollTop() + photouploader._photoListWrapper.height(); if (photouploader._photoList.height() - 200 < bottomPosition) { photouploader._fetchGallery(); } }); this._privacyBubble .delegate(selectors.privacyGroup, 'click', function() { var currentGroup = $(this), value = currentGroup.attr('data'), privacyClassName, privacyType; for (privacyType in privacyClassNames) { if (!privacyClassNames.hasOwnProperty(privacyType)) { continue; } if (value.indexOf(privacyType) === 0) { privacyClassName = privacyClassNames[privacyType]; break; } } photouploader._privacyIcon .attr('class', privacyClassNames.basic) .addClass(privacyClassName); photouploader._privacyBubble .data('value', value) .bubble('hide'); photouploader._privacyGroups.removeClass('active'); currentGroup.addClass('active'); }); $(document) .bind('keydown', function(event) { // Escape if (event.which === 27) { photouploader._closeControl.trigger('click'); } }); }, /** * Serializes data to output data format (listed below): * { * photos_data: [ * { * "photo_id": "1", * "photo_title": "foo", * "photo_desc": "bar", * ... * }, * { * "photo_id": "2", * "photo_title": "blabla", * "is_deleted": "1" * ... * } * ], * * // if photos will be added to album that is already exist * "album_id": "12345", * * // if new album will be created * "album_title": "My Album", * * // required size of photos (to add to post) - if needed * "required_size": "600", * * // photo id to make redirect to or word "album" (if redirect to album needed) * "redirect_to": "54321", * } * * @param {string} action * @param {number} oneIndex */ _serializeData: function(action /* 'sendOne', 'sendMany', 'removeAll' */, oneIndex) { var changedPhotosById = this._changedPhotosById, isNewAlbum = !!this._albumTitle, type = this.options.type, photoData = {}, photosData = [], changedData = {}, albumField, albumValue, index, length, item; if (isNewAlbum) { albumField = 'album_title'; albumValue = this._albumTitle; } else { albumField = 'album_id'; albumValue = this._albumId; } if (action === 'sendMany' || action === 'removeAll') { for (index = 0, length = changedPhotosById.length; index < length; index++) { item = changedPhotosById[index]; if (action === 'removeAll') { photoData = { photo_id: item.photo_id, is_deleted: 1 }; } else if (type === 'add') { photoData = { photo_id: item.photo_id }; } else { photoData = item; delete photoData.photo_src; } photosData.push(photoData); } } else if (action === 'sendOne') { photosData.push(changedPhotosById[oneIndex]); } changedData.photos_data = photosData; if (type === 'upload') { changedData[albumField] = albumValue; changedData.privacy = this._privacy; changedData.action = this.options.action || 'upload'; } if (action === 'sendMany') { if (this.options.htmlOutput) { changedData.required_size = this._requiredSize; } else { changedData.redirect_to = (photosData.length > 1) ? 'album' : photosData[0].photo_id; } } changedData.type = type; this._changedData = JSON.stringify(changedData); }, /** * Serializes and sends data to server * * @param {string} action * @param {string} oneIndex */ _sendData: function(action, oneIndex) { var photouploader = this; this._saveAlbum(); this._saveSize(); this._savePrivacy(); this._togglePreloader('show'); this._serializeData(action, oneIndex); $.ajax(this.options.urls.sendDataTo, { type: 'POST', data : { data_to_update: this._changedData }, dataType: 'json', success: function(response) { var status = response.status; if (status === 'redirect') { window.location.href = response.url; } else { photouploader._togglePreloader('hide'); if (response.resizes_data && response.result) { // update default size value before reset // (need to save it for next dialog opening #LJSUP-12849) photouploader._sizeList.sizeSelect('updateDefault'); photouploader.element.trigger({ type: 'htmlready', htmlStrings: photouploader._makeHtml(response.resizes_data) }); } if (action === 'sendMany') { photouploader.hide(); } if (response.new_album_id) { photouploader._addNewAlbumToList(response.new_album_id); } } } }); }, /** * Add new album to list (album just created by user) * * @param {string} newAlbumId */ _addNewAlbumToList: function(newAlbumId) { var newAlbumItem = $(this.options.templates.albumList.common.supplant({ album_id: newAlbumId, album_title: this._newAlbumField.val() })), children = this._albumList.children(), idx = children.length - 1; newAlbumItem.insertBefore(children.last()); this._albumList.prop('selectedIndex', idx); this._newAlbumField.val('').focus(); this._newAlbumFieldWrapper.hide(); }, /** * Makes HTML for "htmlready" (with required sizes of images) * * @param {Object} resizedUrls * @return {Array} resultHtml */ _makeHtml: function(resizedUrls) { var data = this._changedPhotosById, // width and height attributes string for the image(s) attributes = this._sizeList.sizeSelect('attributes'), // selected value in the sizeList type = this._sizeList.sizeSelect('option', 'value'); if (this.options.type === 'paste') { return $.fotki.makePhotosHTML(resizedUrls, attributes); } else { return $.fotki.photosHTML(resizedUrls, data, { type: type, attributes: attributes, insertOriginalLink: this._originalLinkCheckbox.is(':checked') }); } }, _togglePreloader: function(action) { this._preloaderElem .toggleClass(this.options.classNames.preloader, action === 'show'); }, _saveAlbum: function() { var albumSelectedIndex = this._albumList.prop('selectedIndex'); // if last item in album select selected - we must create new album if (albumSelectedIndex === this._albumList.children().length - 1) { this._albumTitle = this._newAlbumField.val(); // else put photos in existing album } else { this._albumTitle = ''; this._albumId = this._albumList.val(); } }, _saveSize: function() { this._requiredSize = this._sizeList && this._sizeList.sizeSelect('selectedValue') || null; if (this._requiredSize === 'custom') { this._requiredSize = 'original'; } }, _savePrivacy: function() { this._privacy = this._privacyBubble.data('value') || 'public'; }, _updatePosition: function() { var leftPos = 0, wh; if ( $(window).width() < this._popupNode.width() ) { leftPos = -$(window).width()/2; } else { leftPos = - this._popupNode.width() / 2; } this._popupNode.css({ left: leftPos, top: $(window).scrollTop() + ($(window).height() * 0.1) }); wh = Math.floor($(window).height() * 0.6); if (wh < 300) { wh = 300; } // save wrapper max-height this._wrapperMaxHeight = wh; this._photoListWrapper.css({ maxHeight: wh }); }, /** * Show the photouploader dialog. */ show: function() { var self = this; LJ.Event.trigger('photouploader:show', this.options.type); // uncheck original link url checkbox on show this._originalLinkCheckbox.prop('checked', false); this._faderNode.show(); this._touchPixel('opendialog'); if (this.options.type === 'add' && this.options.insertPhotosCount === 'one') { this._photoList.find('img').bind('load', function () { self._updatePosition(); self._popupNode.show(); }); } else { this._updatePosition(); this._popupNode.show(); } if ( !this._hasFlash ) { this._hideUploadTab(); // explicitly change type option if (this.options.type === 'upload') { this._setOption('type', 'list'); } } return this; }, /** * Hide the photouploader dialog. */ hide: function() { this.reset(); this._faderNode.hide(); this._popupNode.hide(); this._currentGalleryId = null; return this; }, /** * Return the dialog to the initial state */ reset: function() { this.element.unbind('htmlready'); this._changedPhotosById = []; this._photoList.empty(); this._pasteImagePreview.empty(); this._pasteImageUrl.val(''); this._pasteImageLink.val(''); this._albumList.show(); this._currentGalleryId = null; if (this.options.htmlOutput) { this._sizeList.sizeSelect('reset'); } this._setOptions({ state: 'begin', progress: 0, coverItem: null }); return this; }, /** * Loads photo data (title, desc, etc.) to the form fields */ load: function() { var currentData = this._changedPhotosById[this.options.activeIndex]; if (!currentData) { return this; } this._titleField.val(currentData.photo_title); this._descField.val(currentData.photo_desc); this._linkField.val(currentData.photo_link); this._albumCoverCheckbox.prop('checked', !!currentData.is_cover); this._titleField.trigger('focus'); return this; }, /** * Adds item (photo preview) to the photo list and stores base data * (id, src and title) in array (_changedPhotosById) * * @param {Object} item */ addItem: function(item) { var photouploader = this, options = this.options, type = options.type, wrapper = this._photoListWrapper, newImageNode, newImage; switch (type) { case 'upload': // make image node newImageNode = LJ.UI.template(this.options.templates.uploadedItem, { photo_src: item.photo_src, type: type }) .data('id', item.photo_id) .appendTo(this._photoList); newImage = new Image(); // add callback to show new image node after load ends newImage.onload = function() { photouploader.index('last'); photouploader._setOption( 'insertPhotosCount', photouploader._changedPhotosById.length <= 5 ? 'several' : 'many' ); if ($.browser.opera) { newImageNode.show(); } else { newImageNode.fadeIn('fast'); } wrapper.scrollTop(wrapper[0].scrollHeight); photouploader.element.trigger('thumbnailLoaded'); }; newImage.src = item.photo_src; break; case 'list': newImageNode = LJ.UI.template(this.options.templates.insertedItem, { photo_url: item.photo_url, type: type, photo_id: item.photo_id, checked: '' }) .data('id', item.photo_id) .appendTo(this._photoList); this._listPhotosById.push({ photo_id: item.photo_id, photo_src: item.photo_url, photo_title: item.photo_title }); //this node should not appear between changed photos return; case 'add': newImageNode = LJ.UI.template(this.options.templates.insertedItem, { photo_url: item.photo_url, type: type, photo_id: item.photo_id, checked: ' checked="checked"' }) .data('id', item.photo_id) .appendTo(this._photoList); break; } wrapper.scrollTop(wrapper[0].scrollHeight); this._changedPhotosById.push({ photo_id: item.photo_id, photo_src: item.photo_src, photo_title: item.photo_title }); return this; }, updateCounters: function(counters) { this._setOptions(counters); return this; }, startUpload: function() { this._setOption('state', 'processing'); this._flashUploader.startUpload(); return this; }, makeActive: function(item) { this._setOption('activeItem', item); return this; }, /** * Removes all uploaded photos from photo list and from server * When we upload photos, but do not post them */ removeUploaded: function () { if ( this._changedPhotosById.length ) { this._sendData('removeAll'); } }, /** * Remove certain item from photo list (and from server) than shift photo list * and reset (if there are no items left in the list) * @function * * @param {jQuery} item Node of the image in the list to be removed. */ removeItem: (function () { function onFadeOut (widget, item, index) { var length = widget._changedPhotosById.length, options = widget.options; $(item).remove(); if (length === 0) { widget.reset(); switch (options.type) { case 'upload': widget._setOption('state', 'begin'); widget._stateContainer.removeClass( options.classNames.insertPhotosCountPrefix + options.insertPhotosCount ); break; case 'add': widget.hide(); break; } } else { widget._setOption('insertPhotosCount', length <= 5 ? 'several' : 'many'); } if (index === options.activeIndex) { widget.index(index === length ? -1 : 0); } widget.element.trigger({ type: 'removeitem' }); } return function(item) { var photouploader = this, options = this.options, currentIndex = this._getIndex(item); switch (options.type) { case 'upload': this._saveChanges('is_deleted', 1, currentIndex); this._sendData('sendOne', currentIndex); break; } this._changedPhotosById.splice(currentIndex, 1); if ($.browser.opera) { onFadeOut(photouploader, item, currentIndex); } else { item.fadeOut('fast', function() { onFadeOut(photouploader, item, currentIndex); }); } return this; }; })(), /** * Update widget internal data structures when user reorders photos * by drag n drop. Should be private. */ update: function(){ var list, item, items = {}, photouploader = this; if (this.options.type === 'list') { list = this._listPhotosById; } else { list = this._changedPhotosById; } while (item = list.shift()) { items[item.photo_id] = item; } this._photoList.children(':visible').each(function(){ list.push(items[$(this).data('id')]); if (photouploader.options.type !== 'list') { if($(this).hasClass('selected')){ photouploader._setOption('activeItem', $(this)); } } }); }, /** * Set the currently selected item in the dialog on the upload tab. */ index: function(value) { var nextIndex = this.options.activeIndex + value, items = this._photoList.children(':visible'), lastIndex = (items.length === 0) ? 0 : items.length - 1; if (value === 'first' || nextIndex > lastIndex) { nextIndex = 0; value = 'first'; } else if (value === 'last' || nextIndex < 0) { nextIndex = lastIndex; value = 'last'; } this.makeActive(items.eq(nextIndex)); }, /** * Get element index in the photolist (between visible items) * @param {jQuery} element jQuery item element * @return {Number} Item index */ _getIndex: function (element) { return this._photoList .children(':visible') .index(element); }, _touchPixel: function(name) { var prop = 'tracking_' + name, url = this.options[prop], pixel; if (url && url.length > 0) { pixel = new Image(); pixel.src = url + '&__rnd__' + Math.random(); } } }); })(jQuery, this); /** * Event is fired when user presses "Add to Post" button * in the dialog. * * @name $.lj.photouploader#htmlready * * @param {jQuery.Event} event jQuery event object. The object has custom htmlStrings * * @param {jQuery.Event} event jQuery event object. The object has custom htmlStrings * property, that holds the array with image tags of photos to be pasted * property, that holds the array with image tags of photos to be pasted. * * @event */ ; /* file-end: js/jquery/jquery.lj.photouploader.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/jquery/jquery.lj.ljcut.js */ /** * @author Valeriy Vasin (valeriy.vasin@sup.com) * @name $.lj.ljcut * @requires $.ui.core, $.ui.widget, $.lj.basicWidget, LJ * @class The widget is responsible for expanding cuts */ ;(function ($) { "use strict"; $.widget('lj.ljcut', $.lj.basicWidget, { options: { // journal identifier (comes from server) journalid: null, // post identifier (comes from server) ditemid: null, // cut identifier inside of the post (comes from server) cutid: null, // server request param: use placeholders or not (1 or 0). Comes from server placeholders: 0, selectors: { expand: '.ljcut-link-expand', collapse: '.ljcut-link-collapse' }, classNames: { preloader: 'ljcut-link-expanding', expanded: 'ljcut-expanded' } }, _create: function () { $.lj.basicWidget.prototype._create.apply(this); // jQuery element that will contain loaded content of the cut this.content = null; // test OS for Mac this._isMac = (/Mac/).test(navigator.userAgent); // $.browser.opera is deprecated this._isOpera = (/Opera/.test(navigator.userAgent)); this._bindControls(); }, _bindControls: function () { $.lj.basicWidget.prototype._bindControls.apply(this); this.element.on('click', this._s('expand'), this._expand.bind(this)); this.element.on('click', this._s('collapse'), this._collapse.bind(this)); $(document).on('keydown', this._shortcuts.bind(this)); }, /** * Shortcuts handler * @param {Object} e jQuery event object */ _shortcuts: function (e) { var ctrl = (this._isMac && this._isOpera) ? e.metaKey : e.ctrlKey, alt = e.altKey; if (!ctrl || !alt) { return; } switch (e.which) { // expand: ctrl + alt + "+" case 61: // FireFox, IE // fall through case 187: // Opera, Chrome, Safari this.expand(); break; // collapse: ctrl + alt + "-" case 173: // FireFox // fall through case 31: // Opera Mac // fall through case 109: // Opera Windows // fall through case 189: // Chrome, Safari this.collapse(); break; // no default } e.preventDefault(); }, /** * Show or hide preloader * @param {Boolean} state Preloader state: True (show) or False (hide) */ _togglePreloader: function (state) { this.element.toggleClass( this._cl('preloader'), state ); }, /** * Toggle content state * @param {Boolean} state State of content: expand (true) or collapse (false) */ _toggleContent: function (state, callback) { var that = this; if (this.locked() || !this.content) { return; } this._lock(); if (typeof callback !== 'function') { callback = $.noop; } that.element.toggleClass( that._cl('expanded'), state ); if (state) { this.content.slideDown('fast', function () { that._trigger('show', null, that); callback(); that._unlock(); }); } else { this.content.slideUp(50, function () { that._trigger('hide', null, that); callback(); that._unlock(); }); } }, /** * Request server for the cut content * @param {Object} data Data that is needed for request */ _requestContent: function (data) { var that = this; this._lock(); this._togglePreloader(true); LJ.Api.call('event.get_lj_cut', data, function (response) { that.content = $('
    ', { html: response.text }).hide(); that.element.after( that.content ); that._unlock(); that._togglePreloader(false); // add handlers after content becomes visible that._toggleContent(true, that._addHandlers.bind(that)); // statistic if (response.counter_image_url) { LJ.Stat.addCounter(response.counter_image_url); } }); }, /** * Provide dynamic behavior for the content (javascript handlers) * @private */ _addHandlers: function () { this.content.ljLikes(); }, /** * Expand content */ expand: function () { if ( this.locked() ) { return; } if ( this.content ) { this._toggleContent(true); } else { this._requestContent({ journalid: this.options.journalid, ditemid: this.options.ditemid, cutid: this.options.cutid, placeholders: this.options.placeholders }); } }, /** * Collapse content (for external usage) */ collapse: function () { if ( !this.locked() ) { this._toggleContent(false); } }, /** * Expand link click handler * @param {Object} e jQuery event object */ _expand: function (e) { // open link in new tab if (e.metaKey || e.ctrlKey) { return true; } e.preventDefault(); this.expand(); }, /** * Collapse link click handler * @param {Object} e jQuery event object */ _collapse: function (e) { // open link in new tab if (e.metaKey || e.ctrlKey) { return true; } e.preventDefault(); this.collapse(); } }); }(jQuery)); ; /* file-end: js/jquery/jquery.lj.ljcut.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/entry/main.js */ /* --------------------------------------------------------------------------------- file-start: js/lib/angular/1.2.0-rc.2/angular.min.js */ /* AngularJS v1.2.0-rc.2 (c) 2010-2012 Google, Inc. http://angularjs.org License: MIT */ (function(Y,T,s){'use strict';function P(a){return function(){var b=arguments[0],c,b="["+(a?a+":":"")+b+"] http://errors.angularjs.org/undefined/"+(a?a+"/":"")+b;for(c=1;c").append(a).html();try{return 3===a[0].nodeType?J(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(b,a){return"<"+J(a)})}catch(d){return J(c)}}function Jb(a){try{return decodeURIComponent(a)}catch(b){}}function Kb(a){var b={},c,d;q((a||"").split("&"),function(a){a&&(c=a.split("="),d=Jb(c[0]),z(d)&&(a=z(c[1])? Jb(c[1]):!0,b[d]?D(b[d])?b[d].push(a):b[d]=[b[d],a]:b[d]=a))});return b}function Lb(a){var b=[];q(a,function(a,d){D(a)?q(a,function(a){b.push(ua(d,!0)+(!0===a?"":"="+ua(a,!0)))}):b.push(ua(d,!0)+(!0===a?"":"="+ua(a,!0)))});return b.length?b.join("&"):""}function ob(a){return ua(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function ua(a,b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,b?"%20":"+")} function Hc(a,b){function c(a){a&&d.push(a)}var d=[a],e,g,h=["ng:app","ng-app","x-ng-app","data-ng-app"],f=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;q(h,function(b){h[b]=!0;c(T.getElementById(b));b=b.replace(":","\\:");a.querySelectorAll&&(q(a.querySelectorAll("."+b),c),q(a.querySelectorAll("."+b+"\\:"),c),q(a.querySelectorAll("["+b+"]"),c))});q(d,function(b){if(!e){var a=f.exec(" "+b.className+" ");a?(e=b,g=(a[2]||"").replace(/\s+/g,",")):q(b.attributes,function(a){!e&&h[a.name]&&(e=b,g=a.value)})}}); e&&b(e,g?[g]:[])}function Mb(a,b){var c=function(){a=w(a);if(a.injector()){var c=a[0]===T?"document":ia(a);throw Wa("btstrpd",c);}b=b||[];b.unshift(["$provide",function(b){b.value("$rootElement",a)}]);b.unshift("ng");c=Nb(b);c.invoke(["$rootScope","$rootElement","$compile","$injector","$animate",function(b,a,c,d,e){b.$apply(function(){a.data("$injector",d);c(a)(b)});e.enabled(!0)}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;if(Y&&!d.test(Y.name))return c();Y.name=Y.name.replace(d,"");Ha.resumeBootstrap= function(a){q(a,function(a){b.push(a)});c()}}function pb(a,b){b=b||"_";return a.replace(Ic,function(a,d){return(d?b:"")+a.toLowerCase()})}function qb(a,b,c){if(!a)throw Wa("areq",b||"?",c||"required");return a}function Ia(a,b,c){c&&D(a)&&(a=a[a.length-1]);qb(B(a),b,"not a function, got "+(a&&"object"==typeof a?a.constructor.name||"Object":typeof a));return a}function rb(a,b,c){if(!b)return a;b=b.split(".");for(var d,e=a,g=b.length,h=0;h 
    "+a;b.removeChild(b.firstChild);ub(this,b.childNodes);w(T.createDocumentFragment()).append(this)}else ub(this, a)}function vb(a){return a.cloneNode(!0)}function Ka(a){Ob(a);var b=0;for(a=a.childNodes||[];b=Q?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)}; c.elem=a;return c}function za(a){var b=typeof a,c;"object"==b&&null!==a?"function"==typeof(c=a.$$hashKey)?c=a.$$hashKey():c===s&&(c=a.$$hashKey=Ta()):c=a;return b+":"+c}function Ma(a){q(a,this.put,this)}function Wb(a){var b,c;"function"==typeof a?(b=a.$inject)||(b=[],a.length&&(c=a.toString().replace(Oc,""),c=c.match(Pc),q(c[1].split(Qc),function(a){a.replace(Rc,function(a,c,d){b.push(d)})})),a.$inject=b):D(a)?(c=a.length-1,Ia(a[c],"fn"),b=a.slice(0,c)):Ia(a,"fn",!0);return b}function Nb(a){function b(a){return function(b, c){if(U(b))q(b,Gb(a));else return a(b,c)}}function c(a,b){if(B(b)||D(b))b=p.instantiate(b);if(!b.$get)throw Na("pget",a);return m[a+f]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[];q(a,function(a){if(!l.get(a)){l.put(a,!0);try{if(H(a)){var c=Oa(a);b=b.concat(e(c.requires)).concat(c._runBlocks);for(var d=c._invokeQueue,c=0,f=d.length;c 4096 bytes)!"));else{if(k.cookie!==ba)for(ba=k.cookie,d=ba.split("; "),Z={},f=0;fl&&this.remove(n.key),b},get:function(a){var b=m[a];if(b)return e(b),k[a]},remove:function(a){var b=m[a];b&&(b==p&&(p=b.p),b==n&&(n=b.n),g(b.n,b.p),delete m[a],delete k[a],h--)},removeAll:function(){k={};h=0;m={};p=n=null},destroy:function(){m=f=k=null;delete b[a]},info:function(){return E({},f,{size:h})}}}var b={};a.info=function(){var a={};q(b,function(b,e){a[e]=b.info()});return a};a.get=function(a){return b[a]};return a}} function Xc(){this.$get=["$cacheFactory",function(a){return a("templates")}]}function Xb(a){var b={},c="Directive",d=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,e=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,g=/^\s*(https?|ftp|mailto|file):/,h=/^\s*(https?|ftp|file):|data:image\//,f=/^(on[a-z]*|formaction)$/;this.directive=function l(d,e){H(d)?(qb(e,"directiveFactory"),b.hasOwnProperty(d)||(b[d]=[],a.factory(d+c,["$injector","$exceptionHandler",function(a,c){var e=[];q(b[d],function(b){try{var f=a.invoke(b);B(f)? f={compile:$(f)}:!f.compile&&f.link&&(f.compile=$(f.link));f.priority=f.priority||0;f.name=f.name||d;f.require=f.require||f.controller&&f.name;f.restrict=f.restrict||"A";e.push(f)}catch(g){c(g)}});return e}])),b[d].push(e)):q(d,Gb(l));return this};this.aHrefSanitizationWhitelist=function(a){return z(a)?(g=a,this):g};this.imgSrcSanitizationWhitelist=function(a){return z(a)?(h=a,this):h};this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope", "$document","$sce","$$urlUtils","$animate",function(a,m,p,n,t,r,y,x,R,N,u,v){function F(a,b,c,d){a instanceof w||(a=w(a));q(a,function(b,c){3==b.nodeType&&b.nodeValue.match(/\S+/)&&(a[c]=w(b).wrap("").parent()[0])});var e=Z(a,b,a,c,d);return function(b,c){qb(b,"scope");for(var d=c?Pa.clone.call(a):a,f=0,g=d.length;fu.priority)break;if(O=u.scope)C("isolated scope",v,u,K),U(O)&&(I(K,"ng-isolate-scope"),v=u),I(K,"ng-scope"),x=x||u;R=u.name;if(O=u.controller)pa= pa||{},C("'"+R+"' controller",pa[R],u,K),pa[R]=u;if(O=u.transclude)C("transclusion",N,u,K),N=u,n=u.priority,"element"==O?(O=W(b,A,z),K=c.$$element=w(T.createComment(" "+R+": "+c[R]+" ")),b=K[0],bb(e,w(ta.call(O,0)),b),qa=F(O,d,n,f&&f.name)):(O=w(vb(b)).contents(),K.html(""),qa=F(O,d));if(u.template)if(C("template",G,u,K),G=u,O=B(u.template)?u.template(K,c):u.template,O=Yb(O),u.replace){f=u;O=w("
    "+aa(O)+"
    ").contents();b=O[0];if(1!=O.length||1!==b.nodeType)throw ga("tplrt",R,"");bb(e,K,b); ma={$attr:{}};a=a.concat(ba(b,a.splice(L+1,a.length-(L+1)),ma));ab(c,ma);ma=a.length}else K.html(O);if(u.templateUrl)C("template",G,u,K),G=u,u.replace&&(f=u),l=Uc(a.splice(L,a.length-L),l,K,c,e,qa),ma=a.length;else if(u.compile)try{ka=u.compile(K,c,qa),B(ka)?g(null,ka,A,z):ka&&g(ka.pre,ka.post,A,z)}catch(E){p(E,ia(K))}u.terminal&&(l.terminal=!0,n=Math.max(n,u.priority))}l.scope=x&&x.scope;l.transclude=N&&qa;return l}function G(d,e,f,g,h,n,m){if(e===h)return null;h=null;if(b.hasOwnProperty(e)){var t; e=a.get(e+c);for(var r=0,C=e.length;rt.priority)&&-1!=t.restrict.indexOf(f)&&(n&&(t=Cc(t,{$$start:n,$$end:m})),d.push(t),h=t)}catch(u){p(u)}}return h}function ab(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;q(a,function(d,e){"$"!=e.charAt(0)&&(b[e]&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});q(b,function(b,f){"class"==f?(I(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):"style"==f?e.attr("style",e.attr("style")+";"+b):"$"==f.charAt(0)||a.hasOwnProperty(f)|| (a[f]=b,d[f]=c[f])})}function Uc(a,b,c,d,e,f){var g=[],h,p,l=c[0],m=a.shift(),r=E({},m,{controller:null,templateUrl:null,transclude:null,scope:null,replace:null}),C=B(m.templateUrl)?m.templateUrl(c,d):m.templateUrl;c.html("");n.get(N.getTrustedResourceUrl(C),{cache:t}).success(function(n){var t;n=Yb(n);if(m.replace){n=w("
    "+aa(n)+"
    ").contents();t=n[0];if(1!=n.length||1!==t.nodeType)throw ga("tplrt",m.name,C);n={$attr:{}};bb(e,c,t);ba(t,a,n);ab(d,n)}else t=l,c.html(n);a.unshift(r);h=ka(a, t,d,f,c,m);q(e,function(a,b){a==t&&(e[b]=c[0])});for(p=Z(c[0].childNodes,f);g.length;){n=g.shift();var u=g.shift(),y=g.shift(),I=g.shift(),x=c[0];u!==l&&(x=vb(t),bb(y,w(u),x));h(b(p,n,x,e,I),n,x,e,I)}g=null}).error(function(a,b,c,d){throw ga("tpload",d.url);});return function(a,c,d,e,f){g?(g.push(c),g.push(d),g.push(e),g.push(f)):h(function(){b(p,c,d,e,f)},c,d,e,f)}}function L(a,b){return b.priority-a.priority}function C(a,b,c,d){if(b)throw ga("multidir",b.name,c.name,a,ia(d));}function K(a,b){var c= m(b,!0);c&&a.push({priority:0,compile:$(function(a,b){var d=b.parent(),e=d.data("$binding")||[];e.push(c);I(d.data("$binding",e),"ng-binding");a.$watch(c,function(a){b[0].nodeValue=a})})})}function O(a,b){if("xlinkHref"==b||"IMG"!=Aa(a)&&("src"==b||"ngSrc"==b))return N.RESOURCE_URL}function pa(a,b,c,d){var e=m(c,!0);if(e){if("multiple"===d&&"SELECT"===Aa(a))throw ga("selmulti",ia(a));b.push({priority:100,compile:$(function(b,c,g){c=g.$$observers||(g.$$observers={});if(f.test(d))throw ga("nodomevents"); if(e=m(g[d],!0,O(a,d)))g[d]=e(b),(c[d]||(c[d]=[])).$$inter=!0,(g.$$observers&&g.$$observers[d].$$scope||b).$watch(e,function(a){g.$set(d,a)})})})}}function bb(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;ga.status?b:p.reject(b)}var d={transformRequest:e.transformRequest,transformResponse:e.transformResponse},f=function(a){function b(a){var c;q(a,function(b,d){B(b)&&(c=b(),null!=c?a[d]=c:delete a[d])})}var c=e.headers,d=E({},a.headers),f,g,c=E({},c.common,c[J(a.method)]);b(c);b(d);a:for(f in c){a=J(f);for(g in d)if(J(g)===a)continue a;d[f]=c[f]}return d}(a);E(d,a);d.headers=f;d.method=Ba(d.method);(a=t.isSameOrigin(d.url)?b.cookies()[d.xsrfCookieName||e.xsrfCookieName]:s)&&(f[d.xsrfHeaderName|| e.xsrfHeaderName]=a);var g=[function(a){f=a.headers;var b=ac(a.data,$b(f),a.transformRequest);M(a.data)&&q(f,function(a,b){"content-type"===J(b)&&delete f[b]});M(a.withCredentials)&&!M(e.withCredentials)&&(a.withCredentials=e.withCredentials);return y(a,b,f).then(c,c)},s],h=p.when(d);for(q(N,function(a){(a.request||a.requestError)&&g.unshift(a.request,a.requestError);(a.response||a.responseError)&&g.push(a.response,a.responseError)});g.length;){a=g.shift();var n=g.shift(),h=h.then(a,n)}h.success= function(a){h.then(function(b){a(b.data,b.status,b.headers,d)});return h};h.error=function(a){h.then(null,function(b){a(b.data,b.status,b.headers,d)});return h};return h}function y(b,c,g){function k(a,b,c){y&&(200<=a&&300>a?y.put(s,[a,b,Zb(c)]):y.remove(s));h(b,a,c);d.$$phase||d.$apply()}function h(a,c,d){c=Math.max(c,0);(200<=c&&300>c?l.resolve:l.reject)({data:a,status:c,headers:$b(d),config:b})}function n(){var a=Va(r.pendingRequests,b);-1!==a&&r.pendingRequests.splice(a,1)}var l=p.defer(),t=l.promise, y,q,s=x(b.url,b.params);r.pendingRequests.push(b);t.then(n,n);(b.cache||e.cache)&&(!1!==b.cache&&"GET"==b.method)&&(y=U(b.cache)?b.cache:U(e.cache)?e.cache:R);if(y)if(q=y.get(s),z(q)){if(q.then)return q.then(n,n),q;D(q)?h(q[1],q[0],da(q[2])):h(q,200,{})}else y.put(s,t);M(q)&&a(b.method,s,c,k,g,b.timeout,b.withCredentials,b.responseType);return t}function x(a,b){if(!b)return a;var c=[];Bc(b,function(a,b){null!=a&&a!=s&&(D(a)||(a=[a]),q(a,function(a){U(a)&&(a=oa(a));c.push(ua(b)+"="+ua(a))}))});return a+ (-1==a.indexOf("?")?"?":"&")+c.join("&")}var R=c("$http"),N=[];q(g,function(a){N.unshift(H(a)?n.get(a):n.invoke(a))});q(h,function(a,b){var c=H(a)?n.get(a):n.invoke(a);N.splice(b,0,{response:function(a){return c(p.when(a))},responseError:function(a){return c(p.reject(a))}})});r.pendingRequests=[];(function(a){q(arguments,function(a){r[a]=function(b,c){return r(E(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){q(arguments,function(a){r[a]=function(b,c,d){return r(E(d||{}, {method:a,url:b,data:c}))}})})("post","put");r.defaults=e;return r}]}function cd(){this.$get=["$browser","$window","$document",function(a,b,c){return dd(a,ed,a.defer,b.angular.callbacks,c[0],b.location.protocol.replace(":",""))}]}function dd(a,b,c,d,e,g){function h(a,b){var c=e.createElement("script"),d=function(){e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;Q?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:c.onload=c.onerror=d;e.body.appendChild(c);return d} return function(e,k,l,m,p,n,t,r){function y(){R=-1;u&&u();v&&v.abort()}function x(b,d,e,f){var h=(k.match(bc)||["",g])[1];F&&c.cancel(F);u=v=null;d="file"==h?e?200:404:d;b(1223==d?204:d,e,f);a.$$completeOutstandingRequest(A)}var R;a.$$incOutstandingRequestCount();k=k||a.url();if("jsonp"==J(e)){var s="_"+(d.counter++).toString(36);d[s]=function(a){d[s].data=a};var u=h(k.replace("JSON_CALLBACK","angular.callbacks."+s),function(){d[s].data?x(m,200,d[s].data):x(m,R||-2);delete d[s]})}else{var v=new b; v.open(e,k,!0);q(p,function(a,b){a&&v.setRequestHeader(b,a)});v.onreadystatechange=function(){if(4==v.readyState){var a=v.getAllResponseHeaders(),b="Cache-Control Content-Language Content-Type Expires Last-Modified Pragma".split(" ");a||(a="",q(b,function(b){var c=v.getResponseHeader(b);c&&(a+=b+": "+c+"\n")}));x(m,R||v.status,v.responseType?v.response:v.responseText,a)}};t&&(v.withCredentials=!0);r&&(v.responseType=r);v.send(l||"")}if(0=a}function g(a){return" "==a||"\r"==a||"\t"==a||"\n"==a||"\v"==a||"\u00a0"==a}function h(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"==a||"$"==a}function f(a){return"-"==a||"+"==a||e(a)}function k(b,c,d){d=d||r;c=z(c)?"s "+c+"-"+r+" ["+a.substring(c,d)+"]":" "+d;throw Ra("lexerr",b,c,a);}function l(){for(var b= "",c=r;r","<=",">="))a=p(a,b.fn,N());return a}function u(){for(var a=v(),b;b=f("*","/","%");)a=p(a,b.fn,v());return a}function v(){var a;return f("+")?F():(a=f("-"))?p(ba,a.fn,v()):(a=f("!"))?l(a.fn,v()):F()}function F(){var a; if(f("("))a=L(),k(")");else if(f("["))a=I();else if(f("{"))a=w();else{var b=f();(a=b.fn)||e("not a primary expression",b);b.json&&(a.constant=a.literal=!0)}for(var c;b=f("(","[",".");)"("===b.text?(a=G(a,c),c=null):"["===b.text?(c=a,a=D(a)):"."===b.text?(c=a,a=H(a)):e("IMPOSSIBLE");return a}function I(){var a=[],b=!0;if("]"!=g().text){do{var c=z();a.push(c);c.constant||(b=!1)}while(f(","))}k("]");return E(function(b,c){for(var d=[],e=0;ee?mc(d[0],d[1], d[2],d[3],d[4],c):function(a,b){var g=0,l;do l=mc(d[g++],d[g++],d[g++],d[g++],d[g++],c)(a,b),b=s,a=l;while(ga)for(b in g++,d)d.hasOwnProperty(b)&&!f.hasOwnProperty(b)&&(m--,delete d[b])}else d!== f&&(d=f,g++);return g},function(){b(f,d,c)})},$digest:function(){var c,e,g,h,k=this.$$asyncQueue,q=this.$$postDigestQueue,s,N,u=a,v,F=[],I,z;f("$digest");do{N=!1;for(v=this;k.length;)try{v.$eval(k.shift())}catch(ba){d(ba)}do{if(h=v.$$watchers)for(s=h.length;s--;)try{(c=h[s])&&((e=c.get(v))!==(g=c.last)&&!(c.eq?xa(e,g):"number"==typeof e&&"number"==typeof g&&isNaN(e)&&isNaN(g)))&&(N=!0,c.last=c.eq?da(e):e,c.fn(e,g===l?e:g,v),5>u&&(I=4-u,F[I]||(F[I]=[]),z=B(c.exp)?"fn: "+(c.exp.name||c.exp.toString()): c.exp,z+="; newVal: "+oa(e)+"; oldVal: "+oa(g),F[I].push(z)))}catch(W){d(W)}if(!(h=v.$$childHead||v!==this&&v.$$nextSibling))for(;v!==this&&!(h=v.$$nextSibling);)v=v.$parent}while(v=h);if(N&&!u--)throw m.$$phase=null,b("infdig",a,oa(F));}while(N||k.length);for(m.$$phase=null;q.length;)try{q.shift()()}catch(w){d(w)}},$destroy:function(){if(m!=this&&!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;a.$$childHead==this&&(a.$$childHead=this.$$nextSibling);a.$$childTail== this&&(a.$$childTail=this.$$prevSibling);this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling);this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling);this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null}},$eval:function(a,b){return e(a)(this,b)},$evalAsync:function(a){m.$$phase||m.$$asyncQueue.length||g.defer(function(){m.$$asyncQueue.length&&m.$digest()});this.$$asyncQueue.push(a)},$$postDigest:function(a){this.$$postDigestQueue.push(a)}, $apply:function(a){try{return f("$apply"),this.$eval(a)}catch(b){d(b)}finally{m.$$phase=null;try{m.$digest()}catch(c){throw d(c),c;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);return function(){c[Va(c,b)]=null}},$emit:function(a,b){var c=[],e,f=this,g=!1,h={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=[h].concat(ta.call(arguments,1)),l,m;do{e=f.$$listeners[a]||c;h.currentScope= f;l=0;for(m=e.length;lc))throw Ca("iequirks");var e=da(fa);e.isEnabled=function(){return a};e.trustAs=d.trustAs;e.getTrusted=d.getTrusted;e.valueOf=d.valueOf;a||(e.trustAs=e.getTrusted=function(a,b){return b},e.valueOf=wa);e.parseAs=function(a,c){var d=b(c);return d.literal&& d.constant?d:function(b,c){return e.getTrusted(a,d(b,c))}};var g=e.parseAs,h=e.getTrusted,f=e.trustAs;Ha.forEach(fa,function(a,b){var c=J(b);e[Ja("parse_as_"+c)]=function(b){return g(a,b)};e[Ja("get_trusted_"+c)]=function(b){return h(a,b)};e[Ja("trust_as_"+c)]=function(b){return f(a,b)}});return e}]}function td(){this.$get=["$window","$document",function(a,b){var c={},d=V((/android (\d+)/.exec(J((a.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((a.navigator||{}).userAgent),g=b[0]||{},h,f=/^(Moz|webkit|O|ms)(?=[A-Z])/, k=g.body&&g.body.style,l=!1,m=!1;if(k){for(var p in k)if(l=f.exec(p)){h=l[0];h=h.substr(0,1).toUpperCase()+h.substr(1);break}h||(h="WebkitOpacity"in k&&"webkit");l=!!("transition"in k||h+"Transition"in k);m=!!("animation"in k||h+"Animation"in k);!d||l&&m||(l=H(g.body.style.webkitTransition),m=H(g.body.style.webkitAnimation))}return{history:!(!a.history||!a.history.pushState||4>d||e),hashchange:"onhashchange"in a&&(!g.documentMode||7=Q&&(b.setAttribute("href",g),g=b.href);b.setAttribute("href",g);return c?{href:b.href,protocol:b.protocol,host:b.host}:b.href}var b=T.createElement("a"),c=a(Y.location.href,!0);return{resolve:a,isSameOrigin:function(b){b="string"===typeof b?a(b,!0):b;return b.protocol===c.protocol&&b.host===c.host}}}]}function wd(){this.$get= $(Y)}function nc(a){function b(b,e){return a.factory(b+c,e)}var c="Filter";this.register=b;this.$get=["$injector",function(a){return function(b){return a.get(b+c)}}];b("currency",oc);b("date",pc);b("filter",xd);b("json",yd);b("limitTo",zd);b("lowercase",Ad);b("number",qc);b("orderBy",rc);b("uppercase",Bd)}function xd(){return function(a,b,c){if(!D(a))return a;var d=[];d.check=function(a){for(var b=0;ba;a=Math.abs(a);var h=a+"",f="",k=[],l=!1;if(-1!==h.indexOf("e")){var m=h.match(/([\d\.]+)e(-?)(\d+)/);m&&"-"==m[2]&&m[3]>e+1?h="0":(f=h,l=!0)}if(l)0a)&&(f=a.toFixed(e));else{h=(h.split(tc)[1]||"").length;M(e)&&(e=Math.min(Math.max(b.minFrac,h),b.maxFrac)); h=Math.pow(10,e);a=Math.round(a*h)/h;a=(""+a).split(tc);h=a[0];a=a[1]||"";var l=0,m=b.lgSize,p=b.gSize;if(h.length>=m+p)for(var l=h.length-m,n=0;na&&(d="-",a=-a);for(a=""+a;a.length-c)e+=c;0===e&&-12==c&&(e=12);return Cb(e,b,d)}}function eb(a,b){return function(c,d){var e=c["get"+a](),g=Ba(b?"SHORT"+a:a);return d[g][e]}}function pc(a){function b(a){var b;if(b=a.match(c)){a=new Date(0);var g=0,h=0,f=b[8]?a.setUTCFullYear:a.setFullYear,k=b[8]?a.setUTCHours:a.setHours;b[9]&&(g=V(b[9]+b[10]),h=V(b[9]+b[11]));f.call(a,V(b[1]),V(b[2])-1,V(b[3]));g=V(b[4]||0)-g;h=V(b[5]||0)-h;f=V(b[6]||0);b=Math.round(1E3* parseFloat("0."+(b[7]||0)));k.call(a,g,h,f,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e){var g="",h=[],f,k;e=e||"mediumDate";e=a.DATETIME_FORMATS[e]||e;H(c)&&(c=Cd.test(c)?V(c):b(c));lb(c)&&(c=new Date(c));if(!Ea(c))return c;for(;e;)(k=Dd.exec(e))?(h=h.concat(ta.call(k,1)),e=h.pop()):(h.push(e),e=null);q(h,function(b){f=Ed[b];g+=f?f(c,a.DATETIME_FORMATS):b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}} function yd(){return function(a){return oa(a,!0)}}function zd(){return function(a,b){if(!D(a)&&!H(a))return a;b=V(b);if(H(a))return b?0<=b?a.slice(0,b):a.slice(b,a.length):"";var c=[],d,e;b>a.length?b=a.length:b<-a.length&&(b=-a.length);0a||37<=a&&40>=a)||k()});b.on("change",h);if(e.hasEvent("paste"))b.on("paste cut",k)}d.$render=function(){b.val(ca(d.$viewValue)?"":d.$viewValue)};var l=c.ngPattern,m=function(a,b){if(ca(b)||a.test(b))return d.$setValidity("pattern", !0),b;d.$setValidity("pattern",!1);return s};l&&((e=l.match(/^\/(.*)\/([gim]*)$/))?(l=RegExp(e[1],e[2]),e=function(a){return m(l,a)}):e=function(c){var d=a.$eval(l);if(!d||!d.test)throw P("ngPattern")("noregexp",l,d,ia(b));return m(d,c)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var p=V(c.ngMinlength);e=function(a){if(!ca(a)&&a.lengthn)return d.$setValidity("maxlength",!1),s;d.$setValidity("maxlength",!0);return a};d.$parsers.push(e);d.$formatters.push(e)}}function Db(a,b){a="ngClass"+a;return function(){return{restrict:"AC",link:function(c,d,e){function g(a){if(!0===b||c.$index%2===b)f&&!xa(a,f)&&e.$removeClass(h(f)),e.$addClass(h(a));f=da(a)}function h(a){if(D(a))return a.join(" ");if(U(a)){var b=[];q(a,function(a,c){a&&b.push(c)});return b.join(" ")}return a}var f=s;c.$watch(e[a], g,!0);e.$observe("class",function(b){g(c.$eval(e[a]))});"ngClass"!==a&&c.$watch("$index",function(d,f){var g=d&1;g!==f&1&&(g===b?(g=c.$eval(e[a]),e.$addClass(h(g))):(g=c.$eval(e[a]),e.$removeClass(h(g))))})}}}}var J=function(a){return H(a)?a.toLowerCase():a},Ba=function(a){return H(a)?a.toUpperCase():a},Q,w,ya,ta=[].slice,Fd=[].push,Ua=Object.prototype.toString,Wa=P("ng"),Ha=Y.angular||(Y.angular={}),Oa,Aa,ha=["0","0","0"];Q=V((/msie (\d+)/.exec(J(navigator.userAgent))||[])[1]);isNaN(Q)&&(Q=V((/trident\/.*; rv:(\d+)/.exec(J(navigator.userAgent))|| [])[1]));A.$inject=[];wa.$inject=[];var aa=function(){return String.prototype.trim?function(a){return H(a)?a.trim():a}:function(a){return H(a)?a.replace(/^\s*/,"").replace(/\s*$/,""):a}}();Aa=9>Q?function(a){a=a.nodeName?a:a[0];return a.scopeName&&"HTML"!=a.scopeName?Ba(a.scopeName+":"+a.nodeName):a.nodeName}:function(a){return a.nodeName?a.nodeName:a[0].nodeName};var Ic=/[A-Z]/g,Gd={full:"1.2.0-rc.2",major:1,minor:2,dot:0,codeName:"barehand-atomsplitting"},La=S.cache={},Xa=S.expando="ng-"+(new Date).getTime(), Mc=1,vc=Y.document.addEventListener?function(a,b,c){a.addEventListener(b,c,!1)}:function(a,b,c){a.attachEvent("on"+b,c)},wb=Y.document.removeEventListener?function(a,b,c){a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent("on"+b,c)},Kc=/([\:\-\_]+(.))/g,Lc=/^moz([A-Z])/,tb=P("jqLite"),Pa=S.prototype={ready:function(a){function b(){c||(c=!0,a())}var c=!1;"complete"===T.readyState?setTimeout(b):(this.on("DOMContentLoaded",b),S(Y).on("load",b))},toString:function(){var a=[];q(this,function(b){a.push(""+ b)});return"["+a.join(", ")+"]"},eq:function(a){return 0<=a?w(this[a]):w(this[this.length+a])},length:0,push:Fd,sort:[].sort,splice:[].splice},$a={};q("multiple selected checked disabled readOnly required open".split(" "),function(a){$a[J(a)]=a});var Vb={};q("input select option textarea button form details".split(" "),function(a){Vb[Ba(a)]=!0});q({data:Qb,inheritedData:Za,scope:function(a){return Za(a,"$scope")},controller:Tb,injector:function(a){return Za(a,"$injector")},removeAttr:function(a,b){a.removeAttribute(b)}, hasClass:Ya,css:function(a,b,c){b=Ja(b);if(z(c))a.style[b]=c;else{var d;8>=Q&&(d=a.currentStyle&&a.currentStyle[b],""===d&&(d="auto"));d=d||a.style[b];8>=Q&&(d=""===d?s:d);return d}},attr:function(a,b,c){var d=J(b);if($a[d])if(z(c))c?(a[b]=!0,a.setAttribute(b,d)):(a[b]=!1,a.removeAttribute(d));else return a[b]||(a.attributes.getNamedItem(b)||A).specified?d:s;else if(z(c))a.setAttribute(b,c);else if(a.getAttribute)return a=a.getAttribute(b,2),null===a?s:a},prop:function(a,b,c){if(z(c))a[b]=c;else return a[b]}, text:function(){function a(a,d){var e=b[a.nodeType];if(M(d))return e?a[e]:"";a[e]=d}var b=[];9>Q?(b[1]="innerText",b[3]="nodeValue"):b[1]=b[3]="textContent";a.$dv="";return a}(),val:function(a,b){if(M(b)){if("SELECT"===Aa(a)&&a.multiple){var c=[];q(a.options,function(a){a.selected&&c.push(a.value||a.text)});return 0===c.length?null:c}return a.value}a.value=b},html:function(a,b){if(M(b))return a.innerHTML;for(var c=0,d=a.childNodes;c":function(b,c,d,e){return d(b,c)>e(b,c)},"<=":function(b,c,d,e){return d(b,c)<=e(b,c)},">=":function(b,c,d,e){return d(b,c)>=e(b,c)},"&&":function(b,c,d,e){return d(b,c)&&e(b,c)},"||":function(b,c,d,e){return d(b, c)||e(b,c)},"&":function(b,c,d,e){return d(b,c)&e(b,c)},"|":function(b,c,d,e){return e(b,c)(b,c,d(b,c))},"!":function(b,c,d){return!d(b,c)}},ld={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Bb={},Ca=P("$sce"),fa={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"};nc.$inject=["$provide"];oc.$inject=["$locale"];qc.$inject=["$locale"];var tc=".",Ed={yyyy:X("FullYear",4),yy:X("FullYear",2,0,!0),y:X("FullYear",1),MMMM:eb("Month"),MMM:eb("Month",!0),MM:X("Month",2,1),M:X("Month", 1,1),dd:X("Date",2),d:X("Date",1),HH:X("Hours",2),H:X("Hours",1),hh:X("Hours",2,-12),h:X("Hours",1,-12),mm:X("Minutes",2),m:X("Minutes",1),ss:X("Seconds",2),s:X("Seconds",1),sss:X("Milliseconds",3),EEEE:eb("Day"),EEE:eb("Day",!0),a:function(b,c){return 12>b.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(b){b=-1*b.getTimezoneOffset();return b=(0<=b?"+":"")+(Cb(Math[0=Q&&(c.href||c.name||c.$set("href",""),b.append(T.createComment("IE fix")));return function(b,c){c.on("click",function(b){c.attr("href")||b.preventDefault()})}}}),Eb={};q($a,function(b,c){if("multiple"!=b){var d=la("ng-"+c);Eb[d]=function(){return{priority:100,compile:function(){return function(b,g,h){b.$watch(h[d],function(b){h.$set(c,!!b)})}}}}}});q(["src","srcset","href"],function(b){var c= la("ng-"+b);Eb[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){c&&(g.$set(b,c),Q&&e.prop(b,g[b]))})}}}});var hb={$addControl:A,$removeControl:A,$setValidity:A,$setDirty:A,$setPristine:A};uc.$inject=["$element","$attrs","$scope"];var wc=function(b){return["$timeout",function(c){var d={name:"form",restrict:"E",controller:uc,compile:function(){return{pre:function(b,d,h,f){if(!h.action){var k=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1};vc(d[0],"submit", k);d.on("$destroy",function(){c(function(){wb(d[0],"submit",k)},0,!1)})}var l=d.parent().controller("form"),m=h.name||h.ngForm;m&&db(b,m,f,m);if(l)d.on("$destroy",function(){l.$removeControl(f);m&&db(b,m,s,m);E(f,hb)})}}}};return b?E(da(d),{restrict:"EAC"}):d}]},Kd=wc(),Ld=wc(!0),Md=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,Nd=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/,Od=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,xc={text:jb,number:function(b,c,d,e, g,h){jb(b,c,d,e,g,h);e.$parsers.push(function(b){var c=ca(b);if(c||Od.test(b))return e.$setValidity("number",!0),""===b?null:c?b:parseFloat(b);e.$setValidity("number",!1);return s});e.$formatters.push(function(b){return ca(b)?"":""+b});if(d.min){var f=parseFloat(d.min);b=function(b){if(!ca(b)&&bk)return e.$setValidity("max",!1), s;e.$setValidity("max",!0);return b};e.$parsers.push(d);e.$formatters.push(d)}e.$formatters.push(function(b){if(ca(b)||lb(b))return e.$setValidity("number",!0),b;e.$setValidity("number",!1);return s})},url:function(b,c,d,e,g,h){jb(b,c,d,e,g,h);b=function(b){if(ca(b)||Md.test(b))return e.$setValidity("url",!0),b;e.$setValidity("url",!1);return s};e.$formatters.push(b);e.$parsers.push(b)},email:function(b,c,d,e,g,h){jb(b,c,d,e,g,h);b=function(b){if(ca(b)||Nd.test(b))return e.$setValidity("email",!0), b;e.$setValidity("email",!1);return s};e.$formatters.push(b);e.$parsers.push(b)},radio:function(b,c,d,e){M(d.name)&&c.attr("name",Ta());c.on("click",function(){c[0].checked&&b.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(b,c,d,e){var g=d.ngTrueValue,h=d.ngFalseValue;H(g)||(g=!0);H(h)||(h=!1);c.on("click",function(){b.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked= e.$viewValue};e.$formatters.push(function(b){return b===g});e.$parsers.push(function(b){return b?g:h})},hidden:A,button:A,submit:A,reset:A},yc=["$browser","$sniffer",function(b,c){return{restrict:"E",require:"?ngModel",link:function(d,e,g,h){h&&(xc[J(g.type)]||xc.text)(d,e,g,h,c,b)}}}],gb="ng-valid",fb="ng-invalid",Da="ng-pristine",ib="ng-dirty",Pd=["$scope","$exceptionHandler","$attrs","$element","$parse",function(b,c,d,e,g){function h(b,c){c=c?"-"+pb(c,"-"):"";e.removeClass((b?fb:gb)+c).addClass((b? gb:fb)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var f=g(d.ngModel),k=f.assign;if(!k)throw P("ngModel")("nonassign",d.ngModel,ia(e));this.$render=A;var l=e.inheritedData("$formController")||hb,m=0,p=this.$error={};e.addClass(Da);h(!0);this.$setValidity=function(b,c){p[b]!==!c&&(c?(p[b]&&m--,m||(h(!0),this.$valid=!0,this.$invalid=!1)):(h(!1),this.$invalid= !0,this.$valid=!1,m++),p[b]=!c,h(c,b),l.$setValidity(b,c,this))};this.$setPristine=function(){this.$dirty=!1;this.$pristine=!0;e.removeClass(ib).addClass(Da)};this.$setViewValue=function(d){this.$viewValue=d;this.$pristine&&(this.$dirty=!0,this.$pristine=!1,e.removeClass(Da).addClass(ib),l.$setDirty());q(this.$parsers,function(b){d=b(d)});this.$modelValue!==d&&(this.$modelValue=d,k(b,d),q(this.$viewChangeListeners,function(b){try{b()}catch(d){c(d)}}))};var n=this;b.$watch(function(){var c=f(b);if(n.$modelValue!== c){var d=n.$formatters,e=d.length;for(n.$modelValue=c;e--;)c=d[e](c);n.$viewValue!==c&&(n.$viewValue=c,n.$render())}})}],Qd=function(){return{require:["ngModel","^?form"],controller:Pd,link:function(b,c,d,e){var g=e[0],h=e[1]||hb;h.$addControl(g);c.on("$destroy",function(){h.$removeControl(g)})}}},Rd=$({require:"ngModel",link:function(b,c,d,e){e.$viewChangeListeners.push(function(){b.$eval(d.ngChange)})}}),zc=function(){return{require:"?ngModel",link:function(b,c,d,e){if(e){d.required=!0;var g=function(b){if(d.required&& (ca(b)||!1===b))e.$setValidity("required",!1);else return e.$setValidity("required",!0),b};e.$formatters.push(g);e.$parsers.unshift(g);d.$observe("required",function(){g(e.$viewValue)})}}}},Sd=function(){return{require:"ngModel",link:function(b,c,d,e){var g=(b=/\/(.*)\//.exec(d.ngList))&&RegExp(b[1])||d.ngList||",";e.$parsers.push(function(b){var c=[];b&&q(b.split(g),function(b){b&&c.push(aa(b))});return c});e.$formatters.push(function(b){return D(b)?b.join(", "):s})}}},Td=/^(true|false|\d+)$/,Ud= function(){return{priority:100,compile:function(b,c){return Td.test(c.ngValue)?function(b,c,g){g.$set("value",b.$eval(g.ngValue))}:function(b,c,g){b.$watch(g.ngValue,function(b){g.$set("value",b)})}}}},Vd=sa(function(b,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);b.$watch(d.ngBind,function(b){c.text(b==s?"":b)})}),Wd=["$interpolate",function(b){return function(c,d,e){c=b(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(b){d.text(b)})}}], Xd=["$sce",function(b){return function(c,d,e){d.addClass("ng-binding").data("$binding",e.ngBindHtml);c.$watch(e.ngBindHtml,function(c){d.html(b.getTrustedHtml(c)||"")})}}],Yd=Db("",!0),Zd=Db("Odd",0),$d=Db("Even",1),ae=sa({compile:function(b,c){c.$set("ngCloak",s);b.removeClass("ng-cloak")}}),be=[function(){return{scope:!0,controller:"@"}}],ce=["$sniffer",function(b){return{priority:1E3,compile:function(){b.csp=!0}}}],Ac={};q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur".split(" "), function(b){var c=la("ng-"+b);Ac[c]=["$parse",function(d){return function(e,g,h){var f=d(h[c]);g.on(J(b),function(b){e.$apply(function(){f(e,{$event:b})})})}}]});var de=["$animate",function(b){return{transclude:"element",priority:1E3,terminal:!0,restrict:"A",compile:function(c,d,e){return function(c,d,f){var k,l;c.$watch(f.ngIf,function(f){k&&(b.leave(k),k=s);l&&(l.$destroy(),l=s);Ga(f)&&(l=c.$new(),e(l,function(c){k=c;b.enter(c,d.parent(),d)}))})}}}}],ee=["$http","$templateCache","$anchorScroll", "$compile","$animate","$sce",function(b,c,d,e,g,h){return{restrict:"ECA",terminal:!0,transclude:"element",compile:function(f,k,l){var m=k.ngInclude||k.src,p=k.onload||"",n=k.autoscroll;return function(f,k){var q=0,s,w,A=function(){s&&(s.$destroy(),s=null);w&&(g.leave(w),w=null)};f.$watch(h.parseAsResourceUrl(m),function(h){var m=++q;h?(b.get(h,{cache:c}).success(function(b){if(m===q){var c=f.$new();l(c,function(h){A();s=c;w=h;w.html(b);g.enter(w,null,k);e(w.contents())(s);!z(n)||n&&!f.$eval(n)||d(); s.$emit("$includeContentLoaded");f.$eval(p)})}}).error(function(){m===q&&A()}),f.$emit("$includeContentRequested")):A()})}}}}],fe=sa({compile:function(){return{pre:function(b,c,d){b.$eval(d.ngInit)}}}}),ge=sa({terminal:!0,priority:1E3}),he=["$locale","$interpolate",function(b,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,h){var f=h.count,k=h.$attr.when&&g.attr(h.$attr.when),l=h.offset||0,m=e.$eval(k)||{},p={},n=c.startSymbol(),t=c.endSymbol(),r=/^when(Minus)?(.+)$/;q(h,function(b,c){r.test(c)&& (m[J(c.replace("when","").replace("Minus","-"))]=g.attr(h.$attr[c]))});q(m,function(b,e){p[e]=c(b.replace(d,n+f+"-"+l+t))});e.$watch(function(){var c=parseFloat(e.$eval(f));if(isNaN(c))return"";c in m||(c=b.pluralCat(c-l));return p[c](e,g,!0)},function(b){g.text(b)})}}}],ie=["$parse","$animate",function(b,c){var d=P("ngRepeat");return{transclude:"element",priority:1E3,terminal:!0,compile:function(e,g,h){return function(e,g,l){var m=l.ngRepeat,p=m.match(/^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/), n,t,r,s,x,z,A,u={$id:za};if(!p)throw d("iexp",m);l=p[1];x=p[2];(p=p[4])?(n=b(p),t=function(b,c,d){A&&(u[A]=b);u[z]=c;u.$index=d;return n(e,u)}):(r=function(b,c){return za(c)},s=function(b){return b});p=l.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!p)throw d("iidexp",l);z=p[3]||p[1];A=p[2];var v={};e.$watchCollection(x,function(b){var l,n,p=g[0],u,x={},H,G,D,E,L,C,K=[];if(kb(b))L=b,t=t||r;else{t=t||s;L=[];for(D in b)b.hasOwnProperty(D)&&"$"!=D.charAt(0)&&L.push(D);L.sort()}H=L.length; n=K.length=L.length;for(l=0;lF;)z.pop().element.remove()}for(;A.length>B;)A.pop()[0].element.remove()}var k;if(!(k= y.match(d)))throw P("ngOptions")("iexp",y,ia(f));var l=c(k[2]||k[1]),m=k[4]||k[6],n=k[5],p=c(k[3]||""),q=c(k[2]?k[1]:m),t=c(k[7]),v=k[8]?c(k[8]):null,A=[[{element:f,label:""}]];x&&(b(x)(e),x.removeClass("ng-scope"),x.remove());f.html("");f.on("change",function(){e.$apply(function(){var b,c=t(e)||[],d={},h,k,l,p,u,x;if(r)for(k=[],p=0,x=A.length;p@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}'); /* //@ sourceMappingURL=angular.min.js.map */ ; /* file-end: js/lib/angular/1.2.0-rc.2/angular.min.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/editor/basicToolbar.js */ /* --------------------------------------------------------------------------------- file-start: js/core/angular/api.js */ /* --------------------------------------------------------------------------------- file-start: js/core/angular/messages.js */ /* --------------------------------------------------------------------------------- file-start: js/core/angular/common.js */ /* * Include LJ.Templates as module dependency to have access to templates, * required using require_template. Don't forget to require this file. * * @example * js: * //= require_template angular/ljMessages.ng.tmpl * angular.module('MyModule', ['LJ.Templates']); * * html: *
    * * If you need direct access as a string, use $templateCache. */ angular.module('LJ.Templates', []).run(['$templateCache', function($templateCache) { var template = LJ.get('template'), key; for (key in template) { if (template.hasOwnProperty(key)) { $templateCache.put(key.split('/').pop(), template[key]); } } }]); /* * Common directives */ angular.module('LJ.Directives', []) /** * Insert html and do not watch for changes */ .directive('ljHtml', function () { return function link(scope, element, attrs) { element.html( scope.$eval(attrs.ljHtml) || '' ); }; }) /** * Insert html and watch for changes */ .directive('ljHtmlLive', function () { return function link(scope, element, attrs) { scope.$watch(function () { return scope.$eval(attrs.ljHtmlLive); }, function (value) { element.html( value || '' ); }); }; }) /** * @example * * * * @example * * * * @example * * Html: * * * * Controller: * var mlDefer = $q.defer(); * * // Notice: * // Object with `promise` field is needed! * // If promise is assigned directly, it will be resolved to `undefined` * * $scope.mlResolve = { promise: mlDefer.promise } * mlDefer.resolve({ username: 'good' }) */ .directive('ljMl', ['$parse', function($parse) { return { link: function(scope, element, attrs) { var mlVar = attrs.ljMl, resolve; // we don't need substitutions if ( !attrs.ljMlResolve ) { replaceMl(mlVar); return; } resolve = $parse(attrs.ljMlResolve)(scope); if (!resolve || !resolve.promise) { throw new TypeError('Object with property `promise` should be provided.'); } resolve.promise.then(function (data) { replaceMl(mlVar, data); }); // replace variable with value function replaceMl(mlVar, dictionary) { var ml = LJ.ml(mlVar, dictionary); // attribute if (attrs.ljMlAttr) { element.attr( attrs.ljMlAttr, ml); return; } // html element.html(ml); } } }; }]) .directive('ljSwitchOff', ['$document', '$parse', function ( $document , $parse ) { /* * When area outside of element is clicked or ESC is pressed * 'showPopup' will be set to false and 'doSomething()' will be evaluated. * *
    * * Skip switching: * Notice: now skipping of switch is working for all `lj-switch-off` directives (is not grouped) * This element prevents switching via `lj-switch-off` directive * */ return { restrict: 'A', link: function (scope, element, attrs) { var state = $parse(attrs.ljSwitchOff), _clicked = false; element.on('click', function () { _clicked = true; }); $document .on('keydown', keyPressed) .on('click', '[lj-switch-off-skip]', preventSwitching) .on('click', documentClick); // cleanup scope.$on('$destroy', function () { $document .off('keydown', keyPressed) .off('click', '[lj-switch-off-skip]', preventSwitching) .off('click', documentClick); }); function close() { if (attrs.ljSwitchOffAction) { scope.$eval(attrs.ljSwitchOffAction); } state.assign(scope, false); } function preventSwitching() { _clicked = true; } function documentClick(event) { // right click in Firefox is closing the bubble if (event.button === 2) { return; } if ( !_clicked && state(scope) ) { scope.$apply(close); } _clicked = false; } function keyPressed(event) { /** ESC */ if ( event.which === 27 && state(scope) ) { scope.$apply(close); } } } }; }]). directive('ljDisabled', [function() { /* * Toggles disabled state for LiveJournal button * *
    * *
    */ return function (scope, element, attrs) { scope.$watch(attrs.ljDisabled, function(value) { element.prop('disabled', value); element.parent().toggleClass('b-ljbutton-disabled', value); }); }; }]) .directive('focusAndSelect', ['$timeout', function ($timeout) { /* * Focus and select an input or textarea when expression is true * * */ return { restrict: 'A', link: function (scope, element, attrs) { var attr = attrs.focusAndSelect; scope.$watch(attr, function (value, prev) { if (value) { $timeout(function () { element[0].focus(); element[0].select(); }); } else if (prev) { // fix: blur for IE element[0].blur(); } }); } }; }]) /** * Debounced update of scope variable on changes * [lj-debounce-delay]: option for set delay duration (in milliseconds). Default: 300 * * @example * * * * * js: * //= require js/core/angular/bubble.js * * angular.module('MyModule', ['LJ.Bubble']) * .controller('MyCtrl', ['$scope', 'Bubble', function($scope, Bubble) { * * // Use Bubble.open to control bubble from JS. * // You can pass jQuery node to reposition the bubble from the original placement. * Bubble.open('myBubble', { 'some-stuff': 'optional' }, jQuery('.b-some-other-block')); * }]); * * @todo * Refactor detection of current bubble open * Refactor disableClick option of directive * * @authors * Artem Tyurin (artem.tyurin@sup.com) * Valeriy Vasin (valeriy.vasin@sup.com) */ (function($) { 'use strict'; angular.module('LJ.Bubble', ['LJ.Templates', 'LJ.Directives']) .factory('Bubble', ['$rootScope', function ($rootScope) { var factory = {}, // bubbles options _options = {}, // targets for bubbles _targets = {}; // currently opened bubble name factory.current = null; // we can change bubble node while opening bubble factory.node = null; /** * Register bubble * @param {String} name Bubble name */ factory._register = function (name) { if ( _options.hasOwnProperty(name) ) { console.warn('Warning: bubble with name `%s` has been registered before!', name); } _options[name] = {}; }; /** * Register target for bubble nodes * * @param {String} name Target name * @param {jQuery} node Target node */ factory._registerTarget = function (name, node) { if ( _targets.hasOwnProperty(name) ) { throw new Error('Bubble with name `'+ name +'` has been registered before. Check it.'); } _targets[name] = node; }; /** * Remove registered target * @param {String} name Target name */ factory._unregisterTarget = function (name) { delete _targets[name]; }; function getTarget(name) { if ( !_targets.hasOwnProperty(name) ) { console.warn('Bubble target `'+ name +'` has not been registered yet.'); return; } return _targets[name]; } /** * Open bubble with provided name * @param {String} name Bubble name * @param {Object} [options] Options that will be available for bubble * @param {jQuery|String} [node] jQuery: Node relative to which bubble will be positioned * String: Registered bubble target name */ factory.open = function (name, options, node) { if ( !_options.hasOwnProperty(name) ) { throw new Error('Bubble `'+ name +'` can\'t be opened, it has not been registered yet.'); } if ( options instanceof jQuery ) { node = options; options = {}; } if ( typeof options === 'string' ) { node = getTarget(options); options = {}; } if (typeof options === 'object') { factory.options(name, options); } if (node instanceof jQuery) { factory.node = node; } if (typeof node === 'string') { factory.node = getTarget(node); } factory.current = name; $rootScope.$broadcast('bubble:open' , name, options, node); $rootScope.$broadcast('bubble:open:' + name, name, options, node); }; /** * Close all opened bubbles * @param {String} [name] Close bubble */ factory.close = function () { var name = factory.current, options = _options[name], option; $rootScope.$broadcast('bubble:close' , name, options, factory.node); $rootScope.$broadcast('bubble:close:' + name, name, options, factory.node); // clear current bubble options for (option in options) { if ( options.hasOwnProperty(option) ) { delete options[option]; } } factory.current = null; factory.node = null; }; /** * Set context for opened bubble * @param {String} name Bubble name * @param {Object} options Opening context (arguments) * @return {Object} Bubble options */ factory.options = function (name, options) { if (typeof options === 'undefined') { return _options[name]; } angular.copy(options, _options[name]); }; return factory; }]) .directive('ljBubble', ['Bubble', '$parse', '$compile', '$timeout', '$templateCache', function( Bubble, $parse, $compile, $timeout, $templateCache ) { return { scope: true, link: function(scope, element, attrs) { var options = $parse(attrs.ljBubble)(scope), name = options.name, bubble = $compile($templateCache.get('ljBubble.tmpl'))(scope), arrow = bubble.find('.i-popup-arr'); scope.show = false; Bubble._register(name); scope.template = options.template || (name + '.html'); scope.bubble = { name: name, close: Bubble.close, options: Bubble.options(name) }; scope.arrow = { vertical: 't', /* top (t) or bottom (b) */ horizontal: 'l' /* left (l) or right (r) */ }; scope.position = { x: -9999, y: -9999 }; scope.getPosition = function() { return 'i-popup-arr' + scope.arrow.vertical + scope.arrow.horizontal; }; scope.$watch(function() { return Bubble.current; }, function(value) { scope.hideFromViewport(); $timeout(function() { scope.show = value === name; if (value && scope.show) { $timeout(setPosition); } }); }, true); function setPosition() { var el = Bubble.node || element, centerX = el.offset().left + Math.floor(el.outerWidth() / 2); scope.arrow.vertical = 't'; scope.position.x = centerX - arrow.position().left - Math.floor(arrow.outerWidth() / 2) - 2; scope.position.y = el.offset().top + el.outerHeight() + arrow.outerHeight(); // if there is not enough space, // bubble shows at the top of the target if (isUnderViewport()) { scope.arrow.vertical = 'b'; scope.position.y -= bubble.outerHeight() + el.outerHeight() * 2; } } scope.hideFromViewport = function() { scope.position.x = -9999; }; function isUnderViewport() { return scope.position.y + bubble.outerHeight() > $(window).scrollTop() + $(window).outerHeight(); } if (!options.disableClick) { element.click(function(event) { event.preventDefault(); $timeout(function() { Bubble.open(options.name); }); }); } $(window).on('resize', function() { if (scope.show) { $timeout(setPosition); } }); $(document.body).append(bubble); } }; }]) // register a target for the bubble // .directive('ljBubbleTarget', ['Bubble', function (Bubble) { return function link(scope, element, attrs) { var name = attrs.ljBubbleTarget; Bubble._registerTarget(name, element); scope.$on('$destroy', function () { Bubble._unregisterTarget(name); }); }; }]); })(jQuery); ; /* file-end: js/core/angular/bubble.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/editor/editor.js */ /* --------------------------------------------------------------------------------- file-start: js/lib/textinputs_jquery.js */ /** * @license Rangy Inputs, a jQuery plug-in for selection and caret manipulation within textareas and text inputs. * * https://github.com/timdown/rangyinputs * * For range and selection features for contenteditable, see Rangy. * http://code.google.com/p/rangy/ * * Depends on jQuery 1.0 or later. * * Copyright 2013, Tim Down * Licensed under the MIT license. * Version: 1.1 * Build date: 31 March 2013 */ (function(a){function l(a,b){var c=typeof a[b];return"function"===c||!("object"!=c||!a[b])||"unknown"==c}function m(a,c){return typeof a[c]!=b}function n(a,b){return!("object"!=typeof a[b]||!a[b])}function o(a){window.console&&window.console.log&&window.console.log("RangyInputs not supported in your browser. Reason: "+a)}function p(a,c,d){return 0>c&&(c+=a.value.length),typeof d==b&&(d=c),0>d&&(d+=a.value.length),{start:c,end:d}}function q(a,b,c){return{start:b,end:c,length:c-b,text:a.value.slice(b,c)}}function r(){return n(document,"body")?document.body:document.getElementsByTagName("body")[0]}var c,d,e,f,g,h,i,j,k,b="undefined";a(document).ready(function(){function v(a,b){return function(){var c=this.jquery?this[0]:this,d=c.nodeName.toLowerCase();if(1==c.nodeType&&("textarea"==d||"input"==d&&"text"==c.type)){var e=[c].concat(Array.prototype.slice.call(arguments)),f=a.apply(this,e);if(!b)return f}return b?this:void 0}}var s=document.createElement("textarea");if(r().appendChild(s),m(s,"selectionStart")&&m(s,"selectionEnd"))c=function(a){var b=a.selectionStart,c=a.selectionEnd;return q(a,b,c)},d=function(a,b,c){var d=p(a,b,c);a.selectionStart=d.start,a.selectionEnd=d.end},k=function(a,b){b?a.selectionEnd=a.selectionStart:a.selectionStart=a.selectionEnd};else{if(!(l(s,"createTextRange")&&n(document,"selection")&&l(document.selection,"createRange")))return r().removeChild(s),o("No means of finding text input caret position"),void 0;c=function(a){var d,e,f,g,b=0,c=0,h=document.selection.createRange();return h&&h.parentElement()==a&&(f=a.value.length,d=a.value.replace(/\r\n/g,"\n"),e=a.createTextRange(),e.moveToBookmark(h.getBookmark()),g=a.createTextRange(),g.collapse(!1),e.compareEndPoints("StartToEnd",g)>-1?b=c=f:(b=-e.moveStart("character",-f),b+=d.slice(0,b).split("\n").length-1,e.compareEndPoints("EndToEnd",g)>-1?c=f:(c=-e.moveEnd("character",-f),c+=d.slice(0,c).split("\n").length-1))),q(a,b,c)};var t=function(a,b){return b-(a.value.slice(0,b).split("\r\n").length-1)};d=function(a,b,c){var d=p(a,b,c),e=a.createTextRange(),f=t(a,d.start);e.collapse(!0),d.start==d.end?e.move("character",f):(e.moveEnd("character",t(a,d.end)),e.moveStart("character",f)),e.select()},k=function(a,b){var c=document.selection.createRange();c.collapse(b),c.select()}}r().removeChild(s),f=function(a,b,c,e){var f;b!=c&&(f=a.value,a.value=f.slice(0,b)+f.slice(c)),e&&d(a,b,b)},e=function(a){var b=c(a);f(a,b.start,b.end,!0)},j=function(a){var e,b=c(a);return b.start!=b.end&&(e=a.value,a.value=e.slice(0,b.start)+e.slice(b.end)),d(a,b.start,b.start),b.text};var u=function(a,b,c,e){var f=b+c.length;switch(e="string"==typeof e?e.toLowerCase():""){case"collapsetostart":d(a,b,b);break;case"collapsetoend":d(a,f,f);break;case"select":d(a,b,f)}};g=function(a,b,c,d){var e=a.value;a.value=e.slice(0,c)+b+e.slice(c),"boolean"==typeof d&&(d=d?"collapseToEnd":""),u(a,c,b,d)},h=function(a,b,d){var e=c(a),f=a.value;a.value=f.slice(0,e.start)+b+f.slice(e.end),u(a,e.start,b,d||"collapseToEnd")},i=function(a,d,e,f){typeof e==b&&(e=d);var g=c(a),h=a.value;a.value=h.slice(0,g.start)+d+g.text+e+h.slice(g.end);var i=g.start+d.length;u(a,i,g.text,f||"select")},a.fn.extend({getSelection:v(c,!1),setSelection:v(d,!0),collapseSelection:v(k,!0),deleteSelectedText:v(e,!0),deleteText:v(f,!0),extractSelectedText:v(j,!1),insertText:v(g,!0),replaceSelectedText:v(h,!0),surroundSelectedText:v(i,!0)})})})(jQuery);; /* file-end: js/lib/textinputs_jquery.js ----------------------------------------------------------------------------------*/ (function($) { 'use strict'; angular.module('Editor', []) .factory('Editor', function() { var factory = {}; factory.getSelectedText = function() { var textarea = $('#body'); return textarea.getSelection().text; }; factory.htmlMode = function() { return $('#body').is(':visible'); }; factory.insertContent = function(type, content, data, additional) { var textarea = $('#body'), /* selector is used on update.bml and also s2 commenting form */ parts = content.split('{caret}'), selection; if (factory.htmlMode()) { textarea.surroundSelectedText( parts[0], parts.length > 1 ? (parts[parts.length - 1] || '') : '' ).trigger('input'); selection = textarea.getSelection(); // use text between {caret} if selection is empty, // move caret to the end if (parts.length === 3 && selection.length === 0) { textarea .replaceSelectedText(parts[1], 'collapseToEnd') .setSelection(selection.start + parts[1].length + parts[parts.length - 1].length); } } else { // @TODO: make the events consistent, selectedColor => color_response if (type === 'color') { return LJ.Event.trigger('selectedColor', data); } LJ.Event.trigger(type + '_response', data || content, additional); } }; return factory; }) .controller('EditorCtrl', ['$scope', 'Editor', 'Bubble', '$timeout', function( $scope , Editor , Bubble , $timeout ) { var basicFormatting = { bold: '{caret}', italic: '{caret}', underline: '{caret}', strikethrough: '{caret}' }; var photoUploaderNode = $(document); $scope.formattingAction = function(event, type) { event.preventDefault(); if (basicFormatting[type]) { Editor.insertContent(type, basicFormatting[type]); } }; $scope.userClick = function(event, type) { var selected = Editor.getSelectedText(), rxUsername = /^[A-Za-z0-9_\-]+$/; event.preventDefault(); if (rxUsername.test(selected)) { Editor.insertContent(type, ''); } else { $timeout(function() { Bubble.open('user'); }); } }; photoUploaderNode.photouploader(LJ.get('fotki.uploader')); $scope.photoUploaderClick = function(event) { event.preventDefault(); if (LJ.get('disabled_input')) { return; } photoUploaderNode .photouploader('option', 'type', LJ.Storage.getItem('photouploader.type') || 'upload') .photouploader('show') .on('htmlready', function (data) { Editor.insertContent('photo', data.htmlStrings.join('\n')); }); }; $scope.toggleSpellcheck = function(event) { event.preventDefault(); $scope.spellcheck = !$scope.spellcheck; }; var widget = $('
    ').basicWidget().data('basicWidget'); $scope.$watch('spellcheck', function(value, prevValue) { if (value !== prevValue) { widget._fire('toggle', ['spell', value], true); } }); }]); })(jQuery); ; /* file-end: js/editor/editor.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/editor/media.js */ LJ.define('LJ.Media'); /** * Parse link or embed html. * @param {String} input Input can contain link or html. * @return {Object} Object representing the media. */ LJ.Media.parse = (function() { 'use strict'; function parseMediaLink(input) { var link = { 'youtube': 'http://youtube.com/watch?v={id}', 'vimeo': 'http://vimeo.com/{id}', 'vine': 'http://vine.co/v/{id}', 'instagram': 'http://instagram.com/p/{id}/', 'gist' : 'https://gist.github.com/{id}' }; var embed = { 'youtube': ''.supplant({link: link.youtube}), 'vimeo' : ''.supplant({link: link.vimeo}), 'vine' : ''.supplant({link: link.vine}), 'instagram' : ''.supplant({link: link.instagram}), 'gist' : 'gist.github.com/{id}'.supplant({link: link.gist}) }; var provider = { 'vine': { parse: function(input) { // http://vine.co/v/bdbF0i72uwA var matcher = /vine.co\/v\/([^\/]*)/, match = input.match(matcher); return (match && match[1]) || null; } }, 'vimeo': { parse: function(input) { var matcher = /^(http:\/\/)?(www\.)?(player\.)?vimeo.com\/(video\/)?(\d+)*/, match = input.match(matcher); return (match && match[5]) || null; } }, 'youtube': { parse: function(input) { // http://stackoverflow.com/a/8260383 var matcher = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\??v?=?))([^#\&\?]*).*/, match = input.match(matcher); if (match && match[0].indexOf('youtu') === -1) { return null; } // we really should move from regexp to querystring parsing var qs = LiveJournal.parseGetArgs(input); if (qs.v) { return qs.v; } return (match && match[7]) || null; } }, 'instagram': { parse: function(input) { var matcher = /.*(?:instagram\.\w*|instagr\.am)\/p\/([^\/]+).*/, match = input.match(matcher); return (match && match[1]) || null; } }, 'gist': { parse: function(input) { var matcher = /.*(?:gist\.github\.com\/)([^\/]+\/{1}[^\/]+)\/{0,1}$/, match = input.match(matcher); return (match && match[1]) || null; } } }; var id, key, result; for (key in provider) { if (provider.hasOwnProperty(key)) { id = provider[key].parse(input.trim()); if (id) { result = { site: key, id: id }; if (embed[key]) { result.embed = embed[key].supplant(result); } if (link[key]) { result.link = link[key].supplant(result); } return result; } } } return null; } return function(input) { // jQuery can fail on input try { var node = jQuery(input).first(), src; if (node && node.prop('tagName').toLowerCase() === 'iframe') { src = node && node.attr('src'); if (src) { return parseMediaLink(src); } } } catch (e) { return parseMediaLink(input); } }; })();; /* file-end: js/editor/media.js ----------------------------------------------------------------------------------*/ /* * Module is responsible for buttons: * - Link * - User * - Embed * * This buttons are used on both update.bml and S1 comments. * * @author * Artem Tyurin (artem.tyurin@sup.com) */ ;(function() { 'use strict'; angular.module('BasicToolbar', [ 'LJ.Bubble', 'LJ.Api', 'Editor' ]) .controller('MediaCtrl', ['$scope', 'Editor', function( $scope , Editor ) { $scope.media = ''; $scope.setHint = function($event) { var target = $event.target, href = target.getAttribute('href'); if (href) { $scope.media = href; } $event.preventDefault(); }; $scope.getMedia = function(input) { var media = LJ.Media.parse(input), output, /* * RuTube is an exception and its links can be used * like http://rutube.ru/video/90e2fbcd220cd26148fcb558126da73c/ */ useLJEmbed = /rutube\.ru\/video\//.test(input); if (media && media.embed) { output = media.embed; } else if (/^<(embed|iframe|object).*>$/.test(input) || useLJEmbed) { output = ['', input, ''].join('\n'); } else { output = '{caret}{link}{caret}'.supplant({ link: input }); } return output; }; $scope.insert = function() { Editor.insertContent('video', $scope.getMedia($scope.media), $scope.media); $scope.media = ''; $scope.bubble.close(); }; }]) .controller('LinkCtrl', ['$scope', 'Editor', 'Bubble', function( $scope , Editor , Bubble ) { $scope.newWindow = typeof LJ.Storage.getItem('newWindow') !== 'undefined' ? LJ.Storage.getItem('newWindow') : true; $scope.unlink = function() { LJ.Event.trigger('unlink'); // visual editor handles the event $scope.bubble.close(); }; $scope.saveOption = function() { LJ.Storage.setItem('newWindow', $scope.newWindow); }; $scope.$watch(function() { return Bubble.current === 'link'; }, function(value) { if (value) { $scope.link = $scope.bubble.options.defaultText || ''; $scope.showUnlink = !!($scope.bubble.options.rangeNotCollapsed || $scope.bubble.options.editMode); // notice, that 'new window' option could be changed // not only manually, but also when editing link in RTE mode if (typeof $scope.bubble.options.hasTarget !== 'undefined') { $scope.newWindow = $scope.bubble.options.hasTarget; } else { if (typeof LJ.Storage.getItem('newWindow') !== 'undefined') { $scope.newWindow = LJ.Storage.getItem('newWindow'); } } } }); $scope.insertOrSave = function() { /* * If there is selected text, surround it with , * otherwise use href as link text and move caret after . */ Editor.insertContent( 'link', '{caret}{text}{caret}'.supplant({ text: LJ.String.linkify($scope.link), target: $scope.newWindow ? ' target="_blank"' : '' }), { url: $scope.link, target: $scope.newWindow ? '_blank' : '' } ); $scope.link = ''; $scope.bubble.close(); }; }]) .controller('UserCtrl', ['$scope', 'Editor', 'Bubble', 'Api', function( $scope , Editor , Bubble , Api ) { $scope.$watch(function() { return Bubble.current === 'user'; }, function(value) { if (value) { $scope.user = $scope.bubble.options.user || ''; // title could be one of: undefined, 'undefined', or actual title string $scope.title = $scope.bubble.options.title === 'undefined' ? '' : ( $scope.bubble.options.title || ''); $scope.error = false; } }); $scope.$watch('user', function() { $scope.error = false; }); $scope.insertOrSave = function() { Api.call('ljuser.get', { user: $scope.user, raw: true }, function (data) { if (data.error) { $scope.error = true; } else { Editor.insertContent( 'user', ''.supplant({ text: $scope.user }), data, $scope.title ); $scope.user = ''; $scope.title = ''; $scope.bubble.close(); } }); }; }]); })(); ; /* file-end: js/editor/basicToolbar.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/entry/actions.js */ Site.page.template['angular/memories.ng.tmpl'] = '
    \n\n
    \n\n \n

    \n\n \n

    \n \n \n

    \n\n \n
      \n
    • \n \n
    • \n
    • \n \n
    • \n
    • \n \n
    • \n
    \n\n \n
    \n
    \n \n
    \n
    \n\n
    \n\n
    \n\n'; Site.page.template['angular/share.ng.tmpl'] = '

    \n\n'; LJ.injectStyle('/* LJSUP-17006: [S1 entry, memories] Popup in S1 entries */\n/* Add to Memories */\n\n.b-addtomemories {\n width: 150px;\n margin: 0;\n padding: 0;\n }\n .b-addtomemories-head {\n margin: 0 0 0.5em;\n padding: 0;\n font: bold 15px/1.1 Arial,sans-serif;\n color: #000;\n }\n .b-addtomemories-intro {\n margin: 0 0 0.3em;\n }\n .b-addtomemories-items {\n margin: 0 0 1em;\n padding: 0;\n list-style: none;\n }\n .b-addtomemories-item {\n margin: 0;\n padding: 0;\n }\n .b-addtomemories-item:hover {\n background: #C8E6FF;\n }\n .b-addtomemories-label {\n display: block;\n margin: 0 -5px;\n padding: 5px;\n cursor: pointer;\n }\n .b-addtomemories-footer {\n margin: 0;\n }\n.b-addtomemories-loading {\n background: url(/img/preloader/preloader-blue-gray.gif?v=1) no-repeat 50% 50%;\n }\n .b-addtomemories-loading .b-addtomemories-head,\n .b-addtomemories-loading .b-addtomemories-intro,\n .b-addtomemories-loading .b-addtomemories-items,\n .b-addtomemories-loading .b-addtomemories-footer {\n visibility: hidden;\n }\n\n'); /* * Entry actions: memories and social shares * * @author Artem Tyurin (artem.tyurin@sup.com) */ (function($) { angular.module('EntryActions', [ 'LJ.Directives', 'LJ.Bubble', 'LJ.Api' ]) .controller('MemoriesCtrl', ['$scope', 'Api', function( $scope , Api ) { var bubble = $scope.bubble; $scope.security = null; // bubble size could change because of button, reposition $scope.$watch('removeButton', function() { $(window).trigger('resize'); }); $scope.$on('bubble:open:memories', function() { Api.call('memories.get', bubble.options, function(result) { $scope.security = result.result ? result.result.security : null; $scope.removeButton = Boolean($scope.security); }); }); $scope.$on('bubble:close:memories', function() { $scope.removeButton = false; }); $scope.update = function() { Api.call('memories.set', { journal: bubble.options.journal, ditemid: bubble.options.ditemid, description: bubble.options.journal + ': ' + bubble.options.title, security: $scope.security }, function(result) { $scope.security = result; bubble.close(); $scope.removeButton = true; }); }; $scope.remove = function() { Api.call('memories.remove', { journal: bubble.options.journal, ditemid: bubble.options.ditemid, }, function() { $scope.security = null; bubble.close(); $scope.removeButton = false; }); }; LJ.Event.on('api:request:change', function(method, state) { if (/^memories/.test(method)) { $scope.loading = state; } }); }]) .controller('Share', ['$scope', function($scope) { /* * Controller acts as a thin wrapper around jquery.lj.share.js * @TODO: remove widget dependency */ var widget = $(document.body), services = LJ.get('LJShareParams.services'); $scope.$on('bubble:open:share', function() { $scope.services = LJ.get('LJShareParams.links').map(function(name) { return { name: name, link: widget.share('createSharingLink', name, $scope.bubble.options.params), title: services[name].title, openInTab: services[name].openInTab }; }); }); $scope.share = function(service, event) { if (!service.openInTab) { event.preventDefault(); } widget.share('shareLink', service.link, service.name); }; }]); })(jQuery);; /* file-end: js/entry/actions.js ----------------------------------------------------------------------------------*/ (function($) { 'use strict'; // fix forms $(function() { $('[type="submit"]').on('click', function() { var form = $(this).closest('form'); if (!form.attr('action') || form.attr('onclick')) { $(this).closest('form').submit(); } }); }); angular.module('Entry', ['LJ.Templates', 'BasicToolbar', 'EntryActions']) /* * Comment page uses lj-bubble directive (comment form), * which uses ng-include inside bubble template. * * ng-include needs $AnchorScrollProvider, which lists $LocationProvider * as a dependency, which triggers $locationChangeStart. This sends $digest * into infinite loop when pushState is used from * non-Angular code (s1 comments). * * This way we supress $LocationProvider init. */ .value('$anchorScroll', null) .config(function($sceProvider) { $sceProvider.enabled(false); }) .controller('LinkbarCtrl', ['$scope', '$timeout', 'Bubble', function( $scope, $timeout, Bubble ) { $('.b-linkbar').on('click', '.b-controls-memadd', function(event) { var that = this; event.preventDefault(); $timeout(function() { Bubble.open('memories', LJ.get('entry'), $(that)); }); }); $('.b-linkbar').on('click', '.js-lj-share', function(event) { var that = this; event.preventDefault(); $timeout(function() { Bubble.open('share', { params: $(document.body).share('getParams', $(that)) }, $(that)); }); }); }]); /* legacy code for comments initialization, moved here from inline calls */ $(function() { if (LJ.get('remoteUser')) { $('.b-grove') .commentsMassActions() .commentsOperations(); } var node = jQuery('.b-watering'); node.commentator({ publicKey: LJ.get('captcha_public'), captchaContainerId: 'captcha-container', selectors: { errorBlock: '.b-msgsystem-error-ajax', blockingErrorBlocks: '.b-msgsystem-error', preloaderElem: '.b-watering-preload', submitControl: '.b-ljbutton-submit', captchaBox: '.b-watering-captchabox' }, classNames: { captchaActive: 'b-watering-captchabox-active', replyPage: 'b-watering-replypage' } }) .commentform(); if (LJ.get('remoteUser') && LJ.get('hasuserpics')) { node.userpicker(); } //the authtype widget should go last, because it passes information about current //authorization to other widgets node.authtype({ forceStartupCaptcha: Boolean(LJ.get('need_captcha')), classNames: { expanded: 'b-watering-user-options-show', startAuthTypePrefix: 'b-watering-trueauth-', captchaForAnonymous: 'b-watering-captcha-anon', captchaForNonFriends: 'b-watering-captcha-nonfriend', notfriend: 'b-watering-user-notafriend', notaspammer: 'b-watering-notaspammer', captchaForAll: 'b-watering-captcha-all', authTypePrefix: 'b-watering-authtype-' }, selectors: { activeSelectItem: 'a[href=#{authType}]', selectControl: '.b-watering-user-options', authTypesControls: '.b-watering-user-services-item a', authTypeRadios: '.b-watering-user-login-{authType} .b-watering-user-login-checkbox' } }); $('.b-grove').comments(); jQuery('#body').spellchecker() // set through option, cuz settion it not inside // of constructor also apply it .spellchecker('option', 'minHeight', 180) .spellchecker('subscribe') .spellchecker('start'); /* * Track linkbar clicks (prev, next, memories, etc) to Google Analytics */ $('.b-linkbar').on('click', '.b-controls', function(event) { var className = event.currentTarget.className, match = className.match(/b-controls-([a-z]+)/), control = match && match[1]; if (control) { LJ.Track.event('S1 Entry', 'Linkbar', control); } }); }); })(jQuery); ; /* file-end: js/entry/main.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/jquery/jquery.lj.journalPromoStrip.js */ /** * @name $.lj.journalPromoStrip * @requires $.ui.core, $.ui.widget, $.lj.basicWidget, $.lj.bubble * @class Implements functionality of Promo in Journals page via JSON-RPC API * @extends $.lj.basicWidget * @author artem.tyurin@sup.com (Artem Tyurin) */ (function ($, window) { 'use strict'; $.widget('lj.journalPromoStrip', $.lj.basicWidget, { options: { selectors: { 'popupInfo': '.journalpromo-popup-content-info', 'popupDelete': '.journalpromo-popup-content-delete', 'button': '#journalpromo-popup-btn', 'iconClose': '.b-journalpromo-actions-close', 'options': '.b-journalpromo-header-options', 'promoItem': '.b-journalpromo-item', 'iconDelete': '.b-journalpromo-actions-delete', 'info': '.journalpromo-popup-info-action', 'spinner': '.journalpromo-popup-spinner', 'error': '.journalpromo-popup-info-error', 'errorContent': '.journalpromo-popup-info-error-content', 'ban': '#journalpromo-user-ban' }, classNames: { 'iconInfo': '.journalpromo-info-icon', 'iconDelete': '.b-journalpromo-actions-delete', 'noPromo': 'b-journalpromo-item-nopromotion' }, template: "
    {subject} {ljuser}
    {body}
    " }, _create: function () { var that = this; $.lj.basicWidget.prototype._create.apply(this); this._el('spinner'); this._el('info'); this._el('button'); this._el('iconClose'); this._el('error'); that._el('promoItem'); this._el('iconDelete'); this._el('popupDelete'); this._el('errorContent'); if (this._el('iconDelete')[0]) { this._deleteBubble = this._popupDelete.bubble({ target: this._cl('iconDelete'), showOn: 'click' }); } this._el('popupInfo').bubble({ target: this._cl('iconInfo'), showOn: 'hover', closeControl: false, showDelay: 500 }); this._bindControls(); }, _toggleSpinner: function(isLoading) { this._spinner.toggle(isLoading); this._info.toggle(!isLoading); }, _toggleError: function(isError, message) { this._error.toggle(isError); this._info.toggle(!isError); if (message) { this._errorContent.text(message); } }, _updateBlock: function(entry) { if (!entry.object[0].object_url) { this._promoItem.html( '' + entry.object[0].body + '' ).addClass(this._cl('noPromo')); } else { this._promoItem.html( this.options.template.supplant({ 'rules_link': entry.object[0].object_url, 'subject': entry.object[0].subject, 'body': entry.object[0].body, 'ljuser': entry.object[0].ljuser_display }) ); } }, _closeClick: function() { var that = this; if (location.hash === '#__debug') { return this._debug(); } that._toggleSpinner(true); LJ.Api.call('journalpromo.admin_cancel', { object_url: that.options.url, user: Site.currentJournal, get_slot: 1, ban_user: document.getElementById('journalpromo-user-ban').checked }, function(result) { that._toggleSpinner(false); console.dir(result); // promo could have been withdrawn after the page load if (result.error && result.error.data && result.error.data.entry) { that._updated = result.error.data.entry[0]; that._toggleError(true, result.error.message); console.error(result.error.message); return; } if (!result.error && result.entry) { var entry = result.entry[0]; if (!entry || !entry.object || !entry.object[0]) { console.error('Wrong data', result); return; } // re-render item and hide controls that._updateBlock(entry); that._iconDelete.hide(); } that._deleteBubble.bubble('hide'); }); }, _disableClick: function() { var that = this; LJ.Api.call('journalpromo.disable_promo_announce', {journal: LJ.get('currentJournal')}, function(result) { if (!result.error) { that.element.slideUp('fast'); } }); }, _bindControls: function() { var that = this; $.lj.basicWidget.prototype._bindControls.apply(this); this._button.on('click', this._closeClick.bind(this)); this._iconClose.on('click', this._disableClick.bind(this)); if (this._deleteBubble) { this._deleteBubble.bind('bubblehide', function(ev) { that._toggleError(false); if (that._updated) { that._updateBlock(that._updated); that._iconDelete.hide(); } }); } }, _debug: function() { var that = this; that._toggleSpinner(true); setTimeout(function() { that._toggleSpinner(false); that._toggleError(true, 'Sample error'); }, 1000); } }); }(jQuery, window)); ; /* file-end: js/jquery/jquery.lj.journalPromoStrip.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/ljlive.js */ LJ.injectStyle('.b-ljtimes-wrapper {\n position: fixed;\n top: auto;\n right: auto;\n bottom: 0;\n left: 0;\n width: 100%;\n margin: 0;\n padding: 0;\n z-index: 2999;\n font-size: 0;\n background: #FFF;\n }\n.b-ljtimes-lwrapper {\n position: fixed;\n bottom: 0;\n left: 0;\n }\n.i-ljtimes-border {\n position: absolute;\n top: -1px;\n left: 0;\n display: block;\n overflow: hidden;\n width: 100%;\n height: 1px;\n background: #CCC;\n font: 0/0 serif;\n }\n .i-ljtimes-bl,\n .i-ljtimes-br {\n position: absolute;\n top: 0;\n left: 50%;\n display: block;\n font: 0/0 serif;\n width: 3000px;\n height: 10px;\n background: url(/img/ljtimes/border.png?v=9478) repeat 0 0;\n }\n .i-ljtimes-bl {\n margin: 0 0 0 -3030px;\n }\n .i-ljtimes-br {\n margin: 0 0 0 30px;\n } \n.b-ljtimes-lwrapper .i-ljtimes-border {\n display: none;\n }\n.i-ljtimes-btn {\n overflow: hidden;\n position: absolute;\n top: -17px;\n left: 14px;\n width: 46px;\n height: 17px;\n background: url(/img/ljtimes/button.png?v=10067) no-repeat 0 0;\n font: 0/0 serif;\n }\n.b-ljtimes-lwrapper .i-ljtimes-btn {\n bottom: auto;\n top: 0;\n left: 50%;\n height: 24px;\n width: 60px;\n margin: 0 0 0 -30px;\n background: none;\n }\n .i-ljtimes-drag {\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 60px;\n height: 5px;\n font: 0/0 serif;\n cursor: row-resize;\n }\n .b-ljtimes-lwrapper .i-ljtimes-drag {\n top: 16px;\n height: 8px;\n background: url(/img/ljtimes/down.png?v=10005) no-repeat 0 0; \n cursor: pointer;\n }\n .i-ljtimes-click {\n overflow: hidden;\n display: block;\n position: absolute;\n top: 5px;\n left: 0;\n width: 46px;\n height: 18px;\n font: 0/0 serif;\n cursor: pointer;\n }\n .b-ljtimes-lwrapper .i-ljtimes-click {\n top: 0;\n width: 60px;\n height: 16px;\n background: url(/img/ljtimes/arrow.png?v=10005) no-repeat 0 0;\n }\n.b-ljtimes-inbox {\n position: fixed;\n bottom: 33px;\n right: 0;\n width: 300px;\n font: 11px/1.2 Arial,sans-serif;\n color: #000;\n z-index: 999;\n }\n .b-ljtimes-inbox-head {\n display:block;\n margin: 0;\n padding: 7px 10px;\n text-align: center;\n font-weight: normal;\n }\n .b-ljtimes-inbox-item {\n display:block;\n margin: 0;\n padding: 5px 10px 7px;\n list-style: none;\n border-top: 1px solid #C1C1C1;\n }\n .b-ljtimes-inbox-item:first-child {\n border: 0;\n }\n .b-ljtimes-inbox-item B {\n font-weight: normal;\n }\n .b-ljtimes-inbox-item IMG {\n vertical-align: -5px !important;\n }\n .b-ljtimes-inbox A:link,\n .b-ljtimes-inbox A:visited {\n color: #41789C !important;\n text-decoration: underline !important;\n border: 0 !important;\n }\n .b-ljtimes-inbox A:hover,\n .b-ljtimes-inbox A:active {\n color: #41789C !important;\n text-decoration: none !important;\n border: 0 !important;\n }\n .b-ljtimes-inbox .i-popup-arr {\n left: auto;\n right: 15px;\n margin: 0;\n }\n.b-ljtimes-update {\n position: fixed;\n bottom: 33px;\n right: 0;\n width: 380px;\n font: 11px/1.2 Arial,sans-serif;\n z-index: 9999;\n }\n .b-ljtimes-update .b-popup {\n position: static;\n }\n .b-ljtimes-logged-label {\n display: block;\n margin: 0;\n padding: 0;\n }\n .b-ljtimes-logged-input {\n overflow: hidden;\n display: block;\n margin: 1px 0 7px;\n padding: 1px;\n }\n .b-ljtimes-logged .i-ljtimes-text {\n width: 330px;\n margin: 0;\n padding: 2px 1px;\n font: 12px/1.2 Arial,sans-serif;\n }\n .b-ljtimes-logged .i-ljtimes-textarea {\n width: 330px;\n height: 65px;\n margin: 0;\n padding: 2px 1px;\n font: 12px/1.2 Arial,sans-serif;\n }\n .b-ljtimes-logged .i-ljtimes-tags {\n float: left;\n width: 180px;\n }\n .b-ljtimes-logged-submit {\n float: right;\n margin: 0;\n }\n .b-ljtimes-success {\n color: #000;\n }\n .b-ljtimes-success .b-popup-inner {\n padding: 30px;\n }\n .b-ljtimes-success-title {\n display: block;\n margin: 0 0 10px;\n font: bold 15px/1.2 Arial,sans-serif;\n text-align: center;\n }\n .b-ljtimes-success-body {\n display: block;\n line-height: 1.4;\n text-align: center;\n }\n .b-ljtimes-login {\n color: #000;\n font-size: 12px;\n }\n .b-ljtimes-login-form {\n position: relative;\n overflow: hidden;\n display:block;\n margin: 0;\n padding: 0;\n text-align: left;\n }\n .b-ljtimes-login-head,\n .b-ljtimes-logged-head {\n display:block;\n margin: 0 0 5px;\n padding: 0;\n font: bold 14px/1.2 Arial,sans-serif;\n color: #000;\n }\n .b-ljtimes-login-input {\n float: left;\n margin: 0;\n padding: 20px 5px 20px 1px;\n list-style: none;\n line-height: 1.2;\n }\n .b-ljtimes-login .i-ljtimes-text {\n width: 115px;\n margin: 0 0 5px;\n padding: 2px 1px;\n font: 12px/1.2 Arial,sans-serif;\n }\n .b-ljtimes-login .i-ljtimes-submit {\n vertical-align: -6px;\n }\n .b-ljtimes-login-create {\n position: absolute;\n top: 0;\n left: 0;\n }\n .b-ljtimes-login-remember {\n position: absolute;\n top: 45px;\n left: 0;\n }\n .b-ljtimes-login-lostinfo {\n position: absolute;\n top: 48px;\n left: 158px;\n }\n .b-ljtimes-login-connect {\n margin: 0;\n padding: 0;\n text-align: left;\n }\n .b-ljtimes-login-connect IMG {\n border: 0;\n margin: 0 3px 0 0;\n }\n .b-ljtimes-update A:link,\n .b-ljtimes-update A:visited {\n color: #41789C !important;\n text-decoration: underline !important;\n border: 0 !important;\n }\n .b-ljtimes-update A:hover,\n .b-ljtimes-update A:active {\n color: #41789C !important;\n text-decoration: none !important;\n border: 0 !important;\n }\n.b-ljtimes-bubble {\n position: absolute;\n left: 14px;\n width: 292px;\n margin: 0;\n padding: 0;\n font: 12px/1.2 Arial,sans-serif;\n color: #000;\n text-align: left;\n }\n .b-ljtimes-bubble-top,\n .b-ljtimes-bubble-bg,\n .b-ljtimes-bubble-close {\n display: block;\n position: absolute;\n margin: 0;\n padding: 0;\n font: 0/0 serif;\n }\n .b-ljtimes-bubble-top {\n top: 0;\n left: 0;\n width: 292px;\n height: 7px;\n background: url(/img/ljtimes/bubble-top.png?v=10269) no-repeat 0 0;\n }\n .b-ljtimes-bubble-content{\n overflow: hidden;\n position: relative;\n top: 7px;\n margin: 0;\n padding: 8px 15px 22px;\n }\n .b-ljtimes-bubble-head {\n position: relative;\n display: block;\n margin: 0 20px 5px 0;\n padding: 0;\n font-weight: bold;\n z-index: 2;\n }\n .b-ljtimes-bubble-p {\n position: relative;\n display: block;\n z-index: 2;\n }\n .b-ljtimes-bubble-bg {\n bottom: 0;\n left: 0;\n width: 292px;\n height: 357px;\n background: url(/img/ljtimes/bubble-bg.png?v=10269) no-repeat 0 0;\n z-index: 1;\n }\n .b-ljtimes-bubble-close {\n top: 8px;\n right: 16px;\n width: 12px;\n height: 12px;\n background: url(/img/ljtimes/bubble-close.gif?v=10269) no-repeat 0 0;\n cursor: pointer;\n z-index: 3;\n }\n.b-ljtimes-suggest,\n.b-ljtimes-suggestbbl {\n position: fixed;\n bottom: 33px;\n right: 0;\n width: 380px;\n font: 11px/1.2 Arial,sans-serif;\n color: #000;\n z-index: 999;\n }\n .b-ljtimes-suggest .i-ljtimes-text {\n width: 245px;\n margin: 0 0 5px;\n padding: 2px 1px;\n font: 12px/1.2 Arial,sans-serif;\n }\n .b-ljtimes-suggest-alert {\n margin: 0 0 5px;\n padding: 0;\n font: 11px/1.2 Arial,sans-serif;\n }\n .b-ljtimes-suggestbbl-alert {\n margin: 0 0 5px;\n padding: 0;\n font: 12px/1.2 Arial,sans-serif;\n }\n .b-ljtimes-suggest-input .i-ljtimes-submit {\n vertical-align: 0;\n }\n \n/* Pages without footer */\n.p-nofooter #ljtime_bottom {\n height: 21px !important; \n }\n.p-footer-lite #ljtime_bottom {\n height: 21px !important;\n }\n.p-footer-lite.ljtimes-minimized #ljtime_bottom {\n height: 0 !important;\n }\n\n'); /* * LJLive initializtion is done via *
    */ function ellipsis(node) { var s = document.documentElement.style, w = node.offsetWidth, clon = node.cloneNode(true); clon.style.position = "absolute"; clon.style.width = "auto"; clon.style.overflow = "visible"; clon.style.top = "-10000px"; node.parentNode.insertBefore(clon, node); if (clon.offsetWidth > w) { node.title = node[/*@cc_on"innerText"||@*/"textContent"]; // FF2, FF3 if (!("textOverflow" in s || "OTextOverflow" in s)) { var searcher = function(el, orig) { if (el.nodeType === 1 && el.tagName === "IMG") { orig.parentNode.removeChild(orig); el.parentNode.removeChild(el); } if (el.nodeType === 3) { var text = el.nodeValue; while (text.length > 0 && clon.offsetWidth > w) { text = text.substr(0, text.length - 1); el.textContent = text + "..."; } if (text.length) { orig.textContent = el.textContent // replace space on end .replace(/[\s\.\,\-]+\.\.\.$/, '...'); return true; } orig.textContent = el.textContent = ""; } var i; for (i = el.childNodes.length - 1; i >= 0; i--) { if (searcher(el.childNodes[i], orig.childNodes[i])) { return true; } } }; searcher(clon, node); } } else { node.title = ""; } clon.parentNode.removeChild(clon); return node; } LJLive = { is_full: false, getStateCode: function(state) { if (~navigator.userAgent.indexOf('iPad')) { return ''; } var normalState = !Cookie('ljlive-is-min') && state !== false, code = '
    ' +'' +'' +'' +'' +''; if (!normalState) { jQuery('body').addClass('ljtimes-minimized'); } var height = 21; if (normalState) { var param; if (Site.currentEntry) { param = {entry: Site.currentEntry}; } code += ''; height += 24; } var isServicePage = !LJ.get('currentJournal').length || !!LJ.get('scheme'); if (isServicePage) { code += '
    '; } else { code += '
    '; } return code; }, tagMousedown: function(e) { e = jQuery.event.fix(e); if (e.which !== 1) { return; } LJLive.writePostHide(); if (!$('ljtime_iframe')) { jQuery('' +'
    ').appendTo('body'); jQuery('#ljtime').addClass('b-ljtimes-opening'); cont.animate({ height: win.height() }, 1000, function(){ // don't use overflow: hidden for Quirks mode html.css('overflow-x', 'hidden').css('overflow-y', 'hidden'); node.css('left', 0); jQuery('#ljtime').removeClass('b-ljtimes-opening'); node.find('.i-ljtimes-btn') .animate({ top: 0 }, 100) .click(function(){ LJLive.is_full = false; // no jump win.scrollTop(last_scroll_top).scrollLeft(last_scroll_left); node .height(node.height()) .animate({ height: 24 }, function(){ node.remove(); html.css('overflow-x', html_overflow_x) .css('overflow-y', html_overflow_y); full.show(); win.scrollTop(last_scroll_top).scrollLeft(last_scroll_left); }); }); cont.height('auto'); }).css('overflow', 'visible'); }, messagesIsShow: false, messagesShow: function(target) { var node = jQuery(target).parents('.b-inbox'), show_node = jQuery('
    '+LJLive.ml.loading+'
    ') .appendTo('body'); var user_url = ''; if (/^(community|users)\./.test(location.host)) { user_url = '/'+Site.currentJournal; } this.initPopup(target, show_node, 'messages', function(target){ show_node.find('.b-popup-inner') .html(''+LJLive.ml.loading+''); jQuery.getJSON( user_url + '/__alerts/get.html', function(data) { if (!data.messages.length) { node.find('.arrow').html(0); show_node.remove(); } var rec_ids = [], html = '', i; data.messages = data.messages.splice(0, 5); for (i = -1; data.messages[++i];) { rec_ids.push(data.messages[i].rec_id); html += ''+data.messages[i].message+''; } show_node.find('.b-popup-inner').html(html); jQuery.post( user_url + '/__alerts/mark_readed.html', {rec_id: rec_ids.join(',')}, function(data){ +data.unread_count ? node.find('a').text(data.unread_count) : node.find('.arrow').html(0); }, 'json'); } ); }); LJLive.messagesShow(target); }, messagesHide: jQuery.noop, _loginNode: null, _loginShow: function(target, method) { if (!LJLive._loginNode) { LJLive._loginNode = jQuery('
    ' + LJLive.ml.html_login_form + '
    ').appendTo('body'); } var show_node = LJLive._loginNode; this.initPopup(target, show_node, method, jQuery.noop, true); LJLive[method + 'Show'](target); }, writePostIsShow: false, writePostShow: function(target) { if (!Site.has_remote) { LJLive._loginShow(target, 'writePost'); return; } var auth_token, right, html = '
    ' + LJLive.ml.html_submit_form + '
    ', show_node = jQuery(html).appendTo('body'), form_node = show_node.find('form'); this.initPopup(target, show_node, 'writePost', function(target){ jQuery.post(LiveJournal.getAjaxUrl('quick_post'), {get_auth: 1}, function(data){ auth_token = data.auth; }, 'json'); }, false, true); LJLive.writePostShow(target); form_node.find('input, textarea').placeholder(); form_node .submit(function(e){ jQuery.post(LiveJournal.getAjaxUrl('quick_post'), form_node.serialize() + '&auth_token=' + auth_token, function(data){ LJLive.writePostHide(); var html; if (data.error) { html = '
    ' +''+data.error+'' +'' +'
    '; } else { html = '
    ' +''+LJLive.ml.post_created_title+'' +''+LJLive.ml.post_created_body.replace('[[url]]', data.entry_url)+'' +'' +'
    '; form_node[0].reset(); form_node[0].send.disabled = true; } var node = jQuery(html) .appendTo('body') .css('right', right); node.find('a.ljtimes_again').click(function(e){ jQuery(document).mousedown(); // close LJLive.writePostShow(target); e.preventDefault(); }); node.find('.i-popup-close').click(function() { jQuery(document).mousedown(); // close }); node.mousedown(function(e){ e.stopPropagation(); }); jQuery(document) .add(node.find('.i-ljtimes-logged-close')) .one('mousedown', function(){ node.remove(); }); }, 'json'); e.preventDefault(); // Google Analytics LJLive.window._gaq.push(['_trackEvent', 'Mini LJTimes', 'post', 'Write form - posted']); }); form_node.find('textarea').input(function(){ form_node[0].send.disabled = !this.value.length; }); }, writePostHide: jQuery.noop, suggestBubble: null, suggestBubbleRemove: function() { if (LJLive.suggestBubble) { LJLive.suggestBubble.remove(); } }, suggestIsShow: false, suggestShow: function(target) { if (!Site.has_remote) { LJLive._loginShow(target, 'suggest'); return; } var show_node = jQuery(LJLive.ml.html_suggest_form) .mousedown(function(e) { e.stopPropagation(); }) .appendTo('body'), auth_token; this.initPopup(target, show_node, 'suggest', function(target){ if (Site.currentEntry) { jQuery(form_node[0].url).val(Site.currentEntry).placeholder().input(); } jQuery.post(LiveJournal.getAjaxUrl('lj_times_recommend'), {get_auth: 1}, function(data){ auth_token = data.auth; }, 'json'); }); var form_node = show_node.find('form'); jQuery(form_node[0].url) .placeholder() .input(function(){ form_node[0].send.disabled = !this.value || this.value === this.getAttribute('placeholder'); }); LJLive.suggestShow(target); form_node.submit(function(e){ form_node[0].send.disabled = true; jQuery.post(LiveJournal.getAjaxUrl('lj_times_recommend'), form_node.serialize() + '&auth_token=' + auth_token, function(data){ LJLive.suggestHide(); if (Site.currentEntry && Site.currentEntry == form_node[0].url.value) { jQuery('span', target).html( LJLive.ml.suggest_already.replace('[[num]]', data.currentEntryRecommendations) ); } var right = jQuery(window).width() - jQuery(target).offset().left - jQuery(target).width()/2 - 40, html = '
    ' +''+(data.ret || data.error)+'' +'' +'
    '; var node = jQuery(html) .appendTo('body') .css('right', right); node.find('a.ljtimes_again').click(function(e){ jQuery(document).mousedown(); // close LJLive.writePostShow(target); e.preventDefault(); }); node.find('.i-popup-close').click(function() { jQuery(document).mousedown(); // close }); node.mousedown(function(e){ e.stopPropagation(); }); jQuery(document) .add(node.find('.i-ljtimes-logged-close')) .one('mousedown', function(){ node.remove(); }); form_node[0].reset(); LJLive.window._gaq.push(['_trackEvent', 'Mini LJTimes', 'post', 'Suggest form - posted']); }, 'json'); e.preventDefault(); }); }, suggestHide: jQuery.noop, initPopup: function(target, show_node, method, showHandler, checkData, stayOnDocumentClick) { show_node.mousedown(function(e){ e.stopPropagation(); }); LJLive[method + 'Show'] = function(target) { LJLive[method + 'IsShow'] = true; show_node.show(); //we need to store method name with node, because every handler should close the popup //only if its above the correspoinding link show_node.data('method', method); var right = jQuery(window).width() - jQuery(target.parentNode).offset().left - target.parentNode.offsetWidth; right += target.parentNode.offsetWidth/2 - 40; // arrow of center show_node.css('right', Math.max(right, 4)); showHandler.call(this, target); }; LJLive[method + 'Hide'] = function(){ LJLive[method + 'IsShow'] = false; show_node .data('method', null) .hide(); }; show_node.find('.i-popup-close').click(LJLive[method + 'Hide']); if (!stayOnDocumentClick) { jQuery(document).mousedown(function(e, iframe_target) { var cur_method = !!checkData && show_node.data('method'), parent = iframe_target && iframe_target.parentNode; if (parent && parent.tagName.toLowerCase() === 'a' && target === parent) { return; } if (target !== iframe_target && (!checkData || !cur_method || cur_method === method)) { LJLive[method + 'Hide'](); } }); } }, calcTime: function(ts) { if (typeof ts === 'number') { var minutes = Math.ceil((LJLive.now - ts) / 60); ts = minutes + ' ' + LJLive.ml.timeText(minutes); } return ts; }, frameInit: function(frame) { LJLive.frame_body = frame.document.body; LJLive.ml = frame.ML_ljtimes; LJLive.now = frame.now; LJLive.window = frame; // fire event for main document jQuery(LJLive.frame_body) .mousedown(function(e){ jQuery(document).trigger('mousedown', e.target); }) // don't use stopPropagation // write post don't hide if mousedown on document .delegate('.b-update a', 'mousedown', function() { LJLive.suggestHide(); LJLive.suggestBubbleRemove(); !LJLive.writePostIsShow ? LJLive.writePostShow(this) : LJLive.writePostHide(); LJLive.window._gaq.push(['_trackEvent', 'Mini LJTimes', 'click', 'Write form - clicked']); }) .delegate('.b-inbox a', 'mousedown', function() { LJLive.writePostHide(); LJLive.suggestHide(); LJLive.suggestBubbleRemove(); !LJLive.messagesIsShow ? LJLive.messagesShow(this) : LJLive.messagesHide(); LJLive.window._gaq.push(['_trackEvent', 'Mini LJTimes', 'click', 'Messages']); }) .delegate('.b-suggest a', 'mousedown', function() { LJLive.writePostHide(); LJLive.suggestBubbleRemove(); !LJLive.suggestIsShow ? LJLive.suggestShow(this) : LJLive.suggestHide(); LJLive.window._gaq.push(['_trackEvent', 'Mini LJTimes', 'click', 'Suggest clicked']); }); jQuery('.b-update, .b-inbox', LJLive.frame_body).click(function(e){ e.preventDefault(); }); // Google Analytics jQuery('.b-random', LJLive.frame_body).click(function(){ LJLive.window._gaq.push(['_trackEvent', 'Mini LJTimes', 'click', 'Random journal']); }); // TODO after 14 remove with branding if (LJLive.feb14 === true) { // place hearts in right place var suggest_link = jQuery('.b-suggest a', LJLive.frame_body), love_pic = jQuery('').appendTo('#ljtime'); setTimeout(function() { var right = jQuery(window).width() - suggest_link.offset().left; //place upper part of picture right above bottom one love_pic.css('right', right + 'px').show(); }, 100); } }, insertAdditionalHTML: function() { jQuery('#ljtime').append( LJLive.ml.html_additional ); }, helpBubbleInit: function() { if (Cookie('ljlive-bubble') === '2') { return; } var $win = jQuery(window), $doc = jQuery(document); function show_bubble(text) { $win.unbind('scroll', check_to_show_bubble); $doc.unbind('mousemove', check_to_show_bubble); jQuery('#ljtime').unbind('mouseover', check_to_show_bubble); var bubble = jQuery(LJLive.ml.html_bubble).appendTo('#ljtime'); bubble .find('.b-ljtimes-bubble-p') .html(text); bubble .css('top', -bubble.height() - 27) .find('.b-ljtimes-bubble-close') .click(function(){ bubble.remove(); Cookie('ljlive-bubble', 1, { expires: 355, domain: '.'+location.host.match(/[^.]+\.\w+$/)[0], path: '/' }); // suggest bubble show_suggest_bubble(); }); } function show_suggest_bubble() { var bubble = jQuery(LJLive.ml.html_suggest_bubble), suggestLink = jQuery(LJLive.frame_body).find('.b-suggest a'), // arrow of center right = $win.width() - suggestLink.offset().left - suggestLink.width()/2 - 40; bubble .css('right', right) .find('.i-popup-close') .click(function(){ bubble.remove(); Cookie('ljlive-bubble', 2, { expires: 355, domain: '.'+location.host.match(/[^.]+\.\w+$/)[0], path: '/' }); }) .end() .appendTo('#ljtime'); LJLive.suggestBubble = bubble; } var timeout; function check_to_show_bubble(e) { clearTimeout(timeout); switch(e.type) { case 'mousemove': // user rests timeout = setTimeout(function(){ show_bubble(LJLive.ml.bubble_rests); }, 1000*60); break; case 'scroll': // bottom page if ($win.scrollTop() + $win.height() === $doc.height()) { show_bubble(LJLive.ml.bubble_scroll); } break; case 'mouseover': show_bubble(LJLive.ml.bubble_mouseover); break; } } if (!Cookie('ljlive-bubble')) { $win.scroll(check_to_show_bubble); $doc.mousemove(check_to_show_bubble); jQuery('#ljtime').mouseover(check_to_show_bubble); } else if (Cookie('ljlive-bubble') === '1') { show_suggest_bubble(); } }, dataInit: function(data) { if (data.mode === 'night') { jQuery('.b-ttiny', LJLive.frame_body).addClass('b-ttiny-night'); } var i; for (i = -1; data.live[++i];) { data.live[i].text = data.live[i].text + ', ' + LJLive.calcTime(data.live[i].ts); } // TODO: delete if (LJLive.window.additional_data) { var i = -1; for (; LJLive.window.additional_data[++i]; ) { data.live.splice(Math.round(i*2.3), 0, LJLive.window.additional_data[i]) } } for (i = -1; data.themes[++i];) { data.themes[i].text = data.themes[i].text + ', ' + LJLive.calcTime(data.themes[i].ts); } // poor implementation, see 'Fisher–Yates shuffle' function randomSort() { return Math.round(Math.random()) - 0.5; } var text_ary = data .live.concat(data.themes) .sort(randomSort); /* * Insert each item from 'from' array to * 'dest' array in position = (repeat * index) * * @param {Array} dest Destanation array to mutate * @param {Array} from Where to get values to insert * @param {Number} repeat * @param {Number} [shift] Index to start from. Default to 0 * * @example * var z = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] * * mix(z, ['a', 'b', 'c'], 5) * // [1, 2, 3, 4, 5, "a", 6, 7, 8, 9, 10, "b", 11, 12, 13, 14, 15, "c"] * * mix(z, ['a', 'b', 'c'], 5, 3) * // [1, 2, "a", 3, 4, 5, 6, 7, "b", 8, 9, 10, 11, 12, "c", 13, 14, 15] */ function mix(dest, from, repeat, shift) { shift = shift || 0; for (var i = 0; i < from.length; i++) { var index = (i + 1) * repeat + i - shift; if (index < dest.length) { dest.splice(index, 0, from[i]); } else { dest.push(from[i]); } } } // LJSUP-16340 mix(text_ary, data.ljmap.sort(randomSort), 5, 4); if (text_ary.length) { i = 0; var last_node, before_last_node, post_container = jQuery('.b-posts', LJLive.frame_body), logo_width = jQuery('.b-logo', LJLive.frame_body).outerWidth(), interval, anim_complete = true, fade_nodes = function( in_node, out_node ) { var anim_count = 2, fadeFinshed = function() { anim_count--; anim_complete = anim_count === 0; }; anim_complete = false; out_node.fadeTo(800, 0, function() { jQuery(this).remove(); fadeFinshed(); } ); in_node.fadeTo(800, 1, function() { fadeFinshed(); } ); }, interval_func = function() { if( !anim_complete ) { return; } if (!text_ary[i+1]) { i = -1; } var post_data = text_ary[++i], node = jQuery('
  • '+post_data.text+'
  • ', LJLive.frame_body.ownerDocument), width = jQuery(window).width() - logo_width - jQuery('.b-quick', LJLive.frame_body).outerWidth() - jQuery('.b-inbox', LJLive.frame_body).width(); node .mouseenter(function(){ clearInterval(interval); }) .mouseleave(function(){ clearInterval(interval); interval = setInterval(interval_func, 5000); }) .css('width', width); if (last_node) { node.css('opacity', 0); } node.appendTo(post_container); ellipsis(node[0]); if (last_node) { fade_nodes( node, last_node ); } //Google Analytics var click_node = node.find('a:first'); if (!click_node[0].onclick) { click_node.click(function(e) { LJLive.window._gaq.push(['_trackEvent', 'Live - mini ljtimes', 'click', this.href]); // if no new tab if (this.target !== '_blank' && !(e.metaKey || e.altKey || e.shiftKey || e.ctrlKey) && e.which === 1) { setTimeout('top.location="' + this.href + '"', 100); e.preventDefault(); } }); } last_node = node; }; interval = setInterval(interval_func, 5000); interval_func(); } LJLive.insertAdditionalHTML(); jQuery(document).trigger('ljliveReady'); } }; (function($) { $(function() { $('[data-ljlive]').replaceWith( LJLive.getStateCode( LJ.get('ljtimes_min') ? false : true ) ); }); })(jQuery); ; /* file-end: js/ljlive.js ----------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------- file-start: js/ljlive/brand.double.js */ /* --------------------------------------------------------------------------------- file-start: js/jquery/jquery.lj.sprite.js */ /** * @name $.lj.sprite * @requires $.ui.core, $.ui.widget, $.lj.basicWidget * @author anazarov@sup.com (Alexander Nazarov) * @class Provides basic sprite animation */ (function ($) { /** @lends $.lj.sprite.prototype */ $.widget('lj.sprite', $.lj.basicWidget, { options: { infinite: true }, _create: function() { $.lj.basicWidget.prototype._create.apply(this); this._queue = []; this._data = this.element.data('frames'); }, /** * Start animation */ start: function () { var frame, data = this._data; if (this._queue.length || this._timeout) { // We have frames to show return; } for (frame in data) { if (data.hasOwnProperty(frame)) { this._queue.push(data[frame]); } } this._trigger('start'); this._nextFrame(); }, /** * Stop animation */ stop: function () { clearTimeout(this._timeout); }, /** * Resume animation */ resume: function () { this._nextFrame(); }, _nextFrame: function () { var frame, duration, x, y; if (!this._queue.length) { delete this._timeout; this._trigger('end'); if (this.options.infinite) { this.start(); } return; } frame = this._queue.shift() || {}; duration = frame.duration || 1000; x = frame.x || 0; y = frame.y || 0; this.element.attr('style', 'background-position: ' + x + 'px ' + y + 'px' + ' !important'); this._timeout = setTimeout(this._nextFrame.bind(this), duration); } }); })(jQuery); ; /* file-end: js/jquery/jquery.lj.sprite.js ----------------------------------------------------------------------------------*/ ;(function ($) { 'use strict'; $(document).on('ljliveReady', function () { var brandMain = $('.b-ljtimes-brand'), brandAdditional = $('.b-ljtimes-brand-frame'), infinite = false; brandMain.sprite({ infinite: infinite, start: function () { brandMain.addClass('b-ljtimes-brand-move'); }, end: function () { brandMain.removeClass('b-ljtimes-brand-move'); } }); brandAdditional.sprite({ infinite: infinite }); brandMain.on('hover', function () { brandMain.sprite('start'); brandAdditional.sprite('start'); }); }); }(jQuery));; /* file-end: js/ljlive/brand.double.js ----------------------------------------------------------------------------------*/