User Tools

Site Tools


script_llxperiment_move_folders

====== About the script ====== Testing purpose only. Laggy. * Purpose : It will let you move the folders. * Author : [[https://plus.google.com/u/1/105066926163073195690|TrianguloY]] * Link: https://plus.google.com/u/1/105066926163073195690/posts/jMxapYjb2SE (With video) ====== How to use the script ====== Things you need: a folder with: * a panel, detached. scrolling set to both ( to avoid 'jump' to the folder) * a shortcut, the title, detached * all the borders/margins of the folder to 0 (recommended) * the scrolling of the folder set to free, and not snapping Note: Commit is slow, we can't be faster than that. ====== Script code ====== <sxh javascript> /* Config*/ var minWidth = 100; //minimum width of the window/container var titleHeight = 50; //heigh of the title var minHeight = 100; //minimum height of the container //click to close if(LL.getEvent().getItem()!=null)LL.getEvent().getContainer().getOpener().close(); //vars var cont = LL.getEvent().getContainer(); var container,title; var fol = cont.getOpener().getProperties(); var screen = LL.getCurrentDesktop(); var it = cont.getItems(); if(it.getLength()!=2){alert("oops");return} for(var i=0;i<2;++i){ var ite=it.getAt(i); if(ite.getType()=="Panel")container=ite; else if(ite.getType()=="Shortcut")title=ite; else {alert("oops");return;} } //to run once, but just in case container.setPosition(0,minHeight/2); title.setPosition(0,0); //data fx = fol.getInteger("f.wX"); fy = fol.getInteger("f.wY"); fw = fol.getInteger("f.wW"); fh = fol.getInteger("f.wH"); if( cont.getPositionScale()==1 ){ //position fx-= cont.getPositionX() ; if(fx<0)fx=0; if(fx>screen.getWidth()-fw) fx = screen.getWidth()-fw; fy-= cont.getPositionY(); if(fy<0)fy=0; if(fy>screen.getHeight()-fh) fy = screen.getHeight()-fh; }else{ //scale fw+= cont.getPositionX()/2; if(fw<minWidth)fw=minWidth; if(fw>screen.getWidth()-fx) fw = screen.getWidth()-fx; fh+= cont.getPositionY()/2; if(fh<minHeight+titleHeight)fh=minHeight+titleHeight ; if(fh>screen.getHeight()-fy) fh = screen.getHeight()-fy; container.setSize(fw , fh-titleHeight ); title.setSize(fw,titleHeight); } //apply data fol.edit(). setInteger("f.wX",fx). setInteger("f.wY",fy). setInteger("f.wW",fw). setInteger("f.wH",fh). commit(); // reset cont.setPosition(0,0,1,false); </sxh>

script_llxperiment_move_folders.txt · Last modified: 2014/07/22 14:48 by trianguloy