Gadget ids in Div attributs
Posted: Tue Feb 25, 2014 9:28 pm
It would be very usefull if the ids of gadget can be put int the generated divs attribut. We could easily change css properties and do more stuff with direct js.
Actualy i made myself a small plugin wich edit the generated spider.js to do it (in PB, for sure!). It looks like :
With that i can do easy proc likes :
And so more!
Actualy i made myself a small plugin wich edit the generated spider.js to do it (in PB, for sure!). It looks like :
Code: Select all
OpenFile(0, dirname + "SpiderBasic.js")
Repeat
line.s = ReadString(0)
;avoid asm generated lines on "js" procedures
If FindString(line, "equ esp") : Continue : EndIf
;retrieve "CreateGadget" content in current line
CreateRegularExpression(0, "spider_[A-Z][a-zA-Z]*Gadget.*document\.createElement\(" + Chr(34) + "div" + Chr(34) + "\);")
Dim result.s(0)
If ExtractRegularExpression(0, line, result()) >= 1
gadget.s = result(0)
;retrieve gadget object
CreateRegularExpression(1, "[a-z]{1}[=]{1}spider\.gadget\.objects\.Allocate\([a-z]{1}\)")
Dim result2.s(0)
If ExtractRegularExpression(1, gadget, result2()) >= 1
gadgetObj.s = Mid(result2(j), 1, 1)
EndIf
FreeRegularExpression(1)
;retrieve div object
CreateRegularExpression(1, "[a-z]{1}[=]{1}document\.createElement\(" + Chr(34) + "div" + Chr(34) + "\)")
Dim result2.s(0)
If ExtractRegularExpression(1, gadget, result2()) >= 1
divObj.s = Mid(result2(j), 1, 1)
EndIf
FreeRegularExpression(1)
;add the gadget id to the div in the "CreateGadget"
line = ReplaceString(line, gadget, gadget + divObj + ".id=" + Chr(34) + "gadget_" + Chr(34) + " + " + gadgetObj + ".id;")
Next
FreeRegularExpression(0)
content + line + Chr(10)
Until Eof(0)
CloseFile(0)
With that i can do easy proc likes :
Code: Select all
Procedure GadgetFadeIn(gID.i, time.i)
!$("#gadget_" + v_gID).fadeIn(v_time);
EndProcedure
Procedure GadgetFadeOut(gID.i, time.i)
!$("#gadget_" + v_gID).fadeOut(v_time);
EndProcedure