User Tools

Site Tools


script_label_switcher

====== About the script ====== * Purpose : It will change the labels of all the items in the app drawer * Author : [[https://plus.google.com/u/1/105066926163073195690|TrianguloY]] * Link: https://plus.google.com/u/1/105066926163073195690/posts/FHNaoyitD3c ====== How to use the script ====== Just a fast script that will change the labels of all the items in the app drawer (or a custom container if necessary, ask about) The change can be done permanently or just visual (a restart will change them back) Available types: ( you can write your own one if you know scripting) - UPPER CASE - lower case - Sentence case - Title Case (from http://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript) To launch copy/paste it and launch wherever you want. ====== Script code ====== <sxh javascript> var container = LL.getContainerById(99);//LL.getEvent().getContainer(); var permanent = confirm("Permanent change?"); var type = parseInt(prompt("1- UPPER CASE\n2- lower case\n3- As a sentence\n4- Title Case",0)); run(container); Android.makeNewToast("Done",true).show(); function run(cont){ var items = cont.getItems(); for(var i=items.getLength()- 1;i>=0; --i){ var item=items.getAt(i); item.setLabel(change(item.getLabel()),permanent); if(item.getType()=="Folder"||item.getType()=="Panel")run(item.getContainer()); } } function change(label){ var ret=label; switch(type){ case 1: ret=ret.toUpperCase(); break; case 2: ret=ret.toLowerCase(); break; case 3: ret= ret.charAt(0).toUpperCase() + ret.substring(1,ret.length).toLowerCase(); break; case 4: ret=ret.split(" ").map(function(i){return i[0].toUpperCase() + i.substring(1)}).join(" "); break; //Write here your custom label changer } return ret; } </sxh>

script_label_switcher.txt · Last modified: 2014/07/22 14:50 by trianguloy