Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts

    a few simple bookmarklets

    Here's a small collection of bookmarklets for disecting your own (or other people's!) websites. They do things like, show all TABLE elements with a red border, hide non-link images, and so on.

    I'm assuming people know what bookmarklets are, and how to install them? Please say if not, and I'll post instructions.

    I'm also open to suggestions, and I'd love to see other people's ...
    Attached Files Attached Files
    Last edited by brothercake; 03-18-2003 at 09:24 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ya, can you help me install these? I'm kinda new to javascript.


    Ok, kidding aside, I didn't write this one, but it's a view-source bookmarklet that does syntax highlighting! Interesting indeed. If it doesn't work after copy-pasting, let me know, I may need to upload it as a text-file.

    javascript:document.body.innerHTML=String(document.documentElement.outerHTML).replace(/(<!--[\s\S]*?-->)/g,"$1").replace(/>/g," &gt;").replace(/</g," &lt;").replace(/(&lt;)([\/a-zA-Z]+)/g,"$1$2").replace(/ /g,"&nbsp;").replace(/\n/g,"<br>").replace(//g,"red>").replace(//g,"</font>").replace(/([^;=]+)=/g,"blue>$1=</font>").replace(//g,'"').replace(//g,"=").replace(/ /g,'="teal"><b>').replace(//g,"</b></font>").replace(//g,'<i>').replace(//g,"</i>").replace(//g,"<font color")
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm seeing some special characters that are unidentified, eg

    "$1"


    As for installing them - well the file I posted you can just import with "Bookmarks > Manage Bookmarks > File > Import" in moz, and "File > Import and Export" in IE

    To make you new ones you start with an empty bookmark - like "about:blank" and any name, and then edit its properties - change the name, and write the syntax like inline javascript:

    javascript:var something=function();void(null);

    where void(null) stops it from trying to open a new document. It doesn't have to be null - you can go void('your message here');
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts

    Talking about bookmarklets?

    Hey - that's my speciality...

    ViewStyles: javascript:(function(){var s='http://liorean.web-graphics.com/bookmarklets/viewstyles.js', t='text/javascript',q='\u0022',d=document,n=navigator,e;if(/mac/i.test(n.platform)&amp;&amp;/msie/i.test(n.userAgent))(d.createElement('div')).innerHTML='\u003cscript type='+q+t+q+' src='+q+s+q+'\u003e\u003c/script\u003e';else{(e=d.createElement('script')).src=s;e.type=t;d.getElementsByTagName('head')[0].appendChild(e)}})();void('Coded by liorean');

    ViewScripts: javascript:(function(){var s='http://liorean.web-graphics.com/bookmarklets/viewscripts.js', t='text/javascript',q='\u0022',d=document,n=navigator,e;if(/mac/i.test(n.platform)&amp;&amp;/msie/i.test(n.userAgent))(d.createElement('div')).innerHTML='\u003cscript type='+q+t+q+' src='+q+s+q+'\u003e\u003c/script\u003e';else{(e=d.createElement('script')).src=s;e.type=t;d.getElementsByTagName('head')[0].appendChild(e)}})();void('Coded by liorean');

    ToggleStyles: javascript:(function(){var s='http://liorean.web-graphics.com/bookmarklets/togglestyles.js', t='text/javascript',q='\u0022',d=document,n=navigator,e;if(/mac/i.test(n.platform)&amp;&amp;/msie/i.test(n.userAgent))(d.createElement('div')).innerHTML='\u003cscript type='+q+t+q+' src='+q+s+q+'\u003e\u003c/script\u003e';else{(e=d.createElement('script')).src=s;e.type=t;d.getElementsByTagName('head')[0].appendChild(e)}})();void('Coded by liorean');

    GraphicsInfo: javascript:(function(){var s='http://liorean.web-graphics.com/bookmarklets/graphicsinfo.js', t='text/javascript',q='\u0022',d=document,n=navigator,e;if(/mac/i.test(n.platform)&amp;&amp;/msie/i.test(n.userAgent))(d.createElement('div')).innerHTML='\u003cscript type='+q+t+q+' src='+q+s+q+'\u003e\u003c/script\u003e';else{(e=d.createElement('script')).src=s;e.type=t;d.getElementsByTagName('head')[0].appendChild(e)}})();void('Coded by liorean');


    Sources can be found from the link in my sig.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is a great table bookmarklet from http://sam-i-am.com/work/bookmarklet...debugging.html that also shows the amount of nested tables with diferent colors
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Excellent; those are fantastic, particularly that script and css extractor

    I made a simple view-source as well:

    javascript:document.body.innerHTML=('<xmp><html>'+document.getElementsByTagName('html')[0].innerHTML+'</html></xmp>');void(null);


    And then this one - a Lynx Emulator - try it out on this page

    javascript:var db=document.body;var el=['img','object','embed','html','body','table','td','div','span','strong','i','blockquote','abbr','acc ronym','q','em','ol','ul','li','cite','a','p','small','label','legend','input','button','select','te xtarea'];var bgLen=el.length;var e,eleLen,i,j;for(i=0;i<bgLen;i++){e=document.getElementsByTagName(el[i]);for(j=0;j<e.length;j++){if(i<3){e[j].style.display='none';}else{e[j].align='left';e[j].style.backgroundColor='#bbb';e[j].style.fontStyle='normal';e[j].style.textDecoration='none';(el[i]=='a')?e[j].style.color='#900':e[j].style.color='#000';e[j].style.fontSize='16px';if(el[i]=='input'||el[i]=='button'||el[i]=='select'||el[i]=='textarea'){e[j].style.borderStyle='none';e[j].style.borderBottom='1px solid #000';}if(el[i]=='i'||el[i]=='em'||el[i]=='cite'||el[i]=='q'){e[j].style.color='#990099';}e[j].style.fontFamily='courier,monotype';}}}var h=db.innerHTML;h=h.replace(/<\/tr>/ig,'<br>');h=h.replace(/<[bh]([1-6]|ig)[^>]*>/ig,'<b>');h=h.replace(/<\/[bh]([1-6]|ig)>/ig,'</b>');h=h.replace(/<[\/]?[ftc][eobard](nter|ble|ody|nt)?[^>]*>/ig,'');db.innerHTML=h;void('Lynx Emulator by brothercake');


    I've noticed that after a certain length in only works in mozilla. So for big ones, presumably it's better to create an element and call a remote script?
    Last edited by brothercake; 03-19-2003 at 12:58 AM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #7
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by brothercake
    I've noticed that after a certain length in only works in mozilla. So for big ones, presumably it's better to create an element and call a remote script?
    For some reason, IE6 introduced a limit of characters (500 or smthg like that) for bookmarklets, so it literally cuts the script
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #8
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    figures that when you post this i'd be on vacation and away from all my bookmarklets. i don't even remember what all i've got.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #9
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    ie6w has a 508 character limit in bookmarklets. Not on javascript: links in pages, though.

    nn4 has different limits in different versions - 2kb and 4 kb resp.

    I'm not aware of any limit in mozilla, but then I've never tried to break it either.

    As for Konq/Saf, Opera, IEMac, I have no idea, except I know there was a browser with a 1059 byte limit at some time, that I broke by two bytes.



    For a list of good bookmarklet sites, see Webgraphics. on the bottom of the linklist to the right.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #10
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    620
    Thanks
    1
    Thanked 20 Times in 20 Posts
    I have a few posted on the "Samples of my work > Bookmarklets" page at:

    &nbsp;http://spruce.flint.umich.edu/~jalarie/

    And an editor for them linked from that same page.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Very nice
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #12
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    most of the ones that i have, are things that most people could put together themselves. Change Text Color, Change Background Color, Remove Background Picture, Whois This Site, Toggle Images' Visibility, things like that.

    I'm working on one that will list all the javascript functions on the page, and let you kill any you don't want to run, and one that will translate the page you're looking at.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #13
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: a few simple bookmarklets

    Originally posted by brothercake
    Here's a small collection of bookmarklets for disecting your own (or other people's!) websites. They do things like, show all TABLE elements with a red border, hide non-link images, and so on.
    couldnt you do that with a user stylesheet? *feeling dumb*

  • #14
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Re: a few simple bookmarklets

    Originally posted by cg9com
    couldnt you do that with a user stylesheet?
    Yeah, just as easily; but this is convenient because it's a link - ergo, a button on the toolbar rather than something I have to go to preferences to change
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #15
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    There's a mozilla add-on that might interest you, called ContextMenu Extensions. With it you can add custom stylesheets and javascripts to the context menu, create local javascripts and stylesheets for single pages or domains, and a lot more. In fact, it's one of the more useful mozilla add-ons, as is the Tabbrowser Extionsions from the same source. Those two, checky and optimoz mouse gestures are the basic must-haves for mozilla.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •