|
Post by FireIndy on Jan 6, 2007 2:24:19 GMT
Ok, Im basically doing this for fun but have a question. Hs would you insert a link on the admin panel? Would you grab a certain table of the admin table itself because i think each category itself on the admin panel is a table. And then append a text node to the table? I could be wrong. If I am, how would you do it? Im having touble just finding the Element.
|
|
|
Post by FireIndy on Jan 6, 2007 17:22:10 GMT
I was working and made this. THis puts text under the Maintain Your Board part in the Admin Panel.
<script> if(location.href.match(/com\/?((\index\.cgi)?\??(action=admin)?)?(#.+)?$/)){ var lists = document.getElementsByTagName("td")[11]; var item= document.createTextNode("Test") lists.insertBefore(item,lists.lastChild) } </script>
I think there is a more common way though?
|
|
Ross
eCreations Staff
Posts: 1,768
|
Post by Ross on Jan 6, 2007 23:02:40 GMT
Using a specific number to grab the td is not recommended. A lot of sites will have additional tables in the Header that will change whcih td you need to grab. There's also the additional info box that will appear above the admin panel telling you that whatever you just did (eg. Updating General Settings) was done successfully.
So how I would do it would be something like:
<script type="text/javascript"> <!-- var div = document.getElementsByTagName('div'); // All the different sections in the admin panel are stored in divs for(i=0; i<div.length; i++) { // Loop through all the divs on the page using the integer i if(div.item(i).style.paddingLeft == "35px" && div.item(i).innerHTML.match(/Fix a Board/i)) { // Check it is the Div we want by checking an attribute unique to all of the divs in the admin panel and by checking it's contents, div.item(i).innerHTML += '<br />Hello World'; } } //--> </script>
|
|
|
Post by FireIndy on Jan 7, 2007 1:22:16 GMT
Thanks Ross, Im really starting to grasp this stuff like nodes and elements. I will test this soon.
|
|