Created
August 18, 2012 16:28
-
-
Save guybrush/3388157 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("document").ready( // UID1 | |
function(){ // UID2 | |
$("body").css("background","black"); // UID3 | |
$("body").css("color","white") // UID4 | |
$.get("test.php",para, // UID5 | |
function(data){ // UID6 | |
$("body").append(data); // UID7 | |
} ---+--- | |
); | | |
} | | |
); +->------------+ | |
| | |
| | |
CMS['Do']['UID1']['Context'] = 'UID8'; // $(document). <--+ | |
CMS['Do']['UID1']['Method'] = 'UID11'; // ready(DO_UID2) | |
CMS['Do']['UID2']['Context'] = ''; // - | |
CMS['Do']['UID2']['Method'] = 'UID12'; // function(){DO_UID3,DO_UID4,DO_UID5} | |
CMS['Do']['UID3']['Context'] = 'UID9'; // $("body"). | |
CMS['Do']['UID3']['Method'] = 'UID13'; // css("background","black") | |
CMS['Do']['UID4']['Context'] = 'UID9'; // $("body"). | |
CMS['Do']['UID4']['Method'] = 'UID14'; // css("color","white") | |
CMS['Do']['UID5']['Context'] = 'UID10'; // $. | |
CMS['Do']['UID5']['Method'] = 'UID15'; // get("test.php",para,DO_UID6) | |
CMS['Do']['UID6']['Context'] = ''; // - | |
CMS['Do']['UID6']['Method'] = 'UID16'; // function(data){DO_UID7} | |
CMS['Do']['UID7']['Context'] = 'UID9'; // $("body"). | |
CMS['Do']['UID7']['Method'] = 'UID17'; // append(data) | |
CMS['Context']['UID8']['Context'] = '$.'; | |
CMS['Context']['UID8']['Selector'] = 'document'; | |
CMS['Context']['UID9']['Context'] = '$.'; | |
CMS['Context']['UID9']['Selector'] = 'body'; | |
CMS['Context']['UID10']['Context'] = '$.'; | |
CMS['Context']['UID10']['Selector'] = ''; | |
CMS['Method']['UID11']['name'] = 'ready'; | |
CMS['Method']['UID11']['params'] = array('DO_UID2'); | |
CMS['Method']['UID11']['Do'] = ''; | |
CMS['Method']['UID12']['name'] = ''; | |
CMS['Method']['UID12']['params'] = ''; | |
CMS['Method']['UID12']['Do'] = array('DO_UID3','DO_UID4','DO_UID5'); | |
CMS['Method']['UID13']['name'] = 'css'; | |
CMS['Method']['UID13']['params'] = array('background','black'); | |
CMS['Method']['UID13']['Do'] = ''; | |
CMS['Method']['UID14']['name'] = 'css'; | |
CMS['Method']['UID14']['params'] = array('color','white'); | |
CMS['Method']['UID14']['Do'] = ''; | |
CMS['Method']['UID15']['name'] = 'get'; | |
CMS['Method']['UID15']['params'] = array('test.php',{'para1':'value1'},'DO_UID6'); | |
CMS['Method']['UID15']['Do'] = ''; | |
CMS['Method']['UID16']['name'] = ''; | |
CMS['Method']['UID16']['params'] = 'data'; | |
CMS['Method']['UID16']['Do'] = array('DO_UID7'); | |
CMS['Method']['UID17']['name'] = 'append'; | |
CMS['Method']['UID17']['params'] = 'data'; | |
CMS['Method']['UID17']['Do'] = ''; | |
//------------------------- | |
var Drawer.makeDo = function(currDo) { | |
if (currDo.Context != '') | |
BD.makeContext(BD.CMS.Context[currDo['Context']]); | |
if (BD.CMS.Context[currDo['Method']] != '') | |
BD.makeMethod(BD.CMS.Method[currDo['Method']]); | |
} | |
var Drawer.makeContext = function(currContext) { | |
if (currContext.Context != undefined) | |
BD.code += currContext.Context; | |
if (currContext.Selector != '') | |
BD.code += "('"+currContext.Selector+"')"; | |
BD.code += "."; | |
} | |
var Drawer.makeMethod = function(currMethod) { | |
if (currMethod.name != '') { | |
BD.code += currMethod.name+"("; | |
if (currMethod.params != '') | |
BD.makeParams(currMethod.params); | |
BD.code += ");"; | |
} else { | |
BD.code += "function("; | |
if (currMethod.params != '') { | |
BD.makeParams(currMethod.params); | |
} | |
BD.code += "){"; | |
if (currMethod.Do != '') { | |
$.each(currMethod.Do,function(iDo,currDo){ | |
if (currDo.substr(0,3)=="DO_") | |
BD.makeDo(BD.CMS.Do[currDo.substr(3)]); | |
}); | |
} | |
BD.code += "}"; | |
} | |
} | |
var Drawer.makeParams = function(currParams) { | |
$.each(currParams,function(iParam,currParam){ | |
if (typeof(currParam)=='string' && currParam.substr(0,3)=="DO_") | |
BD.makeDo(BD.CMS.Do[currParam.substr(3)]); | |
else if (typeof(currParam)=='string' && currParam=="data") | |
BD.code += "data"; | |
else | |
BD.code += $.toJSON(currParam); | |
if (currParams.length > (iParam+1)) | |
BD.code += ","; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment