![]() |
Click here to advertise with us
|
|
|||||||
| VB.NET General Discussion VB.NET general discussion area |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Basically i have a 500 line javascript file i made that runs in grease monkey (a add on for firefox ) I'm using vb.net to "compile" this script depending on certain check boxes.
So for example. (this is part of my script) Code:
#RegionCapsEnforcer
var array=document.evaluate("//*[contains(@class, 'postbody')]", document, null, 6, null);
for(let i=0,item; (item=array.snapshotItem(i)); i++) item.innerHTML=item.innerHTML.toLowerCase()
#RegionRevealURLs
var postAs = document.querySelectorAll('.postbody a')
for(var i in postAs){
var c = postAs[i];
if(c.hasAttribute('href')){
var np = document.createElement('p');
np.innerHTML=c.getAttribute('href');
var p = c.parentNode;
var pl = c.nextElementSibling;
if(!pl){
p.appendChild(np);
}
else{
p.insertBefore(np, pl);
}
}
}
make sense? |
|
||||
|
The thread title suggest you want to insert "anchors", but the post content indicates you want to retrieve them. Perhaps you can clarify?
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
Sorry for the title. I didnt know how else to explain it.
If you look at this form below. You will see there are a few options. ![]() Each of them chkboxes has a anchor (thats just what im calling it) in my script. I have a compile button now depending on what checkboxes are selected i want to be able to read each section of the script (if its checkbox is checked) Grab the bits that i selected and write them to a new textfile. Sort of like compiling a script. Does that make any more sense? |
|
||||
|
The logic could be something like this:
Code:
Dim includeLine As Boolean
Dim newLines As New List(Of String)
For Each line As String In lines
If line.StartsWith("#") Then
includeLine = CType(Me.Controls(line.Substring(1)), CheckBox).Checked
ElseIf includeLine Then
newLines.Add(line)
End If
Next
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|