PHP Classes

File: contents/themes/hine/src/dashboard/js/dashboard.js

Recommend this page to a friend!
  Classes of Subin Siby   Lobby   contents/themes/hine/src/dashboard/js/dashboard.js   Download  
File: contents/themes/hine/src/dashboard/js/dashboard.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Lobby
Web OS to install and run Web applications
Author: By
Last change: Lobby 1.0 Cobra
Date: 7 years ago
Size: 2,911 bytes
 

Contents

Class file image Download
lobby.dash={tiles:[],pages:1,init:function(adjust){lobby.dash.addTiles();lobby.dash.addTileEvents();},addTile:function(data){if(typeof data==="object"){lobby.dash.tiles.push(data);}},addTiles:function(){rows=Math.floor($("#workspace").height()/ $("#workspace .tile.hide").width());cols=Math.floor($("#workspace").width()/ $("#workspace .tile.hide").width());possibleTiles=rows*cols;this.pages=Math.ceil(lobby.dash.tiles.length / possibleTiles);if(this.pages>1){for(i=0;i<this.pages;i++){if(i!==0){$(".tiles-wrapper").append("<li class='tiles' data-page='"+i+"'></li>");} $("#bx-pager").append("<li class='tab'><a data-slide-index='"+i+"'></a></li>");}} i=0;curPage=0;$.each(lobby.dash.tiles,function(ignore,data){if(i==possibleTiles){curPage++;i=0;} var id=data['id'];var html='<div class="tile"><div class="app" id="'+id+'" data-mode="none" data-initdelay="50"><a href="'+lobby.url+'/app/'+id+'"><div class="inner"><div class="image"><img src="'+data['img']+'" height="100%" width="100%"/></div><div class="title">'+data['name']+'</div></div></a></div></div>';$(".tiles[data-page="+curPage+"]").append(html);i++;});$(".tiles[data-page="+curPage+"]").append('<div class="tile"><div class="extra" id="lobby-store" data-mode="none" data-initdelay="50"><a href="'+lobby.url+'/admin/lobby-store.php"><div class="inner"><div class="image valign-wrapper"><img src="<?THEME_URL?>/src/dashboard/image/get-it.png" class="valign" width="100%"/></div><div class="title">Get More Apps From<br/>Lobby Store</div></div></a></div></div>');$('#workspace .tiles-wrapper').bxSlider({slideMargin:0,speed:200,infiniteLoop:false,hideControlOnEnd:true,prevText:'',nextText:'',pagerCustom:"#bx-pager"});},addTileEvents:function(){setTimeout(function(){src="";$("#workspace .tiles").disableSelection();$.contextMenu({selector:".tiles .tile .app",items:{open:{name:"Open App",icon:"open",callback:function(key,opt){window.location=$(this).find("a[href]").attr("href");}},admin:{name:"Go To Admin",icon:"open",callback:function(key,opt){lobby.redirect("/admin/apps.php?app="+$(this).attr("id"));}},disable:{name:"Disable App",icon:"close",callback:function(key,opt){lobby.redirect("/admin/apps.php?action=disable&app="+$(this).attr("id")+"&csrfToken="+lobby.csrfToken);}},remove:{name:"Remove App",icon:"trash",callback:function(key,opt){lobby.redirect("/admin/apps.php?action=remove&app="+$(this).attr("id")+"&csrfToken="+lobby.csrfToken);}}}});},10);if(this.pages>1){$(window).bind('mousewheel DOMMouseScroll',function(event){nextPage=parseInt($("#bx-pager a.active").data("slide-index"));if(event.originalEvent.wheelDelta>0||event.originalEvent.detail<0){nextPage--;}else{nextPage++;} $("#bx-pager a[data-slide-index="+nextPage+"]").click();});}},save:function(){var e={};$("#workspace .tiles .tile.taken").each(function(i,elem){e[$(this).find(".app").attr("id")]=$(this).index();});lobby.saveOption("dashItems",JSON.stringify(e));}};