/* * (c) 2000-2013 deviantART, Inc. All rights reserved. */ window.GPage=GMIBase.extend({init:function(){this.ownerid=this.gmiUp("Gruser").gmi_args.id,this.id=this.gmi_args.id,this.name=this.gmi_args.name},findBluesBar:function(t){var n,e;for(t=t||"blues-bar-ctrl",n=this.gmiUp("Gruser").gmi_node.getElementsByTagName("div"),e=0;e!=n.length;e++)if((" "+n[e].className+" ").indexOf(" "+t+" ")>-1)return n[e]},findBluesBarButtons:function(){return this.findBluesBar("gmbutton2town")},setBluesBarButtons:function(t){var n;n=this.findBluesBarButtons(),this.blues_buttons_backup||(this.blues_buttons_backup=n.innerHTML),n.innerHTML=t||this.blues_buttons_backup},findCoreOutput:function(){var t=document.getElementById("gruze-main");if(t)return t;var n,e=this.gmi_node.getElementsByTagName("td");for(n=0;n!=e.length;n++)if(e[n].className.indexOf("gruze-main")>=0)return e[n]}}),window.DWait&&DWait.run("jms/pages/gruzecontrol/gpage.js"); window.GZone=GMIBase.extend({}),window.DWait&&DWait.run("jms/pages/gruzecontrol/gzone.js"); DWait.ready(["jms/lib/gwebpage.js","jms/lib/gmi.js","jms/pages/gruzecontrol/gpage.js","jms/pages/gruzecontrol/gruserutils_textdown.js","jms/lib/jquery/plugins/jquery.select.pager.js","jms/lib/cssvault.js","jms/lib/popup2.js","jms/pages/gruzecontrol/gruser.js","cssms/pages/grusers/editmode.css","cssms/lib/jquery/jquery.select.pager.css"],function(){DWait.init("GMFrame_Gruser.new_set",function(e){var i=$(e),t=i.closest(":gmi(GMFrame_Gruser)").gmi1(),s=i.closest(":gmi(GalleryEditor)").gmi1();i.on("click.new_set",function(){t&&t.saveAndChangeView(),s&&s.updateChannels()})}),CANCEL_CLICK=";if (window.event)event.cancelBubble=true;try{this.blur()}catch(e){}return false;",window.GMFrame_Gruser=GMIBase.extend({gmiConstructor:function(){delete this.gmi_args.privileges,this.match_load_view_id=100,this.current_view=this.expected_view=this.gmi_args.view,this.api=this.gmi_args.api||"GrusersModules",this.position=this.gmi_args.position,this.version=this.gmi_args.version,this.setBehavior(this.gmi_args.behavior||{}),this.gruser_id=this.gmi_args.gruser_id,this.probably_not_changed=!0,this.gmi_node.firstChild||this.gmi_node.appendChild(document.createTextNode(" ")),this.templates=this.templates_cruise,this.cruise_control=!0,this.canBehave("difi_query_hook")&&this.refreshControlHTML()},gmiDestructor:function(){this.has_css&&CSSVault.apply("gmf"+this.gmi_args.id," ")},extractNode:function(){if(this.backup_node)throw Error("this.backup_node already exists");this.backup_node=this.gmi_node,this.gmi_node=this.gmi_node.cloneNode(!0)},returnNode:function(){if(!this.backup_node)throw Error("There is no this.backup_node to restore");this.backup_node.parentNode.replaceChild(this.gmi_node,this.backup_node),delete this.backup_node},templates:{configButtonHTML:'Edit',fauxConfigButtonHTML:'Edit',submitButtonHTML:'New',menuButtonHTML:'Menu'},templates_cruise:{configButtonHTML:'Edit',submitButtonHTML:'New',menuButtonHTML:'Menu'},refreshControlHTML:function(){var e,i;if(!this.canBehave("no_frame_buttons")){if(i=this.getMainNode(),((this.gmi_node.firstChild||{}).className||"").indexOf("gm-controls")>=0){if(this.gmi_node.firstChild.className="gm-controls"+(this.isConfigView(this.current_view)?" gm-controls-config":""),e=[],(this.canBehave("button_editing")||this.canBehave("edit")||this.canBehave("delete")||this.canBehave("faux_edit")||this.gmi_args.privileges&&!this.view_context&&this.current_view==this.gmi_args.view)&&(this.canBehave("edit")||this.canBehave("delete")||!this.canBehave("faux_edit")||this.cruise_control?e.push(this.templates.configButtonHTML):e.push(this.templates.fauxConfigButtonHTML),this.canBehave("button_editing")&&(e[e.length-1]=this.cruise_control?e[e.length-1].replace(/class="/,'class="gm-chaos-current '):e[e.length-1].replace(/d;d++){var c=s[d].replace(/[\[\]]/g,""),l=!1;if(""==c){for(;h[r[h]];)r[h]++;c=r[h],l=!0}d==s.length-1?l&&"select-multiple"==e[t].type?jQuery("option:selected",e[t]).each(function(){c=r[h]++,h[c]=this.value}):h[c]=e[t].value:(h[c]||(h[c]={},r[h[c]]=0),h=h[c])}}else n[e[t].name]=e[t].value}return this.canBehave("save_extras")&&(n.save_extras=this.canBehave("save_extras")),n},saved:function(e,i,t){var s,n;for(s=0;s!=e.length;s++)e[s].disabled=!1;return i&&t.response.content.html?("[self_only]"!=this.expected_view||t.response.content.has_errors||t.response.content.view==this.current_view||(this.expected_view=this.current_view,this.pretendView(null),this.save_hook_hax&&this.save_hook_hax(!0,{response:{content:{}}})),this.expected_view in{"[whatever_save_sends]":1,"[self_only]":1}?(this.save_hook_hax&&this.save_hook_hax(!1,{response:{content:{error:"The server returned an unexpected view: "+t.response.content.view}}}),this.displayCachedBody(t.response.content.view,t.response.content.html||'[x]',t.response.content.frame_behavior||{}),this.pretendView(null),this.importGWebPage(t.response.content),void 0):(this.cached_nodes={},this.cached_behavior={},void 0)):(this.expected_view in{"[whatever_save_sends]":1,"[self_only]":1}&&(this.expected_view=this.current_view,this.quit_now=!0,this.pretendView(null)),n=i?'Cannot redirect to "'+t.response.content.view+'"\n\nServer returned blank view.':"VERSION_MISMATCH"==(t.response.content.error||{code:""}).code?"Your settings were not saved because newer settings were found on the server.":((t.response.content||{}).error||{}).human||(this.save_hook_hax?null:"Some of your settings were not saved, due to a "+(t.request?"server":"connection")+" error."),this.save_hook_hax?this.save_hook_hax(!1,{response:{content:{error:n}}}):alert(n),void 0)},displayCachedBody:function(e,i,t){var s,n;return e!=this.current_view||i?(this.cached_nodes||(this.cached_nodes={}),this.cached_behavior||(this.cached_behavior={}),i||(i=this.cached_nodes[e],t=this.cached_behavior[e]),i?(n=this.getMainNode(),this.current_view==this.gmi_args.view&&(this.cached_nodes[this.current_view]=n,this.cached_behavior[this.current_view]=this.current_behavior),"string"==typeof i&&(s=document.createElement("div"),s.innerHTML=i,i=s.getElementsByTagName("*")[0]||s.firstChild||document.createTextNode("[?]")),this.previous_view=this.current_view,this.expected_view=e,this.current_view=e,this.setBehavior(t),this.refreshControlHTML(),this.playTransition(i,n),this.probably_not_changed=!0,GMI.query("GruserUtils_TextDown"),!0):void 0):!0},getMainNode:function(e){var i=(e||this.gmi_node).getElementsByTagName("div");return i[0].className.indexOf("gm-controls")>=0?(i[1]||(i[1]=document.createElement("div"),this.gmi_node.appendChild(i[1])),i[1]):i[0]},getTitle:function(){var e;return(e=this.canBehave("arranger_title"))?e:(e=(this.gmi_node.getElementsByTagName("h2")||[])[0],e?e.textContent||e.innerText:"Unknown Widget")},accessClick:function(){this.pretendView("access"),GMAccess.show(this.getGruserID(),"module",this.gmi_args.id,"view"==this.gmi_args.access,this.getTitle(),bind(this,this.accessDone))},accessDone:function(e){this.pretendView(!1),e&&this.isConfigView(this.current_view)&&!(this.gmi_node.getElementsByTagName("textarea")||[])[0]&&this.loadView(this.current_view,!0)},configClick:function(e,i){var t=function(e,i){var t;return t=new Popup2("GmframeGruser"+e,"body",{classes:"cruiser",created:function(e){e.$node.attr("gmi-redirect",this.gmi_node.getAttribute("gmindex"))}.bindTo(this),hidden:function(){$(i).removeClass("active")},shown:function(){$(i).addClass("active")},destroy:!0})};if(Popup2.hideAll(),this.canBehave("button_editing")){if(this.cruise_control&&e){var s=t.call(this,"Editing",e);return s.content='
Save and ExitExit Without Saving
',s.render(),"function"==typeof i&&i(s.$node.get(0)),s.show(s.position($(e).parent(),{align:"right"})),void 0}this.maybeSave()}else if(this.canBehave("edit")||this.canBehave("delete")||i){if(this.cruise_control&&e&&!this.canBehave("no_menus")){var s=t.call(this,"Edit",e),n="string"==typeof i?i:"",r=n?"normal":"bold";return s.content='
'+(n+(this.canBehave("edit")?''+("string"==typeof this.canBehave("edit")?this.canBehave("edit"):"Edit this Widget")+"":"")+(!this.canBehave("delete")||!this.gmiUp("GZone")||window.Modals&&Modals.stack.length?"":'Remove this Widget')||'
This Widget Has No Options
')+"
",s.render(),"function"==typeof i?i(s.$node.get(0)):"append"==this.canBehave("custom_config_menu")&&$(this.gmi_node).find(".custom_config_menu>a").clone().appendTo(s.$node.find(".blockmenu")),s.show(s.position($(e).parent(),{align:"right"})),void 0}var a=this.canBehave("edit_arguments");this.loadView(this.canBehave("edit_view"),a)}else{if(!this.gmi_args.privileges||this.view_context)throw Error("Can't edit");this.loadView("[fake_config]")}},addButtons:function(e,i){var t;if(t=this.isConfigView(this.current_view)&&this.gmi_args.privileges&&!this.view_context,this.canBehave("button_save_cancel")||t)if(this.view_context)this.view_context.setControls(this);else{var s;s=document.createElement("div"),s.className="gr-hijack c pp",s.innerHTML=(!i&&this.canBehave("delete")&&this.isConfigView(this.current_view)?'
'+(this.canBehave("delete")?'Remove...
':"")+(((this.gmiUp("GPage")||{}).gmi_args||{}).layoutable&&!((this.gmiUp("Gruser")||{}).gmi_args||{}).group?'Rearrange...':"")+"
":"")+''+("manage"==t||this.canBehave("button_save_cancel")?'":"view"==t?'":"")+"
Save'+''+'Cancel'+"Done'+"
",e.appendChild(s)}else this.view_context&&this.view_context.setControls(null)},createPrivEditor:function(e){this.priv_editor=GMI.create("GMPrivs",{owner:this,callback:e,read_only:"view"==this.gmi_args.privileges,model:"actions"}),this.priv_editor.gmi_node.style.display="none",this.priv_editor.gmi_node.className="ppp",this.priv_editor.load()},configViewTab:function(e,i){var t,s,n,r;switch(s=e.parentNode.parentNode.parentNode,i){case"privileges":if(this.priv_editor||this.createPrivEditor(bind(this,arguments.callee,e,i)),s.insertBefore(this.priv_editor.gmi_node,e.parentNode.parentNode.nextSibling),!this.priv_editor.isReady())return this.pretendView("config"),void 0;this.pretendView(null),r=this.priv_editor.gmi_node;break;case"history":if(!this.history_node)return this.history_node=document.createElement("div"),this.history_node.style.display="none",s.insertBefore(this.history_node,e.parentNode.parentNode.nextSibling),this.pretendView("config"),DiFi.pushPrivateGet(this.api,"displayModule",[this.getGruserID(),this.gmi_args.id,"view_log",{}],bind(this,function(e,i,t){var s;i?(s=document.createElement("div"),s.innerHTML=t.response.content.html||'
[??]
',this.history_node.appendChild((this.gbb(s)||s).getElementsByTagName("div")[0]||s)):this.history_node.innerHTML='
[?]
',e()},bind(this,arguments.callee,e,i))),DiFi.timer(1),void 0;this.pretendView(null),r=this.history_node}for(t=0;t!=e.parentNode.childNodes.length;t++)e.parentNode.childNodes[t].className=e.parentNode.childNodes[t]==e?"selected":"";for(t=0;n=s.childNodes[t];t++)"DIV"==n.tagName&&0>(" "+n.className+" ").indexOf(" gr-hijack ")&&(n.style.display=n==this.history_node||n==(this.priv_editor||{}).gmi_node?n==r?"block":"none":r?"none":"block")},gbb:function(e){var i,t,s;for(i=e.getElementsByTagName&&e.getElementsByTagName("div")||[],t=-1;t!=i.length;t++)if(s=-1==t?e:i[t],(" "+s.className+" ").indexOf(" gr-body ")>=0)return(s.getElementsByTagName("div")||[])[0]},playTransition:function(e,i){var t,s,n,r,a,o,h,d;if(o=300,h=Interpolators.pulse,s=this.gbb(e),n=this.gbb(i),s&&n&&!this.disable_transitions){if(this.addButtons(s),e.style.position="absolute",e.style.width=i.offsetWidth+"px",e.style.zIndex=40,i.style.position="relative",i.style.zIndex=50,i.parentNode.insertBefore(e,i),"generic"!=this.current_view&&window.$j)try{var c={};this.canBehave("uplifted_dropdowns")&&(c.className="select_pager select_pager_uplifted",c.optionPadding=14),this.canBehave("big_dropdowns")&&(c.maxLength=1e3),$("select",e).selectpager(c)}catch(l){}if(r=s.offsetHeight,a=n.offsetHeight,4>Math.abs(e.offsetHeight-r-(i.offsetHeight-a)))for(t=[[s],[n]],r>a?(s.parentNode.style.overflow="hidden",t[0].push("marginTop"),t[1].push("paddingBottom"),t[0].push({from:a-r,to:0,time:o,f:h}),t[1].push({from:0,to:r-a,time:o,f:h})):(n.parentNode.style.overflow="hidden",t[0].push("paddingBottom"),t[1].push("marginTop"),t[0].push({from:a-r,to:0,time:o,f:h}),t[1].push({from:0,to:r-a,time:o,f:h})),t.push([i,"opacity",{from:1,to:0,time:o,f:h},bind(this,this.aniNodeDone,e,i,n)]),d=0;d!=t.length;d++)this.animating_view=!0,Station.run.apply(Station,t[d]);else this.aniNodeDone(e,i,n)}else this.addButtons(e),i.parentNode.insertBefore(e,i),this.aniNodeDone(e,i,n)},aniNodeDone:function(e,i,t){this.animating_view=!1,e.style&&(e.style.position="relative",e.style.width="auto"),i.parentNode&&(i.parentNode.removeChild(i),this.previousViewCleanup(),Station.apply(i,"opacity",1),t&&(Station.apply(t,"marginTop",0),Station.apply(t,"paddingBottom",0)))},isConfigView:function(e){return this.is_inplace_editing||e in{config:1,"[fake_config]":1}},previousViewCleanup:function(){!this.isConfigView(this.current_view)&&this.priv_editor&&(GMI._delete(this.priv_editor),delete this.priv_editor)},popView:function(){this.is_inplace_editing=!1,this.loadView(this.previous_view||this.gmi_args.view),this.previous_view=null},preCancelHook:null,cancelView:function(){(!this.preCancelHook||this.preCancelHook())&&($(this.gmi_node).trigger("gmframe_cancel"),this.popView())},fetchBody:function(e,i){"object"!=typeof i&&(i={}),DiFi.pushPrivateGet(this.api,"displayModule",[this.getGruserID(),this.gmi_args.id,e,i],bind(this,function(e,i,t){return i?(e==this.match_load_view_id&&(this.displayCachedBody(t.request.args[2],t.response.content.html||'[x]',t.response.content.frame_behavior||""),this.pretendView(null),this.importGWebPage(t.response.content)),void 0):(t.request&&t.request.args[2]!=this.expected_view||(alert((t.request?'"'+t.request.args[2]+'"':"Edit mode")+" is currently unavailable.\n\nPlease try again soon."),t.request&&"config"==t.request.args[2]&&this.gmi_args.privileges&&!this.view_context?this.loadView("[fake_config]"):this.loadView(this.gmi_args.view)),void 0)},++this.match_load_view_id)),DiFi.timer(1)},getGruserID:function(){if(!this.gruser_id){var e=this.gmiUp("Gruser");e||(e=$("#gmi-Gruser").gmi1()),this.gruser_id=e?e.gmi_args.id:null}return this.gruser_id},importGWebPage:function(e){gWebPage.update(e,null,this.gmi_node),e.css&&window.CSSVault&&(this.has_css=!0,CSSVault.apply("gmf"+this.gmi_args.id,e.css))},editInPlace:function(e){this.is_inplace_editing=!0;var i=jQuery(this.gmi_node),t=i.find("a").attr("disabled",!0);t.click(function(e){var i=jQuery(this);return i.attr("disabled")?i.parents(".gr-configbox").length>0?(e.preventDefault(),!1):!0:!0});var s=GMI.query(this.getMainNode(),"GInPlace");jQuery.each(s,function(i){this.edit(),e&&0==i&&this.$input.focus()}),e?jQuery(this.gmi_node).find("a.toast").hide():jQuery(this.gmi_node).find("a.toast").show()},gmAction:function(e,i){var t={type:"gm-action",context:e};if(e){var s=$(e);t.action=i||s.attr("gmi-action"),t.callback=s.attr("gmi-callback")||""}return $(this.gmi_node).trigger(t),window.event&&(event.cancelBubble=!0),!1}}),window.DWait&&DWait.run("jms/pages/gruzecontrol/gmframe_gruser.js")}); DWait.ready(["jms/legacy/modals.js","jms/lib/gwebpage.js","jms/pages/gruzecontrol/gmframe_gruser.js"],function(){window.WidgetUtils={modal:function(e,t,i,s,r,o,n,d,a){var u,l,g;difi=function(e,t){if(!e)return DiFi.stdErr("Sorry, an error has occurred!",t.response.content),Modals.pop(),void 0;u.html(t.response.content.html||"[x]");var i=u.get(0);Station.run((i.getElementsByTagName("*")||[])[0]||i,"opacity",{from:.01,to:1,time:700,f:Interpolators.sineCurve}),"displayModule"==t.request.method&&GMI.apply(i,"GMFrame_Gruser",{id:t.request.args[1],view:t.request.args[2]}),window.Shadows&&setTimeout(Shadows.nodes,1),window.Keeper&&setTimeout(Keeper.master_on,1),gWebPage.update(t.response.content,null,i),"displayModule"!=t.request.method&&GMI.query(i,"GMFrame_Gruser")},n||(n={w:430,h:196}),Glbl("Site.is_mobile")&&(n.w=$(window).width()),u=$("
").addClass("chn").css({width:n.w,height:n.h}),d?(u.css({background:"transparent"}),a="modal-rounded "+(a||"")):u.css({background:"#D8E0DC"}),u.html('

Loading...

'),i?DiFi.pushPrivateGet(e,"findAndDisplayModule",[t,i,s,r||"generic",o||{}],difi):DiFi.pushPrivateGet(e,"displayModule",[t,s,r||"generic",o||{}],difi),DiFi.send(),l=Modals.push(d?Modals.factory(u):u.get(0),null,a),$(window).bind("modal_resize",function(e,t,i,s){u.width(i).height(s)}),(g=GMI.query("Gruser")[0])&&l.setAttribute("gmi-redirect",g.gmi_node.getAttribute("gmindex"))}},window.DWait&&DWait.run("jms/pages/gruzecontrol/widgets/utils.js")}); DWait.ready(["jms/pages/gruzecontrol/gmframe_gruser.js","jms/pages/gruzecontrol/bluesbar.js","jms/lib/station.js","jms/lib/difi.js","jms/lib/popup2.js"],function(){window.GMFrame_BluesBar=GMFrame_Gruser.extend({gmiConstructor:function(){this.base(),this.refreshControlHTML(),(this.gmiUp("Gruser")||this).gmi_args.group&&delete this.EDITABLE_CLASSES.stats},configClick:function(){"config_bar"==this.current_view?this.maybeSave():this.loadView("config_bar")},currentPopupIs:function(e){this.current_popup=e,this.refreshControlHTML()},showEditHint:function(e){var t,i,s;s=this.gmi_node.getElementsByTagName("a")[0],BluesBar.hiddenMenu(s,!0),t=this.hint_popup||new Popup2("BluesBarHint","body",{classes:"gruserhint",content:'<- Hint: To change '+e+", click edit.",created:function(){this.$node.css("z-index",300)}}),this.hint_popup=t,i=t.position($(".popup2-gruser-why .gm-controls .gm-chaos-edit"),{align:"right",valign:"undertop",bump:{top:-10}}),t.show(i)},EDITABLE_CLASSES:{why:1,activity:1,stats:1},saveAndChangeView:function(){this.base(this.current_popup.$node.get(0))},loadView:function(e,t,i){this.hint_popup&&this.hint_popup.hide(),this.base(e,t,i)},refreshControlHTML:function(){var e,t,i,s;if(this.current_popup)for(e in this.EDITABLE_CLASSES)0>(" "+this.current_popup.$node.get(0).className+" ").indexOf("-"+e+" ")||(t=this.current_popup.$node.first().get(0),t.setAttribute("gmi-redirect",this.gmi_node.getAttribute("gmindex")),0>(" "+t.firstChild.className+" ").indexOf(" gm-controls ")&&(i=document.createElement("div"),t.insertBefore(i,t.firstChild)),"config_bar"!=this.current_view?(t.firstChild.className="gm-controls",t.firstChild.innerHTML=this.canBehave("edit")?this.templates.configButtonHTML:""):(t.firstChild.className="gm-controls gm-controls-config gm-fakeout",t.firstChild.innerHTML=this.cruise_control?this.templates.configButtonHTML.replace(/class="/,'class="gm-chaos-current '):this.templates.configButtonHTML.replace(/=0?t[1]:t[0]):this.gmi_node},animatePopup:function(e,t){var i;i=175,this.current_popup&&(e||t)&&(this.current_popup.$node.css("overflow","hidden"),t&&Station.push(this.current_popup.$node.get(0),"height",{from:parseInt(Station.read(this.current_popup.$node.get(0),"height")),to:t,time:i,f:Interpolators.pulse},"overflow",{to:"visible"}),e&&Station.push(this.current_popup.$node.get(0),"width",{from:parseInt(Station.read(this.current_popup.$node.get(0),"width")),to:e,time:i,f:Interpolators.pulse}))},playTransition:function(e,t){function i(e){var t,i;if(e&&e.getElementsByTagName)for(t=e.getElementsByTagName("div"),i=-1;i!=t.length;i++)if(d=-1==i?e:t[i],(" "+d.className+" ").indexOf(" gr-body ")>=0)return(d.getElementsByTagName("div")||[])[0]}switch(BluesBar.menu_on&&BluesBar.menu_on.href.split("-").pop()){case"why":this.current_popup&&("config_bar"==this.current_view?$(BluesBar.menu_on).hasClass("super-secret-why-short")?this.current_popup.$node.css("height","450px"):this.current_popup.$node.css("height","580px"):this.current_popup.$node.css("height","auto"));break;case"stats":"config_bar"!=this.current_view&&this.current_popup&&BluesBar.verify("stats",e);break;case"activity":"config_bar"!=this.current_view&&this.current_popup&&BluesBar.verify("activity",e)}var s,n,r,o,a,u;a=400,u=Interpolators.pulse,s=e&&i(e),n=t&&i(t),s&&n?(this.addButtons(s,!0),e.style.position="absolute",e.style.width=t.offsetWidth+"px",e.style.zIndex=40,t.style.position="relative",t.style.zIndex=50,t.parentNode.insertBefore(e,t),r=s.offsetHeight,o=n.offsetHeight,this.aniNodeDone(e,t,n)):(t.parentNode.insertBefore(e,t),this.aniNodeDone(e,t,n))},aniNodeDone:function(e,t){e.style.position="static",e.style.width="auto",t.parentNode&&t.parentNode.removeChild(t)},displayCachedBody:function(e,t,i){var s,n,r,o,a,u,p;if(e==this.current_view&&!t)return!0;if(this.cached_nodes||(this.cached_nodes={}),this.cached_behavior||(this.cached_behavior={}),t||(t=this.cached_nodes[e],i=this.cached_behavior[e]),t){if(a=this.getMainNode(),this.current_view==this.gmi_args.view&&(this.cached_nodes[this.current_view]=a,this.cached_behavior[this.current_view]=this.current_behavior),"config_bar"!=e&&"string"==typeof t){for(;this.gmi_node.firstChild;)this.gmi_node.removeChild(this.gmi_node.firstChild);if("string"==typeof t?this.gmi_node.innerHTML=t:this.gmi_node.appendChild(t),BluesBar.menu_on){for(u=BluesBar.menu_on.href.split("#").pop(),r=this.gmi_node.getElementsByTagName("a"),n=0;n!=r.length;n++)r[n].href.split("#").pop()==u&&(BluesBar.menu_on=r[n],BluesBar.menu_on.className+=" active",BluesBar.ieFix(r[n]));!Browser.isIE&&this.current_popup.$node.get(0).previousSibling&&document.body.appendChild(this.current_popup.$node.get(0).previousSibling),document.body.appendChild(this.current_popup.$node.get(0)),t=document.getElementById(u).getElementsByTagName("*")[0].cloneNode(!0),u&&"why"==u.split("-").pop()&&setTimeout(bind(this,this.updateTagLine),10)}}else if("string"==typeof t&&(o=document.createElement("div"),o.innerHTML=t,t=o.getElementsByTagName("*")[0]),"config_bar"==e){for(u=BluesBar.menu_on.href.split("-").pop(),s=t.getElementsByTagName("div"),p=[],n=0;n!=s.length;n++)0==s[n].className.indexOf("bluesbar-config-")&&s[n].className!="bluesbar-config-"+u&&p.push(s[n]);for(n=0;n!=p.length;n++)p[n].parentNode.removeChild(p[n])}return this.previous_view="config"==e?null:this.current_view,this.expected_view=e,this.current_view=e,this.setBehavior(i),this.refreshControlHTML(),this.playTransition(t,a),GMI.query("GruserUtils_TextDown"),!0}},updateTagLine:function(){document.getElementById("gruser-tagline").innerHTML=document.getElementById("super-secret-tagline").innerHTML}}),window.DWait&&DWait.run("jms/pages/gruzecontrol/gmframe_bluesbar.js")}); GruserUtils_TextDown=GMIBase.extend({gmiConstructor:function(){var t;this.focus=bind(this,this.focus),this.select=this.gmi_node.getElementsByTagName("select")[0],this.hidden=this.gmi_node.getElementsByTagName("input")[0],this.neutral=this.gmi_args.neutral,this.default_input=this.gmi_args.default_input||"To be deviant",this.show_cancel=this.gmi_args.show_cancel,this.select.onchange=bind(this,this.changeCheck),t=document.createElement("input"),t.type="text",t.value=this.hidden.value,t.onkeypress=bind(this,this.keyPress),t.style.width="100px",this.text=t,t=document.createElement("button"),t.innerHTML="Done",t.onclick=bind(this,this.save),this.button=t,this.show_cancel&&(t=document.createElement("button"),t.innerHTML="Cancel",t.onclick=bind(this,this.cancel),this.cancelbutton=t),!Number(this.select.value)&&this.hidden.value?(this.textToSelect(),this.mode("select")):this.mode("select"),this.gmi_node.appendChild(this.text),this.gmi_node.appendChild(document.createTextNode(" ")),this.gmi_node.appendChild(this.button),this.show_cancel&&this.gmi_node.appendChild(this.cancelbutton)},changeCheck:function(){Number(this.select.value)||this.select.selectedIndex!=this.select.getElementsByTagName("option").length-1?this.text.value=this.hidden.value="":setTimeout(bind(this,this.mode,"text"))},mode:function(t){t!=this.current_mode&&("text"==t?(this.text.value||(this.text.value=this.default_input),this.select.style.display="none",this.text.style.display="inline",this.button.style.display="inline",this.show_cancel&&(this.cancelbutton.style.display="inline"),setTimeout(this.focus,1)):(this.text.style.display="none",this.button.style.display="none",this.select.style.display="inline",this.show_cancel&&(this.cancelbutton.style.display="none")),this.current_mode=t)},focus:function(){try{this.text.focus(),this.text.select()}catch(t){}},save:function(){"text"==this.current_mode&&(this.neutral||(this.text.value=this.grammarize(this.text.value)),this.hidden.value=this.text.value,this.textToSelect(),this.mode("select"))},cancel:function(){this.select.selectedIndex=0,jQuery(this.select).change(),this.mode("select")},grammarize:function(t){return t.split(" ")[0]in{to:1,"for":1,To:1,For:1}?t:"To "+t},textToSelect:function(){var t,e;return this.text.value?(t=this.custom_option,t||(t=document.createElement("option"),t.value="0"),t.innerText=t.text=this.text.value,this.custom_option||(this.custom_option=t,e=this.select.getElementsByTagName("option"),this.select.insertBefore(t,e[e.length-1])),this.select.selectedIndex=this.select.getElementsByTagName("option").length-2,void 0):(this.custom_option&&(this.custom_option.parentNode.removeChild(this.custom_option),this.custom_option=null),this.select.selectedIndex=0,jQuery(this.select).change(),void 0)},keyPress:function(t){(t||window.event).keyCode in{13:0,27:0}&&this.save()}}),window.DWait&&DWait.run("jms/pages/gruzecontrol/gruserutils_textdown.js"); CANCEL_CLICK=";if (window.event)event.cancelBubble=true;try{this.blur()}catch(e){}return false;",ModuleArranger=GMIBase.extend({gmiConstructor:function(){if(this.adding=0,this.api=this.gmi_args.api||"GrusersModules",this.link=this.gmi_args.page,this.link.init(),this.gmi_args.layout_changer)this.arrange_map_node=document.createElement("div"),this.arrange_map_node.innerHTML='

Loading...

';else{var e=document.getElementById("module-arrange-map");e?(this.arrange_map_node=e.cloneNode(!0),this.arrange_map_node.style.display="block"):this.arrange_map_node=document.createTextNode('No zone-map available for "'+this.link.gmi_args.name+'"')}this.render(),this.gmi_args.layout_changer&&"object"==typeof this.gmi_args.layout_changer&&this.gmi_args.layout_changer.setArranger(this)},gmiDestructor:function(){GMI._delete(this.gmiQuery("MAMiniZone"))},setListener:function(e){this.listener=e,void 0!=this.module_repository&&e.populated(this.module_repository)},enable:function(){this.disabled=!1},disable:function(){this.disabled=!0},syncLayout:function(e){this.arrange_map_node.innerHTML=this.generateMapFromLayout(this.link,e,this.gmi_args.page_title),this.construct()},render:function(){var e,i;this.gmi_args.no_tabs||(this.label_node=document.createElement("div"),this.label_node.className="arranger-label",this.label_node.innerHTML='
Loading...
',this.gmi_node.appendChild(this.label_node)),this.zone_node=document.createElement("div"),this.zone_node.className="zone-holder",this.gmi_args.height&&(i=this.gmi_args.height-91,Station.apply(this.zone_node,"height",i)),this.gmi_node.appendChild(this.zone_node),this.gmi_args.no_buttons||(e=document.createElement("div"),e.className="bottom-bit",e.innerHTML='"+(document.getElementById("module-hints")?'":"")+'"+"
Done'+"Hints...'+"'+'Restore...'+'
'+"
",this.gmi_node.appendChild(e)),this.populate()||(this.loading_node=document.createElement("div"),this.gmi_node.appendChild(this.loading_node),this.gmi_args.inline&&this.gmi_args.layout_changer||(Browser.isIE?this.zone_node.style.visibility="hidden":Station.apply(this.zone_node,"opacity",.1))),this.label_node&&(this.label_node.firstChild.innerHTML="Drag and drop widgets to rearrange the page"),this.construct(),this.draw()},popupHints:function(){var e;e=document.createElement("div"),e.className="light",e.style.padding="20px 32px",e.style.width="540px",e.appendChild(document.getElementById("module-hints").cloneNode(!0)),Station.apply(e.firstChild,"display","block"),Modals.push(e)},confirmReset:function(){return confirm("Restoring will:\n- Undo all rearrangements you have performed.\n- Restore any Default Widgets that you have deleted.\n\nDo you want to restore?")},construct:function(){for(var e,i,t,s,n,o;this.zone_node.firstChild;)this.zone_node.removeChild(this.zone_node.firstChild);if(this.zone_node.appendChild(this.arrange_map_node),this.gmi_args.inline||this.zone_node.appendChild(document.createElement("br")),i=this.zone_node.getElementsByTagName("div"),this.gmi_args.inline){if(n=(this.zone_node.getElementsByTagName("mainmarker")||[])[0]){var r=n.parentNode,d='
Done',a=" indifade";r.className.match(/\b(user-edit-userpage|user-edit-prints|user-edit-journal)\b/)&&(d='Done',a=""),r.className.match(/\buser-edit-userpage\b/)&&(d+='Restore...
Hints...'),r.innerHTML='
'+d+"

Customize "+(this.gmi_args.page_title?'your '+this.gmi_args.page_title+"":"this page")+" with Widgets

"+"The grey bars show how your "+(this.gmi_args.page_title||"")+" widgets are currently arranged."+"
Drag and Drop these widgets to rearrange them, or add brand new widgets from the list below.
"+"
"+"
"}o=document.getElementById("pagemenu"),n=(this.zone_node.getElementsByTagName("td")||[])[0],o&&n&&n.className.indexOf("gruze-sidebar")>=0&&(n.insertBefore(o.cloneNode(!0),n.firstChild),n.style.paddingBottom="50px")}for(s=this.getZones(),e=0;e!=s.length;e++){for(t=0;t!=i.length&&i[t].getAttribute("contains-zone")!=s[e].gmi_args.name;t++);i[t]&&i[t].appendChild(GMI.create("MAMiniZone",{link:s[e],arranger:this,sticky:s[e].gmi_args.name in(this.link.gmi_args.sticky_zones||{}),linked:s[e].gmi_args.name in(this.link.gmi_args.linked_zones||{})||s[e].gmi_args.locked,no_move:"bottom_right"==s[e].gmi_args.name&&this.link.gmi_args.name in{frontroom:0,userpage:0}}).gmi_node)}},getZones:function(){return this.gmi_args.zones},draw:function(){var e,i;for(i=this.gmiQuery("MAMiniZone"),e=0;e!=i.length;e++)i[e].draw()},zoneNotice:function(){this.label_node&&(this.label_node.firstChild.innerHTML="Some widgets can only be put in certain zones")},populate:function(){return this.module_repository||this.gmi_args.in_group_ops||(this.module_repository=ModuleArranger.last_module_repository),this.module_repository?(this.listener&&this.listener.populated(this.module_repository),!0):(DiFi.pushPrivateGet(this.api,"fetchModuleList",[this.link.ownerid,this.link.gmi_args.id],bind(this,this.difiDone)),DiFi.timer(1),void 0)},difiDone:function(e,i){e?(this.module_repository=ModuleArranger.last_module_repository=i.response.content,this.gmi_node.removeChild(this.loading_node),Browser.isIE?this.zone_node.style.visibility="visible":Station.push(this.zone_node,"opacity",{from:.1,to:1,f:Interpolators.sineCurve,time:250}),this.listener&&this.listener.populated(this.module_repository),this.gmi_args.additional_div_hook&&(this.gmi_args.additional_div_hook.style.display="block")):(this.listener&&this.listener.populated(null),Modals.stack.length&&(DiFi.stdErr("Unable to load widget list.",i.response.content),this.gmi_args.in_group_ops||Modals.pop()))},ddd:{snap:function(e){var i,t;for(this.scroll_node=this.gmi_args.in_group_ops?GMI.up(this.gmi_node).gmi_node.parentNode:this.zone_node,this.scroll_top_offset=this.getScrollOffset(),this.scroll_left_offset=0,DDD.p_down.y+=this.dragged_mod?this.scroll_top_offset:this.scroll_left_offset||0,this.surfer=Surfer.create(e,this.ddd.node,1,1,!0),this.gmi_args.inline&&(this.surfer_mod||(t=document.createElement("div"),t.className="modsurfer-notice modsurfer-yes",this.surfer_mod=t),this.surfer.node.appendChild(this.surfer_mod),this.surfer_notice_switch||(this.surfer_notice_switch=new LiquidSwitch(bind(this,this.surferNotice),"off"))),this.surfer.node.style.display="block",this.surfer.node.className+=" gm-minimized gm-mini-drag",document.body.appendChild(this.surfer.node),this.ddd.node.style.visibility="hidden",this.surfer.node.style.width=this.ddd.node.offsetWidth+"px",this.dragged_mod?this.drag_image_node=this.ddd.node:(this.drag_image_node=this.ddd.node.cloneNode(!0),this.drag_image_node.className="gm-placeholder gm-minimized"),this.drag_info=this.getDropInfo(this.drag_subject,this.dragged_mod&&this.dragged_mod.gmiUp("MAMiniZone")),this.drag_info.orig_ref=[this.drag_image_node.parentNode,this.drag_image_node,this.drag_image_node.nextSibling],this.drag_index=null,i=0;i!=this.drag_info.leftovers.length;i++)this.recommendation_filter_active||(Station.stopAnimation(this.drag_info.leftovers[i]),Station.push(this.drag_info.leftovers[i],"opacity",{from:Number(Station.read(this.drag_info.leftovers[i],"opacity"))||1,to:.15,f:Interpolators.sineCurve,time:250}));i&&this.link.gmi_args.name in{userpage:1}&&setTimeout(bind(this,this.zoneNotice),1500),this.gmi_args.inline?(this.drag_data={},DDDUtils.mix(this),this.dddTickStart(e)):(this.tiki_rect=Ruler.document.node(this.scroll_node||this.zone_node.parentNode),this.tikitimer=setInterval(bind(this,this.ddd.tick),100))},drag:function(e){var i,t;this.drag_event_cache={clientX:e.clientX,clientY:e.clientY,x:e.x,y:e.y},this.dddTickUpdate&&this.dddTickUpdate(e),Surfer.update(this.surfer,e),i=Ruler.hitTest(Ruler.document.pointer(e,{x:0,y:this.scroll_top_offset}),this.drag_info.rects),null!=i&&(this.drag_info.modules[i].gmi_node==this.ddd.node||i>0&&this.drag_info.modules[i-1].gmi_node==this.ddd.node)&&(t=!0,i=null),this.drag_index!=i&&(this.drag_index=i,null==i?this.insertBefore.apply(this,this.drag_info.orig_ref):(this.surfer_notice_switch&&this.surfer_notice_switch.change("yes:Drop here!",100,300),this.insertBefore(this.drag_info.zones[i].zone_node,this.drag_image_node,this.drag_info.modules[i]instanceof MAMiniModule?this.drag_info.modules[i].gmi_node:null))),null==i&&(i=Ruler.hitTest(Ruler.document.pointer(e,{x:0,y:this.scroll_top_offset}),this.drag_info.restrictions),t||null==i?this.surfer_notice_switch&&this.surfer_notice_switch.change("off",100,300):this.surfer_notice_switch&&this.surfer_notice_switch.change("no:"+this.drag_info.restrictions[i].restriction,100,300))},tick:function(){var e,i;e=this.drag_event_cache,c=Ruler.document.pointer(e),i=Browser.isGecko?document.documentElement:document.body,0===Ruler.hitTest(c,[this.tiki_rect])&&(this.tiki_rect.y+80>c.y?this.scroll_node.scrollTop-=32:c.y>this.tiki_rect.y2-80&&(this.scroll_node.scrollTop+=32)),DDD.p_down.y-=this.scroll_top_offset,this.scroll_top_offset=this.getScrollOffset(),DDD.p_down.y+=this.scroll_top_offset},drop:function(e){var t,s;for(this.dddTickEnd&&this.dddTickEnd(e),clearInterval(this.tikitimer),this.surfer_notice_switch&&this.surfer_notice_switch.change("off",0,300),i=0;i!=this.drag_info.leftovers.length;i++)this.recommendation_filter_active||Station.push(this.drag_info.leftovers[i],"opacity",{from:.15,to:.15,time:250},{from:.15,to:1,f:Interpolators.sineCurve,time:250});s=this.drag_index,null!=s?(t=this.drag_info.modules[this.drag_index]instanceof MAMiniModule&&this.dragged_mod&&this.drag_info.zones[this.drag_index]==this.dragged_mod.gmiUp("MAMiniZone")&&Number(this.drag_info.modules[this.drag_index].link.position)>Number(this.dragged_mod.link.position)?Number(this.drag_info.modules[this.drag_index].link.position)-1:this.drag_info.modules[this.drag_index-1]&&this.drag_info.zones[this.drag_index-1]==this.drag_info.zones[this.drag_index]?Number(this.drag_info.modules[this.drag_index-1].link.position)+1:1,t=Math.max(t,1),this.dragged_mod?(Surfer.flyHome(this.surfer,e,bind(this,this.doneAni,this.ddd.node)),this.gmi_args.live_preview&&this.insertBefore(this.drag_info.zones[s].link.gmi_node,this.dragged_mod.link.gmi_node,this.drag_info.modules[s]instanceof MAMiniModule?this.drag_info.modules[s].link.gmi_node:null),window.megaDebug&&(MAMiniModule.last_changed&&"blue"==MAMiniModule.last_changed.changed&&(MAMiniModule.last_changed.changed=null),MAMiniModule.last_changed=this.dragged_mod,this.dragged_mod.link.changed="blue"),this.dragged_mod.link.position=t,DiFi.pushPost(this.api,"positionModule",[this.link.ownerid,this.drag_info.zones[s].link.gmi_args.page_id||this.link.gmi_args.id,this.dragged_mod.link.gmi_args.id,this.drag_info.zones[s].link.gmi_args.foreign_name||this.drag_info.zones[s].link.gmi_args.name,t,this.dragged_mod.link.version++],bind(this,this.positionDone,this.dragged_mod.link.gmi_args.id)),(this.dragged_mod.link.gmi_args.behavior||{}).volatile_render&&this.enterVolatileMode(),DiFi.timer(1)):(this.surfer.ddd_node_opacity=1,this.surfer.node.parentNode.removeChild(this.surfer.node),delete this.surfer,this.listener&&this.listener.draw(this.drag_subject.typeid),eax=this.drag_image_node.getElementsByTagName("h2")[0],eax.innerHTML=' '+'Adding...',this.drag_image_node.className="gm-minimized",this.drag_image_node.style.visibility="visible",Station.push(eax.getElementsByTagName("span")[0],"visibility",{to:"visible",time:400},{to:"hidden",time:400},{to:"visible",time:400},{to:"hidden",time:400},{to:"visible",time:400},{to:"hidden",time:400},{to:"visible",time:400},{to:"hidden",time:400},{to:"visible",time:400},{to:"hidden",time:400}),this.adding++,DiFi.pushPost(this.api,"addModule",[this.link.ownerid,this.link.gmi_args.id,this.drag_subject.name,this.drag_info.zones[s].link.gmi_args.name,t],bind(this,this.addDone,this.drag_image_node)),DiFi.timer(1))):(rect=Ruler.document.node(this.ddd.node),rect.y-=this.dragged_mod?this.scroll_top_offset:this.scroll_left_offset,Surfer.flyHome(this.surfer,e,bind(this,this.doneAni,this.ddd.node),rect))}},getScrollOffset:function(){return this.gmi_args.inline?0:this.scroll_node.scrollTop+(document.body.scrollTop||document.documentElement.scrollTop)},surferNotice:function(e,i){switch(e=e.split(":"),e[0]){case"yes":case"no":"off"==i&&(Station.run(this.surfer_mod,"height",{from:1,to:20,time:300,f:Interpolators.pulse}),Station.run(this.surfer_mod,"top",{from:-10,to:-30,time:300,f:Interpolators.pulse})),this.surfer_mod.className="modsurfer-notice modsurfer-"+e[0],this.surfer_mod.innerHTML="
"+e[1]+"
",Station.apply(this.surfer_mod,"display","block");break;case"off":Station.push(this.surfer_mod,"height",{from:20,to:1,time:300,f:Interpolators.pulse},"display",{to:"none"}),Station.run(this.surfer_mod,"top",{from:-30,to:-10,time:300,f:Interpolators.pulse})}},filterOn:function(e){var t;for(this.recommendation_filter_active&&(this.recommendation_filter_active=null,this.filterOn([])),t=this.getDropInfo({permitted:!0,allowed_zones:e}).leftovers,i=0;i!=t.length;i++)Station.stopAnimation(t[i]),Station.push(t[i],"opacity",{from:Number(Station.read(t[i],"opacity"))||1,to:e.length?.15:1,f:Interpolators.sineCurve,time:250});this.recommendation_filter_active=Boolean(e.length)},enterVolatileMode:function(){var e;(e=document.getElementById("megaclick-done"))&&(e.onclick=function(){return!0})},doneAni:function(e){e.style.visibility="visible",Browser.isIE&&(e.style.display="none",e.style.display="block")},offerDelay:function(){this.adding>0},addDone:function(e,i,t){var s,n;if(Station.stopAnimation(e),i){var o=t.request.args[4],r=1,d=t.response.content.layout;e:for(var a in d)if(d.hasOwnProperty(a)&&d[a])for(var l=0;l!=d[a].length;l++){if(d[a][l]&&!(o>d[a][l].position))break e;r++}s=this.drawNewModule(t.response.content.html,t.request.args[3],r),s.importGWebPage(t.response.content),s.uncommitted=!0,n=GMI.create("MAMiniModule",{link:s,highlight:"new",arranger:this,zones:this.getZones(),page:this.link}),e.parentNode.replaceChild(n.gmi_node,e),(this.gmi_args.in_group_ops||this.gmi_args.inline)&&(s.uncommitted=!1,DiFi.pushPost("GrusersModules","addModuleCommit",[this.link.ownerid,this.link.gmi_args.id,s.gmi_args.id],window.DiFiHolder?DiFiHolder.getStdCallback():DiFi.stdErrCallback),DiFi.timer(1)),(s.gmi_args.behavior||{}).volatile_render&&this.enterVolatileMode()}else{e.parentNode&&e.parentNode.removeChild(e),this.listener&&this.listener.draw();for(widgetid in t.response.content)DiFi.stdErr("Unable to edit widgets at this time.",t.response.content[widgetid])}this.adding--},drawNewModule:function(e,i,t){var s,n,o,r,d,a,l;for(e instanceof GMFrame_Gruser?(s=e,a=s.gmi_node):(s=document.createElement("div"),s.innerHTML=e||'[x]',s=s.getElementsByTagName("*")[0],a=s),n=this.getZones(),o=0;o!=n.length;o++)if(n[o].gmi_args.name==i){r=n[o].gmiQuery("GMFrame_Gruser"),d=r[Number(t)-1],d?d.gmi_node.parentNode.insertBefore(a,d.gmi_node):n[o].gmi_node.appendChild(a),l=!0;break}return l||(n[0]||GMI.query("GPage")[0]).gmi_node.appendChild(a),e instanceof GMFrame_Gruser||(s=GMIBase.getOne(s)),s.highlight=!0,window.Shadows&&Shadows.nodes(s.gmi_node),window.Keeper&&Keeper.master_on(),s},positionDone:function(e,i,t){var s,n,o,r,d;if(i){d=this.link.gmiQuery("GMFrame_Gruser");for(s in t.response.content.layout)for(n=t.response.content.layout[s],o=0;o!=n.length;o++)for(r=0;r!=d.length;r++)if(d[r].gmi_args.id==n[o].moduleid){window.megaDebug&&(Number(d[r].position)!=Number(n[o].position)?d[r].changed="red":d[r].gmi_args.id==e?(d[r].changed="blue",MAMiniModule.last_changed=d[r]):d[r].changed=null),d[r].position=n[o].position,d[r].version=n[o].version;break}}else DiFi.stdErr("",t.response.content)},insertBefore:function(e,i,t){e?t?e.insertBefore(i,t):e.appendChild(i):i.parentNode&&i.parentNode.removeChild(i)},getModuleFromTypeID:function(e){return(this.module_repository||{})[e]},getDropInfo:function(e,i){var t,s,n,o,r,d,a,i,l;for(GMI.query("Gruser")[0].gmi_args.group&&(a=Ruler.document.node(this.gmi_node)),r=this.gmiQuery("MAMiniZone"),t={rects:[],modules:[],zones:[],leftovers:[],restrictions:[]},l=e.allowed_zones,i&&i.link.gmi_args.page_id&&(l=l.concat([i.link.gmi_args.name])),n=0;n!=r.length;n++){for(d=r[n].gmi_node;d&&0>(" "+d.className+" ").indexOf(" sealed-zone ");)d=d.parentNode;if(d||(d=r[n].gmi_node),i&&Boolean(i.gmi_args.sticky)!=Boolean(r[n].gmi_args.sticky))this.gmi_args.inline&&(h=r[n].getDropInfo(r[n].gmi_node,a)[0],h&&(h.restriction="Widgets cannot be moved to or from the Sticky Zone after they have been installed",t.restrictions.push(h)));else for(o=0;o!=l.length;o++)if(e.permitted!==!1&&r[n].link.gmi_args.name==l[o]){for(s=r[n].getDropInfo(d,a),x=0;x!=s.rects.length;x++)t.rects.push(s.rects[x]),t.modules.push(s.modules[x]),t.zones.push(r[n]);break}if(o==l.length){if(this.gmi_args.layout_changer){for(;d&&0>(" "+d.className+" ").indexOf(" gruze-sidebar ");)d=d.parentNode;d||(d=r[n].gmi_node),t.leftovers.push(d||r[n].gmi_node)}else t.leftovers.push(d||r[n].gmi_node);if(this.gmi_args.inline){var h;if(h=r[n].getDropInfo(d,a).rects[0]){var g=GMI.query("Gruser")[0].gmi_args.group?"Super Group":"Premium Membership";h.restriction=e.permitted===!1?"Upgrade to a "+g+" to get this great widget":"This widget cannot be placed in this zone",t.restrictions.push(h)}}}}var m,s,u;if(this.gmi_args.inline)for(u=GMI.query("Gruser")[0].gmi_args["super"]?"This sidebar does not allow widgets":"Upgrade to a Super Group to add widgets to your sidebar",m=this.gmi_node.getElementsByTagName("td"),n=0;s=m[n];n++)s.className.indexOf("gruze-sidebar")>=0&&(GMI.query(s,"MAMiniZone").length||(h=Ruler.document.node(s),h.restriction=u,t.restrictions.push(h)));return t},findModuleByTypeId:function(e){var i,t;for(e=Number(e),t=this.gmiQuery("MAMiniModule"),i=0;i!=t.length;i++)if(Number(t[i].link.gmi_args.typeid)==e)return t[i].link},generateMapFromLayout:function(e,i,t){var s,n,o,r,d,a,l,h;if(s=(deviantART.pageData||{}).group_ad_type)switch(s){case"square":i.right_square_ad=1;break;case"tower_left":i.left_tower_ad=1;break;case"tower_right":i.right_tower_ad=1}return n=[],h=GMI.query("Gruser")[0],l=document.getElementById("super-secret-automap"),document.getElementById("pagemenu")&&(i.left_nav=!0),l||(n.push('
'),n.push(''),n.push('
'),n.push('

#'+h.gmi_args.name+(t?'  '+t+" Layout":"")+"

"),Number(i.tabs)&&n.push('
Navigation
'),n.push("
"),o=i.zones||["top_left","mid_left","bottom_left"].concat(i.left_sidebar_widgets||i.right_sidebar_widgets?[]:["sidebar1","sidebar2"]).concat(["split","top_right","ad_zone","mid_right","bottom_right"]),r=this.generateLeftCol(e,i,h),this.left_column_html=r,d=this.generateMidCol(e,i,h,o),this.mid_column_html=d,a=this.generateRightCol(e,i,h),this.right_column_html=a),l?n.push(l.innerHTML):(n.push(''),this.left_column_html.length&&n.push('
'+this.left_column_html.join("")),n.push('
'+this.mid_column_html.join("")),this.right_column_html.length&&n.push('
'+this.right_column_html.join("")),n.push("
"),n.push("
")),n.join("")},generateLeftCol:function(e,i,t){var s=[];return i.left_nav&&!i.left_sidebar_widgets&&t.gmi_args["super"]&&s.push('
Navigation
'),i.left_tower_ad&&!t.gmi_args["super"]&&s.push('
Advertisement
'),i.left_sidebar_widgets&&(t.gmi_args["super"]||e.gmi_args.name in{faves:1,gallery:1})&&(s.push("
"),s.push("
"),i.right_sidebar_widgets||s.push("
"),s.push(''),s.push("
")),s},generateMidCol:function(e,t,s,n){var o=[],r=[];t.wide_middle?o.push("
"):o.push("
");var d,a='';for(i=0;n[i];i++)"split"!=n[i]?n[i]in(e.gmi_args.linked_zones||{})?(r.push("
"),d=!0):n[i]in(e.gmi_args.sticky_zones||{})?(o.push('
Sticky Widgets:
'),o.push.apply(o,r),r=[],o.push("
"),o.push("
")):("ad_zone"!=n[i]&&o.push(this.zone_buffer_output(r)),o.push("
")):(t.left_sidebar_widgets||t.right_sidebar_widgets||!s.gmi_args["super"]||(o.push("
"),o.push("
")),e.gmi_args.name in{members:1,blog:1}?o.push("
"):t.wide_middle||(d?d=!1:(o.push(a),a=""),o.push("
"),t.right_square_ad&&o.push('
Advertisement
')));return o.push(this.zone_buffer_output(r)),o.push(a),a="",t.wide_middle?o.push("
"):o.push("
"),o},generateRightCol:function(e,t,s){var n=[],o=[];if(t.right_tower_ad&&n.push('
Advertisement
'),t.right_sidebar_widgets&&s.gmi_args["super"]&&(n.push("
"),t.left_sidebar_widgets||n.push("
"),n.push("
"),n.push(''),n.push("
")),zones=t.right_sidebar_zones){for(n.push("
"),i=0;i!=zones.length;i++)zones[i]in(e.gmi_args.linked_zones||{})?(o.push("
"),linked_zone_was_output=!0):zones[i]in(e.gmi_args.sticky_zones||{})?(n.push('
Sticky Widgets:
'),n.push.apply(n,o),o=[],n.push("
"),n.push("
")):("ad_zone"!=zones[i]&&(this.mid_column_html.push(this.zone_buffer_output(o)),o=[]),n.push("
"));this.mid_column_html.push(this.zone_buffer_output(o)),o=[],n.push("
")}return n},zone_buffer_output:function(e){if(e.length){var i=[];return i.push('
'),i.push.apply(i,e),i.push("
"),i.join("")}return""}}),window.DWait&&DWait.run("jms/pages/gruzecontrol/widgets/arranger.js"); CANCEL_CLICK=";if (window.event)event.cancelBubble=true;try{this.blur()}catch(e){}return false;",window.ModuleCatalog=GMIBase.extend({gmiConstructor:function(){var e;if(this.gmi_args.category_placeholder&&(this.category_chooser=GMI.create("ModuleCatalog_Categories",{catalog:this,editor_proxy:this.gmi_args.editor_proxy,page:this.gmi_args.page}),this.gmi_args.category_placeholder.appendChild(this.category_chooser.gmi_node)),this.inline_mode=this.gmi_args.inline,this.offset=0,this.gmi_node.onselectstart=this.cancel,!ModuleCatalog.sort_setting){for(e in this.SORT_OPTIONS)break;ModuleCatalog.sort_setting=e}this.gmi_node.className="clog",this.gmi_node.innerHTML="",this.gmi_args.height&&Browser.isIE&&Station.apply(this.gmi_node,"height",this.gmi_args.height),this.label_node=document.createElement("div"),this.label_node.className="clog-label",this.label("loading"),this.gmi_node.appendChild(this.label_node),this.clogs_node=document.createElement("div"),this.clogs_node.className="clogs"+(this.gmi_args.groups_mode?" pzone":""),this.gmi_node.appendChild(this.clogs_node),this.clogs_node.innerHTML='
',this.arranger=this.gmi_args.arranger?this.gmi_args.arranger:GMI.create("ModuleArranger",{}),this.module_repository||(this.delayed_output=!0,Browser.isIE?this.clogs_node.style.visibility="hidden":Station.apply(this.clogs_node,"opacity",.01)),this.gmi_args.groups_mode&&!this.gmi_args.inline&&(this.resized=bind(this,this.resized),Events.hook(window,"resize",this.resized),window.CatalogSelection=DivOnlySelection.extend(this.catalog_selection_prototype),this.selector=new CatalogSelection(this.clogs_node,bind(this,this.selChange)),this.selector.hook({sticky_selection:!0}))},gmiDestructor:function(){this.gmi_args.groups_mode&&(Events.unhook(window,"resize",this.resized),this.selector.unhook(),delete this.selector,(this.gmi_args.ops_proxy||this.gmiUp("GroupManager")).hide4thColumn()),GMI._delete(this.gmiQuery("MAMiniModule"))},selChange:function(e){this.preview_node&&(this.preview_node.parentNode.removeChild(this.preview_node),delete this.preview_node),e[0]?(e[0].getAttribute("catalog_welcome")&&(this.preview_node=document.createElement("div"),this.preview_node.innerHTML='

<- Recommended Widgets for the '+({main:"Main Column",sidebar:"Sidebar"}[this.drawing_bias]||"")+"

"+"

"+''+"To preview or install any widget, simply click its name in the catalog on the left!"+"


"+'Click Cancel to return to the layout editor.'+"
",(this.gmi_args.ops_proxy||this.gmiUp("GroupManager")).slide4thColumn(bind(this.selector,this.selector.setSelection,null)).appendChild(this.preview_node)),setTimeout(bind(this,this.label,"back"),175)):(this.drawing_bias&&this.filterOn(null),(this.gmi_args.ops_proxy||GMI.up(this.gmi_node)).hide4thColumn(),setTimeout(bind(this,this.label,""),200))},catalog_selection_prototype:{select:function(e){e.className+=" clog-selected",e.getAttribute("name")&&GMI.getOne(e).clogSelect()},deselect:function(e){e.className=e.className.replace(/\bclog.selected\b/g,""),e.getAttribute("name")&&GMI.getOne(e).clogDeselect()},isSelected:function(e){return(" "+e.className+" ").indexOf(" clog-selected ")>=0}},clearSelection:function(){return this.selector?(this.selector.setSelection(null),!0):void 0},resized:function(){this.selector&&this.selector.getSelection().length||(this.resize_timeout&&clearTimeout(this.resize_timeout),this.resize_timeout=setTimeout(bind(this,this.draw),100))},cancel:function(){return!1},link:function(){this.arranger.setListener(this)},populated:function(e){this.module_repository=e,e&&(this.ready(),this.category_chooser&&this.category_chooser.setData(e))},label:function(e){switch("back"==e&&this.gmi_args.editor_proxy&&(e=""),e){case"back":e=' ';break;case"loading":e=" ";break;default:if(this.gmi_args.groups_mode)switch(this.drawing_bias){case"main":case"sidebar":e='Displaying '+("main"==this.drawing_bias?"Large":"Sidebar")+' Widgets ';break;default:e="Widgets You Can Add:"}else e=this.getSortHTML()}this.label_node.innerHTML=e},SORT_OPTIONS:{"Featured Widgets":null,Alphabetical:function(e,t){return(e.title||"").toLowerCase()>(t.title||"").toLowerCase()?1:-1},Main:function(e,t){var i,s,o=-1,a=-1;for(i=0;i!=(e.allowed_zones||[]).length;i++)if(!e.allowed_zones[i].indexOf("sidebar")){o=1;break}for(s=0;s!=(t.allowed_zones||[]).length;s++)if(!t.allowed_zones[s].indexOf("sidebar")){a=1;break}return o!=a?o:(e.title||"").toLowerCase()>(t.title||"").toLowerCase()?1:-1}},getSortHTML:function(){var e,t,i;i=[];for(e in this.SORT_OPTIONS){if("Main"==e)break;t=this.SORT_OPTIONS[e],e==ModuleCatalog.sort_setting?i.push(""+e+""):i.push('"+e+"")}return i.join(" | ")},sortModules:function(){var e,t,i;i=[];for(t in this.module_repository)i.push(this.module_repository[t]);e=this.SORT_OPTIONS[this.sort_bias||ModuleCatalog.sort_setting],e&&i.sort(e),this.sorted_modules=i},sortClick:function(e){return ModuleCatalog.sort_setting=e,this.label(),this.sortModules(),this.changePage(0),window.event&&(event.cancelBubble=!0),!1},ready:function(){this.draw(),this.delayed_output&&(Browser.isIE?this.clogs_node.style.visibility="visible":Station.push(this.clogs_node,"opacity",{from:.01,to:1,time:400,f:Interpolators.sineCurve})),this.label("add")},clear:function(){GMI._delete(this.gmiQuery("MAMiniModule")),this.pager_node&&this.pager_node.parentNode&&this.pager_node.parentNode.removeChild(this.pager_node)},draw:function(e){var t,i,s,o,a,n,r,a,l;for(this.clear(),this.refreshInstanceCounts(e),o=0,s=0,t=0,i=this.inline_mode?0:this.gmi_args.override_height?Ruler.screen.rect().y2-430:this.gmi_node.parentNode.offsetHeight-205,this.sorted_modules||this.sortModules(),r=0;a=this.sorted_modules[r];r++)if((this.gmi_args.groups_mode&&a.removable||Number(a.limit)>(this.instance_counts[a.typeid]||0))&&"top_secret"!=(a.allowed_zones||[])[0]){if("sidebar"==this.drawing_bias){for(l=0;l!=a.allowed_zones.length;l++)if(!a.allowed_zones[l].indexOf("sidebar")){l=-1;break}if(l>=0)continue}if(this.drawing_bias_category&&this.drawing_bias_category!=(a.owner_name||"profile")&&!(this.drawing_bias_category in ModuleCatalog_CATMAP.custom_hack&&25==Number(a.typeid)))continue;if(!this.modal_active&&!this.gmi_args.no_pager&&(this.offset>o++||s&&s>=i))continue;if("APP_NOT_INSTALLED"==a.permitted_reason)continue;t++,n=GMI.create("MAMiniModule",{spec:a,catalog:this,arranger:this.arranger,zones:this.gmi_args.zones,page:this.gmi_args.page,groups_mode:this.gmi_args.groups_mode,inline:this.gmi_args.inline,installs_total:Number(a.limit),installs_left:Number(a.limit)-(this.instance_counts[a.typeid]||0),selection_proxy:!1,ops_proxy:this.gmi_args.ops_proxy}),n.gmi_node.className+=" gm-clog",this.clogs_node.appendChild(n.gmi_node),s+=93}(s>=i||!this.on_display)&&(this.on_display=t),this.inline_mode?(this.more_button_node||(eax=document.createElement("div"),eax.innerHTML=this.gmi_args.groups_mode?'Show All...':'Show All...',this.more_button_node=eax),this.gmi_node.appendChild(this.more_button_node)):this.modal_active||this.gmi_args.no_pager||(this.clogs_node.appendChild(this.pager_node=new HTMLPager(this,{page:this.offset/this.on_display,pages:this.gmi_args.groups_mode?Math.floor(o/this.on_display)>this.offset/this.on_display:Math.ceil(o/this.on_display),prev_label:" ",next_label:" "},bind(this,this.changePage)).node),this.pager_node.style.bottom="1px")},modal:function(){var e,t;return this.gmi_args.inline?(this.gmi_node.parentNode.className+=" widget-catalog-expanded",Browser.isIE&&(this.gmi_node.style.display="none",setTimeout(bind(this,function(){this.gmi_node.style.display="block"}),1)),void 0):(t=this.gmi_node.parentNode,e=document.createElement("div"),e.className="phone-modal scroll-catalog gm-nomove",e.style.width="890px",e.appendChild(this.gmi_node),eax=document.createElement("div"),eax.className="bottom-bit",eax.innerHTML='
Cancel
',e.appendChild(eax),this.inline_mode=!1,this.modal_active=!0,Modals.push(e,bind(this,this.modalDone,t)),this.draw(),void 0)},modalDone:function(e){this.modal_active=!1,this.inline_mode=!0,e.appendChild(this.gmi_node),this.draw()},itemAdded:function(){this.modal_active&&setTimeout("Modals.pop()",1)},changePage:function(e){this.offset=e*this.on_display,this.draw()},mouseHover:function(e,t){e.className="entry"+(t?" entry-hover":"")},refreshInstanceCounts:function(e){var t,i,s,o;if(i={},this.arranger){for(t=GMI.query("GMFrame_Gruser"),s=0;s!=t.length;s++)o=t[s].gmi_args.typeid,i[o]||(i[o]=0),i[o]++;e&&(i[e]||(i[e]=0),i[e]++)}this.instance_counts=i},enable:function(){this.arranger.enable(),this.disabled=!1,Station.run(this.gmi_node,"opacity",{from:.2,to:1,f:Interpolators.sineCurve,time:400})},disable:function(){this.arranger.disable(),this.disabled=!0,Station.run(this.gmi_node,"opacity",{from:1,to:.2,f:Interpolators.sineCurve,time:400})},FILTER_ZONES:{sidebar:["sidebar1","sidebar2"],main:["top_left","mid_left","bottom_left","top_right","mid_right","bottom_right"]},filterOn:function(e){var t;return this.category_chooser?this.category_chooser.resetSelection():(this.offset=0,this.drawing_bias=e?e.indexOf("sidebar")?"main":"sidebar":null,this.sort_bias="main"==this.drawing_bias?"Main":null,Station.run(this.clogs_node,"opacity",{from:.01,to:1,time:500,f:Interpolators.sineCurve}),this.sortModules(),this.draw(),e&&(t=this.selector.getAllSelectable(),this.selector.setSelection(t[0])),e||this.label(),void 0)},filterOff:function(){this.filterOn(null)},categoryOn:function(e){(this.drawing_bias_category||e)&&(this.drawing_bias_category=e,this.draw())}}),ModuleCatalog.getLatestID=function(){return ModuleCatalog.latest_id},ModuleCatalog.clearLatestID=function(){ModuleCatalog.latest_id=null},ModuleCatalog_CATMAP={names:{Messages:"Stats",Profile:"Misc"},custom_hack:{gallery:1,faves:1,blog:1,members:1,prints:1}},window.ModuleCatalog_Categories=GMIBase.extend({gmiConstructor:function(){if(!this.gmi_args.catalog)throw Error("No catalog interface passed");this.selector=new LinkOnlySelection(this.gmi_node,bind(this,this.selected)),this.selector.hook({sticky_selection:1,fast_clicks:1}),this.setData(this.gmi_args.data)},gmiDestructor:function(){this.selector.unhook(),delete this.selector},setData:function(e){this.data=e,this.construct()},construct:function(){var e,t,i,s,o;if(this.data){i={Gallery:0,Faves:0,Blog:0,Members:0,Messages:0,Notes:0,Prints:0};for(e in this.data)(t=this.data[e].owner_name||"profile")&&"APP_NOT_INSTALLED"!=this.data[e].permitted_reason&&this.data[e].limit>this.data[e].count&&(t=t.substr(0,1).toUpperCase()+t.substr(1),t in i||(i[t]=0),i[t]++);var a=25,n=this.data[a];if(n&&n.limit>n.count)for(var r in i)i[r]>0&&this.data[a].owner_name!=r.toLowerCase()&&ModuleCatalog_CATMAP.custom_hack[r.toLowerCase()]&&(i[r]+=1);o=0;for(e in i)o++,ModuleCatalog_CATMAP[e]||e.toLowerCase()!=this.gmi_args.page.gmi_args.name||(this.recommended_selection_index=o);s=[],s.push('All Types');for(e in i)i[e]&&s.push(''+(ModuleCatalog_CATMAP.names[e]||e)+" ("+i[e]+")");this.gmi_node.className="guideblock guidemenu",this.gmi_node.innerHTML=s.join(""),this.resetSelection()}},selected:function(e){e[0]&&e[0].getAttribute("matterlayout")||(this.gmi_args.catalog.categoryOn((e[0].getAttribute("mattercat")||"").toLowerCase()),e[0].getAttribute("mattercat")&&this.gmi_args.catalog.modal())},resetSelection:function(e){var t=this.selector.getAllSelectable();this.selector.setSelection("number"==typeof e?t[e]:t[this.recommended_selection_index]||t[0])}}),window.DWait&&DWait.run("jms/pages/gruzecontrol/modulecatalog.js"); ModuleTheatre=GMIBase.extend({gmiConstructor:function(){this.want=0,this.preview_records={},this.gmi_args.label&&(eax=document.createElement("div"),eax.innerHTML='
'+this.gmi_args.label+"
",this.gmi_node.appendChild(eax)),this.gmi_node.appendChild(this.core_node=document.createElement("div")),this.core_node.className="bubbleview",this.gmi_node.appendChild(document.createElement("br")),this.gmi_node.onclick=bind(this,this.click)},gmiDestructor:function(){this.cleanupPreviews(),this.cleanView()},click:function(e){var i;if(e=e||window.event,i=e.target||e.srcElement,!$(i).closest("a.upsell-button").length)for(;;){if("A"==i.tagName)return e.cancelBubble=!0,!1;if(!(i=i.parentNode))return!0}},extractModule:function(){return this.latest_coolness?(this.preview_records[this.latest_coolness.gmi_args.id]=null,this.latest_coolness):void 0},fetch:function(e){e instanceof GMFrame_Gruser?this.fetchView(e):this.fetchPreview(e)},cleanView:function(){this.locked_to_mod&&(this.locked_to_mod.view_context=null,"generic"!=this.locked_to_mod.current_view&&this.locked_to_mod.loadView("generic"),this.locked_to_mod.returnNode(),this.locked_to_mod=!1)},fetchView:function(e){if(this.locked_to_mod)throw Error("Busy");this.locked_to_mod=e,e.extractNode(),this.displayMod(e)},fetchPreview:function(e){this.loading=!0,this.core_node.innerHTML='

Generating Preview...

',this.gmi_args.view_context.setControls(null),this.cleanupPreviews(),DiFi.pushPost("GrusersModules","addPreviewModule",[this.gmi_args.page.ownerid,this.gmi_args.page.gmi_args.id,e.name],bind(this,this.gotPreview,++this.want)),DiFi.timer(1)},gotPreview:function(e,i,t){if(!i)return this.core_node.innerHTML='

This Widget Cannot be Displayed

',this.gmi_args.view_context.setControls(null),void 0;if(this.loading=!1,nm=document.createElement("div"),nm.innerHTML=t.response.content.html||'[x]',nm=nm.firstChild,Station.run(nm,"opacity",{from:.01,to:1,time:400,f:Interpolators.sineCurve}),nm=GMIBase.getOne(nm),nm.uncommitted=0,this.preview_records[nm.gmi_args.id]=nm,this.want==e){for(this.latest_coolness=nm;this.core_node.firstChild;)this.core_node.removeChild(this.core_node.firstChild);this.displayMod(nm)}nm.importGWebPage(t.response.content)},displayMod:function(e){this.core_node.appendChild(e.gmi_node),window.Shadows&&Shadows.nodes(e.gmi_node),window.Keeper&&Keeper.master_on(),this.gmi_args.view_context.setControls(null),e.view_context=this.gmi_args.view_context},cleanupPreviews:function(){for(i in this.preview_records)this.preview_records[i]&&(this.preview_records[i].gmi_args.destroyable?DiFi.pushPost("GrusersModules","destroyModule",[this.gmi_args.page.ownerid,this.gmi_args.page.gmi_args.id,this.preview_records[i].gmi_args.id]):DiFi.pushPost("GrusersModules","removeModule",[this.gmi_args.page.ownerid,this.gmi_args.page.gmi_args.id,this.preview_records[i].gmi_args.id]),GMI._delete(this.preview_records[i]));this.preview_records={},DiFi.timer(1)}}),window.DWait&&DWait.run("jms/pages/gruzecontrol/moduletheatre.js"); MAMiniZone=GMIBase.extend({gmiConstructor:function(){if(this.link=this.gmi_args.link,this.arranger=this.gmi_args.arranger,!(this.link instanceof GZone))throw Error("Need GZone link");this.render()},gmiDestructor:function(){GMI._delete(this.gmiQuery("MAMiniModule"))},render:function(){this.zone_node=document.createElement("div"),this.zone_node.className="pzone",this.gmi_node.appendChild(this.zone_node),this.draw()},draw:function(){var e,i,n,t,r;for(i=this.gmiQuery("MAMiniModule"),e=0;e!=i.length;e++)GMI._delete(i[e]);for(t=this.link.gmiQuery("GMFrame_Gruser"),n=ModuleCatalog.getLatestID(),e=0;e!=t.length;e++)t[e].canBehave("no_midget")||(t[e].canBehave("arranger_replacement")?(r=document.createElement("div"),r.className="warr-widget-filler",r.style.height="3.3em",r.innerHTML=t[e].canBehave("arranger_replacement"),this.zone_node.appendChild(r)):(mm=GMI.create("MAMiniModule",{link:t[e],highlight:t[e].gmi_args.id==n||t[e].highlight,arranger:this.arranger,no_move:this.gmi_args.linked||this.gmi_args.no_move}),this.zone_node.appendChild(mm.gmi_node)))},getDropInfo:function(e,i){var n,t,r,o;for(n={rects:[],modules:this.gmiQuery("MAMiniModule")},t=0;t!=n.modules.length;t++)r=Ruler.document.node(n.modules[t].gmi_node),r.y-=4,r.y2+=4,r.x-=12,r.x2+=12,n.rects.push(r);return r=Ruler.document.node(this.gmi_node),Browser.isIE&&0==this.gmi_node.childNodes.length?r.y2=r.y+50:(r.y=r.y2-50,r.y2+=35),i&&(n.rects[0]&&(n.rects[0].y=Math.min(n.rects[0].y,i.y+20)),r.y2=this.gmi_args.sticky?Math.min(r.y2,r.y+100):Math.max(r.y2,i.y2+50)),o=Ruler.document.node(e),r.y2=Math.max(r.y2,o.y2),n.modules.push(this),n.rects.push(r),n}}),window.DWait&&DWait.run("jms/pages/gruzecontrol/ma_minizone.js"); CANCEL_CLICK=";if (window.event)event.cancelBubble=true;try{this.blur()}catch(e){}return false;",MAMiniModule=GMIBase.extend({gmiConstructor:function(){this.link=this.gmi_args.link,this.spec=this.gmi_args.spec,this.arranger=this.gmi_args.arranger,this.catalog=this.gmi_args.catalog,this.listener=this.gmi_args.listener,this.gmi_node.onmousedown=bind(this,this.mouseDown),this.render(),("new"==this.gmi_args.highlight||this.link&&"new"==this.link.highlight)&&(this.link&&(this.link.highlight=!0),this.addedParty()),this.gmi_args.inline&&(this.gmi_node.onclick=bind(this,this.popup))},gmiDestructor:function(){this.theatre&&GMI._delete(this.theatre),this.viewing_node&&(this.viewing_node.innerHTML="",this.viewing_node.parentNode&&this.viewing_node.parentNode.removeChild(this.viewing_node),delete this.viewing_node)},addedParty:function(){var e;e=this.gmi_node.getElementsByTagName("b")[0],e.innerHTML='Added!',Station.push(e,"visibility",{to:"hidden",time:250},{to:"visible",time:250},{to:"hidden",time:250},{to:Browser.isIE?"visible":"inherit",time:1200},"innerHTML",{to:this.getTitle()})},menu:function(){var e,i;i=this.gmi_node.getElementsByTagName("a")[0],e=new Popup2("MAMiniModule","body",{destroy:!0,classes:"gruser popup2-gruser-app",content:'
'+(this.link.canBehave("no_modal")?"":'View Widget')+(this.link.canBehave("edit")||this.link.gmi_args.privileges?'Edit Widget':"")+(this.link.canBehave("log")&&document.getElementById("group")?'View Widget Log':"")+(this.link.canBehave("delete")?'
Remove Widget':"")+"
",created:function(e){e.$node.attr("gmi-redirect",this.gmi_node.getAttribute("gmindex"));var i,t=e.$node.find("a");i=t.length?20*t.length+30:"90px",e.$node.css({height:i,width:"180px"})}.bindTo(this),hidden:function(){$(i).removeClass("active")},shown:function(){$(i).addClass("active")}}),e.show(e.position($(i).parent()))},menuClick:function(e){switch(e){case"view":this.popup(),this.link.loadView("generic",!0);break;case"edit":this.popup(),this.link.loadView("config");break;case"log":this.popup(),this.link.loadView("view_log");break;case"delete":this.toast(!0);break;default:throw Error(e+" --whut?")}Popup2.hideAll()},toast:function(e){var i;return this.link&&this.link.canBehave("confirm_remove")&&(e=!1),this.link&&(i=this.link.toast(e))&&(this.gmi_node.parentNode.removeChild(this.gmi_node),this.catalog&&this.catalog.draw()),i},getTitle:function(){return this.spec?this.spec.title||"It's a Mystery":this.link.getTitle()},render:function(){var e,i,t;e=this.getTitle(),i=Number(this.spec?this.spec.icon:this.link.gmi_args.icon),this.gmi_node.style.position="relative",this.gmi_node.className+=" gm-minimized",this.gmi_args.highlight&&(this.gmi_node.className+=" gm-highlight"),this.gmi_args.no_move&&(this.gmi_node.className+=" gm-nomove"),this.spec&&(t=this.gmi_args.groups_mode?this.spec.permitted===!1?' class="gmbutton2" style="background-image:url(http://st.deviantart.com/minish/gruzecontrol/widgets/wpreview.gif);width:123px" ':0===this.gmi_args.installs_left?' class="gmbutton2" style="background-image:url(http://st.deviantart.com/minish/gruzecontrol/widgets/wdone.gif);width:123px" ':this.gmi_args.installs_left==this.gmi_args.installs_total?' class="gmbutton2" style="background-image:url(http://st.deviantart.com/minish/gruzecontrol/widgets/wadd.gif);width:123px" ':' class="gmbutton2" style="background-image:url(http://st.deviantart.com/minish/gruzecontrol/widgets/wadd.gif);width:123px" ':' title="Click to Preview" class="gmbutton2 '+(this.spec.permitted===!1?"viewbutton":"addbutton")+'" '),this.gmi_node.innerHTML='
'+(this.spec||this.link.canBehave("no_modal_edit")||!(this.link.canBehave("delete")||this.link.canBehave("edit")||this.link.gmi_args.privileges)?"":this.link.templates.menuButtonHTML)+"
"+'
'+''+"

"+' '+(this.spec?' ':"")+""+e+""+(window.megaDebug?'':"")+"

"+(this.spec&&void 0!=this.spec.permitted?'
'+this.premoLabel()+"
":"")+(this.spec?'
'+(this.spec.description||" ")+''+"
":"")+'
',window.megaDebug&&(this.X=setInterval(bind(this,this.bonk),100))},premoLabel:function(){return this.isGroup()?"Super Group W...":"This is a Premium Widget"},premoLabel2:function(){return this.isGroup()?"Super Group":"Premium Membership"},isGroup:function(){return!!document.getElementById("group")},bonk:function(){if(window.megaDebug){var e;return e=this.gmi_node.getElementsByTagName("tt")[0],this.gmi_node.parentNode?(e.innerHTML=" @ "+(this.link?this.link.position:"[?]")+"",void 0):(clearInterval(this.X),e.innerHTML=" -",void 0)}},mouseDown:function(e){var i;Popup2.hideAll(),e=e||window.event;var t=e.target||e.srcElement;return"A"!=t.tagName||!this.link&&!/addbutton/.test(t.className)?(i=this.spec?8:4,this.spec&&!this.gmi_args.installs_left||this.gmi_args.no_move||(this.scroll_left_offset=0,this.arranger.drag_subject=(this.spec?this.spec:this.arranger.getModuleFromTypeID(this.link.gmi_args.typeid))||{allowed_zones:[]},!this.arranger.drag_subject||this.arranger.disabled||(this.catalog||{}).modal_active||(this.arranger.dragged_mod=this.spec?null:this,DDD.mouseDown.call(this.gmi_node,e,this.arranger,i),-30>DDD.mod_down.y&&(DDD.p_down.y+=DDD.mod_down.y+20))),e.cancelBubble=!0,!1):void 0},previewModalDone:function(e){switch(e){case"done":break;default:return this.theatre.cleanupPreviews(),this.theatre.cleanView(),!0}},setControls:function(e){var i,t,s,a,n;t=[],s="",a=this.gmi_args.groups_mode?"http://www.deviantart.com/supergroup/?forgroupid="+GMI.query("Gruser")[0].gmi_args.id:"https://www.deviantart.com/checkout/?mx=gruser2",a+=this.spec.name?this.spec.name:"unknown",n="PubSub.publish('DaGa.track_event_link', { event: event, element: this, category : 'SupergroupUpsell', action: 'module_"+(this.spec?this.spec.name:"unknown")+"'});",this.module_saver=e,this.spec&&void 0!=this.spec.permitted&&(this.spec.permitted?t.push('
Your '+this.premoLabel2()+" lets you add this great widget
"):this.gmi_args.groups_mode&&t.push('
Upgrade to a '+this.premoLabel2()+" to add this great widget
")),this.link&&this.link.canBehave("delete")&&e&&(s=''+(this.gmi_args.groups_mode?"Uninstall...":"Remove...")+""+""),this.link&&!e?t.push('
'+(this.gmi_args.groups_mode?"Go Back":"Close")+"
"):(i=this.theatre.loading||!this.link&&this.spec.permitted===!1?'Install Now':'Install Now',t.push(e?'"+s+"
Save'+(this.link?"":" & Preview")+""+''+'Cancel'+"
":'"+s+"
'+i+''+'Cancel'+"
")),this.control_node.innerHTML=t.join("")},theatreClick:function(e){var i,t,s;switch(s=this.gmi_args.groups_mode&&!this.gmi_args.inline&&this.spec,e){case"cancel":s?this.gmi_args.selection_proxy.setSelection(null):Modals.pop("cancel");break;case"saver":this.module_saver.saveAndChangeView();break;case"nosaver":this.module_saver.loadView("generic");break;case"add":return i=this.getTargetForModule(),(t=this.theatre.extractModule())&&(this.arranger.drawNewModule(t,i.zone,i.pos),t.highlight="new",t.view_context=null,t.uncommitted=!0,this.arranger.draw(),DiFi.pushPost("GrusersModules","positionModule",[this.arranger.link.ownerid,this.arranger.link.gmi_args.id,t.gmi_args.id,i.zone,i.pos,t.version++],bind(this.arranger,this.arranger.positionDone,t.gmi_args.id)),DiFi.timer(1),this.arranger.gmi_args.inline&&(nm.uncommitted=!1,DiFi.pushPost("GrusersModules","addModuleCommit",[this.arranger.link.ownerid,this.arranger.link.gmi_args.id,t.gmi_args.id],window.DiFiHolder?DiFiHolder.getStdCallback():DiFi.stdErrCallback),DiFi.timer(1)),this.catalog&&(this.catalog.itemAdded(),this.catalog.draw(this.spec.typeid)),this.listener&&this.listener("add",t)),this.theatre.cleanView(),s?this.gmi_args.selection_proxy.setSelection(null):Modals.pop("done"),void 0;case"delete":confirm("Remove this widget from the page?")&&(this.theatre.cleanView(),this.toast(!0),s?this.gmi_args.selection_proxy.setSelection(null):Modals.pop("done"))}},getTargetForModule:function(){var e,i,t,s,a,n;for(e=this.gmi_args.page,t=this.gmi_args.zones,n={},a=0;a!=t.length;a++)n[t[a].gmi_args.name]=t[a].gmiQuery("GMFrame_Gruser").length;for(i=this.spec.allowed_zones[0],a=0;a!=this.spec.allowed_zones.length;a++)n[i]>n[this.spec.allowed_zones[a]]&&!GMI.query("Gruser")[0].gmi_args.group&&(i=this.spec.allowed_zones[a]);return s=1,"userpage"==e.gmi_args.name&&"top_right"==i&&(s=2),{zone:i,pos:s}},clogSelect:function(){0==this.gmi_args.installs_left&&(this.link=this.arranger.findModuleByTypeId(this.spec.typeid)),this.popup(!0)},clogDeselect:function(){this.theatre&&(this.theatre.cleanupPreviews(),this.theatre.cleanView(),this.theatre.gmi_node.parentNode.removeChild(this.theatre.gmi_node)),this.viewing_node&&(this.viewing_node.innerHTML="",this.viewing_node.parentNode&&this.viewing_node.parentNode.removeChild(this.viewing_node),delete this.viewing_node),this.link=null},popup:function(bypass){var mod,r,super_height,n,eax,SUBBIO;if(0==this.gmi_args.installs_left)return!1;if(this.gmi_args.selection_proxy&&bypass!==!0)return!1;if(!this.arranger||!this.arranger.disabled)if(this.theatre||(this.theatre=GMI.create("ModuleTheatre",{view_context:this,label:this.gmi_args.groups_mode?"":this.link?"Viewing Widget:":"Widget Preview:",page:this.gmi_args.page})),mod=50,this.link||4==Number(this.spec.typeid)&&(this.spec.permitted=void 0),this.link||void 0==this.spec.permitted||(mod+=20),this.gmi_args.groups_mode&&!this.gmi_args.inline&&this.spec)n=this.viewing_node=document.createElement("div"),n.setAttribute("gmi-redirect",this.gmi_node.getAttribute("gmindex")),eax=this.gmi_node.getElementsByTagName("h2")[0].cloneNode(!0),eax.className="modhead",n.appendChild(eax),this.control_node=document.createElement("div"),this.control_node.style.margin="-30px 0 40px 0",n.appendChild(this.control_node),this.theatre.fetch(this.link||this.spec),n.insertBefore(this.theatre.gmi_node,this.control_node),(this.gmi_args.ops_proxy||this.gmiUp("GroupManager")).slide4thColumn(bind(this.gmi_args.selection_proxy,this.gmi_args.selection_proxy.setSelection,null)).appendChild(n),this.gmi_args.catalog&&setTimeout(bind(this.gmi_args.catalog,this.gmi_args.catalog.label,"back"),175);else with(r=Ruler.screen.rect(),super_height=Math.max(Math.min(r.y2-130,350+mod),Math.min(r.y2-100,350+mod)),eax=document.createElement("div"),eax.className="light zone-modal c",eax.style.width="550px",eax.setAttribute("gmi-redirect",this.gmi_node.getAttribute("gmindex")),eax.innerHTML='
'+'
'+"
",this.control_node=eax.getElementsByTagName("div")[1],eax.getElementsByTagName("div")[0].appendChild(this.theatre.gmi_node),!this.spec||void 0==this.spec.permitted||this.spec.permitted||this.gmi_args.groups_mode||(SUBBIO="https://www.deviantart.com/checkout/?mx=gruser2&utm_source=grusers&utm_medium=modulead&utm_campaign="+this.spec.name,eax.getElementsByTagName("div")[0].appendChild($('
')[0])),this.theatre.fetch(this.link||this.spec),Modals.push(eax,bind(this,this.previewModalDone)))getElementsByTagName("a")[0].style.right="26px";return window.event&&(event.cancelBubble=!0),!1}}),window.DWait&&DWait.run("jms/pages/gruzecontrol/ma_minimodule.js"); CSSVault={get:function(e){return this.vault[e]||(this.vault[e]=$("