Welcome guest, is this your first visit? Create Account now to join.
Results 1 to 7 of 7

This is a discussion on Converting Bookmarklet into User Script within the Plugins Troubleshooting section, part of the Chrome Plugins category: What i want is for the following bookmarklet, to be automatically ran, not prompt the user (using www.google.com , and ...


  1. #1
    Bloody_Turds is offline Senior Member
    Join Date
    Aug 2009
    Posts
    152

    Default Converting Bookmarklet into User Script

    What i want is for the following bookmarklet, to be automatically ran, not prompt the user (using www.google.com, and the current webpage), and display the left window as rar left as i could get it (so the webpage is unchanged, but dragbar functionality is added to google:
    Code:
    javascript:A14nH=location.href;L3f7=prompt('Choose%20File%201',A14nH);R1Gh7=prompt('Choose%20File%202',L3f7);if(L3f7&&R1Gh7){Fr4Q='<frameset%20cols=\'*,*\'>\n<frame%20src=\''+L3f7+'\'/>';Fr4Q+='<frame%20src=\''+R1Gh7+'\'/>\n';Fr4Q+='</frameset>';with(document){write(Fr4Q);void(close())}}else{void(null)}
    so anyway, i got to messing around with the script, here being my version(Working Bookmark):
    Code:
    javascript:R1Gh7=location.href;L3f7= "http://www.google.com/";if(R1Gh7&&L3f7){Fr4Q='<frameset%20cols="0%,100%">\n<frame%20src=\''+L3f7+'\'/>';Fr4Q+='<frame%20src=\''+R1Gh7+'\'/>\n';Fr4Q+='</frameset>';with(document){write(Fr4Q);void(close())}}else{void(null)}
    which does everything I need, except run automatically. I had figured all I would have to do at this point, is download a pre-existing userscript, remove all the code below its commented tags, change the comment tags from the sites its suposed to run, to the sites I want it to run, and paste my code below (without the "javascript:" part).
    It didnt work, so i tried with that, then i tried adding: location.href = "myscript", which also didnt work. Trying this, and about 5 other things i found on google, and spending over an hour.. I decided it best to just post it here..

    I am Ok with you doing the adjustments for it to work properly, but I would apreciate if you atleast leave comments, walking me through what you did (so i can do it if i ever need)

    Or you could point me in the right direction, since im probably just missing a line of script..
    Broken Source Code:

    Code:
    // ==UserScript==
    // @name       Google Duel View
    // @namespace  http://www.5isharing.com/
    // @version    1.7.3
    // @description  Allow For Duel View on googles homepage, and Igoogle
    // @include        http://www.google.com/*
    // @copyright  2010+, Bloody_T
    // @license    GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
    // ==/UserScript==
    
    location.href = "javascript:R1Gh7=location.href;L3f7= "http://www.google.com/";if(R1Gh7&&L3f7){Fr4Q='<frameset%20cols="0%,100%">\n<frame%20src=\''+L3f7+'\'/>';Fr4Q+='<frame%20src=\''+R1Gh7+'\'/>\n';Fr4Q+='</frameset>';with(document){write(Fr4Q);void(close())}}else{void(null)}";
    Update2: still tried a bit to get it to work as a userscript, also decided im gonna have to figure out how to paste the url of the right(main) tab, into the urlbar, if possible
    Last edited by Bloody_Turds; 03-02-2010 at 04:09 AM.

  2. #2
    mg2's Avatar
    mg2
    mg2 is offline Senior Member
    Join Date
    Jun 2009
    Location
    Karlsruhe, Germany, Europe
    Posts
    328

    Default

    Ok. First i tried to make it your way, but didn't succeed for many reasons aven tried with background page. But why do it the hard way? See the page in the attachment. If you like it you can use one of the millions extensions which swap the newtab page with page XYZ. Or you can create an extension to swap google.com with this html (see http://code.google.com/chrome/extensions/override.html )
    Hope I helped.
    Attached Files Attached Files
    BETTER GMAIL for Google Chrome

    Win7 RC1
    Google Chrome Dev latest version

  3. #3
    Bloody_Turds is offline Senior Member
    Join Date
    Aug 2009
    Posts
    152

    Default

    thanks for replying, not what i was looking for though. maybe once taboverride works on any webpage, it might be good, although i think itl still be easier to somehow port it to a userscript.

  4. #4
    Waha's Avatar
    Waha is offline Senior Member
    Join Date
    Apr 2009
    Location
    Oregon
    Posts
    788

    Default

    Just use the:
    Code:
    R1Gh7=location.href;
    L3f7= "http://www.google.com/";
    if(R1Gh7&&L3f7){
    Fr4Q='<frameset cols="0%,100%">\n<frame src=\''+L3f7+'\'/>';
    Fr4Q+='<frame rc=\''+R1Gh7+'\'/>\n';
    Fr4Q+='</frameset>';
    with(document){
    write(Fr4Q);
    void(close())
    }
    }
    part for the code in your userscript. It should work.
    But last I tried I couldn't get userscripts to work at all so I dunno.

    If not, make it a Content Script in an extension.
    ~ Projects ~
    Specialized: Carapass Auction Watcher, Kongregate Chat
    Libraries: bliplib
    Tools: manifest syntax highlighting & snippits
    ~ Happy to make extensions for pay too ;D ~
    Portfolio: Search and Share

  5. #5
    Bloody_Turds is offline Senior Member
    Join Date
    Aug 2009
    Posts
    152

    Default

    @waha tried that XD, i have found a possible infinite loop, which i have taken care of, although it didnt seem to help. Im running the following with an extension called User Js, which is just easier than installing/uninstalling a userscript XD

    anyways, heres my code, it works up to that point, where the cpu spikes, although im pretty sure i have taken care of the loop..
    (it ran on www.google.com, and opened up 2 copys of www.google.com, which im pretty sure the script then ran on those, ect)

    Code:
    load_jquery(function() {
     load_script("google\.com", black_links);
    });
    
    
    
    function black_links() {
     if (parent.frames.length != 0) {
      // loaded in frames, tested this by running my bookmark, then this script on the page, it fired correctly
    	
    
    }
    else {
    $("a").css('color', 'red !important');
     // its making it this far.., but after this point it uses full cpu.. and freezes up
     
    R1Gh7=location.href;
    L3f7="http://www.google.com/";
    Fr4Q='<frameset%20cols="0%,100%">\n<frame%20src=\''+L3f7+'\'/>';
    Fr4Q+='<frame%20src=\''+R1Gh7+'\'/>\n';
    Fr4Q+='</frameset>';
    with(document){write(Fr4Q);
    void(close())}
    
    }
    }
    @make it a content script

    I might do that in a while, although i figured a userscript would be a better alternative.., and an easier first step..
    Last edited by Bloody_Turds; 03-02-2010 at 02:05 PM.

  6. #6
    Bloody_Turds is offline Senior Member
    Join Date
    Aug 2009
    Posts
    152

    Default

    Bump - still havin problems

  7. #7
    Bloody_Turds is offline Senior Member
    Join Date
    Aug 2009
    Posts
    152

    Default

    bump again... lol

Similar Threads

  1. Addon, mods, Extension, bookmarklet, and script FAQ
    By Bloody_Turds in forum Chrome Talk
    Replies: 10
    Last Post: 11-16-2014, 03:10 PM
  2. Converting Bookmarklet into User Script
    By Bloody_Turds in forum Plugins Troubleshooting
    Replies: 0
    Last Post: 02-28-2010, 01:12 PM
  3. User Script issues
    By jdwayne00 in forum Chrome Talk
    Replies: 2
    Last Post: 12-24-2009, 06:38 PM
  4. user script problem
    By mustafaokeer in forum Chrome Troubleshooting
    Replies: 10
    Last Post: 06-11-2009, 03:52 PM
  5. Adsweep - user script
    By sulasno in forum Chrome Troubleshooting
    Replies: 16
    Last Post: 06-03-2009, 12:41 PM

Posting Permissions

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