Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Basket to Post script

Options
124

Comments

  • Registered Users Posts: 7,014 ✭✭✭witnessmenow


    Hey Fluffy

    You should have a look at throwing this up on something like github, its nice way of tracking bugs, feature reqs etc.

    Its free once its open to be viewed by anyone, seeing as its Javascript and can be seen by anyone anyways I don't see any downfall :)

    Also if you ever need somewhere to host give me a shout, I'd gladly be able to squeeze it somewhere!


  • Registered Users Posts: 1,414 ✭✭✭Fluffy88


    I have been wanting to put it in a Git or SVN repo for awhile now, along with any other small scripts I have but I'm just so damned lazy I can't be bothered :P
    I might do it someday but with something so small there is rarely a need for version control.

    It would be useful for the other things you mentioned, feature requests and so on.
    I'll try get over my lazyness someday and make the leap :P
    Thanks for the suggestion though.


  • Registered Users Posts: 4,983 ✭✭✭Tea_Bag


    well!

    got another one for you :P

    www.mindfactory.de

    thanks man!


  • Registered Users Posts: 1,414 ✭✭✭Fluffy88


    Finally Tea I got around to this, sorry it took so long :)
    Soon I'll be taking witnessmenow's advice and get this setup on Github, part of the reason it took longer coz I have to learn git :/


  • Registered Users Posts: 10,299 ✭✭✭✭BloodBath


    Love the script man, saves a lot of work, so thank you.

    I can't get the new or old version of the script to work with hardwareversand though.

    -edit

    Nm the new script is working now, thanks again.


  • Advertisement
  • Registered Users Posts: 26 Hellfire57


    JavaScript:var debug = false;function loadScript( url ){if ( document.getElementById("basket_parser") == null ){var script = document.createElement( "script" );script.setAttribute( "id", "basket_parser" );script.setAttribute( "type", "text/javascript" );script.setAttribute( "src", url + "?" + Math.random() * 10000000 );document.getElementsByTagName( "head" )[0].appendChild( script );setTimeout( "loadScript('" + url + "')", 200 );log( "Started loading script: " + url );}else if ( typeof( init_script ) != 'undefined' ){log( "Loaded." );init_script();}else{setTimeout( "loadScript('" + url + "')", 200 );log( "loading ..." );}}function log (string){if ( debug ){document.body.appendChild( document.createTextNode( string ) );document.body.appendChild( document.createElement( "br" ) );}}loadScript( "http://fluffy88.com/scripts/basket_parser.js" );void( 0 );


  • Registered Users Posts: 3,361 ✭✭✭randombar


    Hi All,

    Anyone have a copy of the basket_parser.js file?

    Seems like Fluffy's account has been suspended for some reason?

    Might be worth building it up as a chrome add on.

    // Gary


  • Registered Users Posts: 36,165 ✭✭✭✭ED E


    Account for domain fluffy88.com has been suspended

    :(


  • Registered Users Posts: 10,299 ✭✭✭✭BloodBath


    The script needs a a minor update to change the delivery price for hardwareversand to €11.99 as well.


  • Registered Users Posts: 3,361 ✭✭✭randombar


    If someone has a copy of it I could throw it up somewhere?


  • Advertisement
  • Registered Users Posts: 6,710 ✭✭✭Monotype


    An easy enough way to ensure that it doesn't go down might be just to link to an attachment in the forum itself.

    Let's see if it works with an older version...

    [php]javascript:var before = 'Item|Price'; var after = '';var format='{itm_quantity}{itm_name}|{itm_price}';var debug = false;function loadScript( url ){if ( document.getElementById( "basket_parser" ) == null ){var script = document.createElement( "script" );script.setAttribute( "id", "basket_parser" );script.setAttribute( "type", "text/javascript" );script.setAttribute( "src", url + "&" + Math.pow( new Date().getMonth(), 2 ) + Math.pow( new Date().getDate(), 3 ) );document.getElementsByTagName( "head" )[0].appendChild( script );setTimeout( "loadScript('" + url + "')", 200 );log( "Started loading script: " + url );}else if ( typeof( init_script ) != 'undefined' ){log( "Loaded." );init_script();}else{setTimeout( "loadScript('" + url + "')", 200 );log( "loading ..." );}}function log( string ){if ( debug ){document.body.appendChild( document.createTextNode( string ) );document.body.appendChild( document.createElement( "br" ) );}}loadScript( "https://us.v-cdn.net/6034073/uploads/attachments/106486/314859.txt");void(0); [/php]


    ... Seems to work. I updated the postage costs for hardwareversand, but the additional websites in the newer versions would be appreciated.


  • Registered Users Posts: 7,014 ✭✭✭witnessmenow


    Is Fluffy still active?

    I can host the script on Checkargos's server somewhere if required, would not be any hassle or cost


  • Registered Users Posts: 3,361 ✭✭✭randombar


    Monotype wrote: »
    An easy enough way to ensure that it doesn't go down might be just to link to an attachment in the forum itself.

    Let's see if it works with an older version...

    [php]javascript:var before = 'Item|Price'; var after = '';var format='{itm_quantity}{itm_name}|{itm_price}';var debug = false;function loadScript( url ){if ( document.getElementById( "basket_parser" ) == null ){var script = document.createElement( "script" );script.setAttribute( "id", "basket_parser" );script.setAttribute( "type", "text/javascript" );script.setAttribute( "src", url + "&" + Math.pow( new Date().getMonth(), 2 ) + Math.pow( new Date().getDate(), 3 ) );document.getElementsByTagName( "head" )[0].appendChild( script );setTimeout( "loadScript('" + url + "')", 200 );log( "Started loading script: " + url );}else if ( typeof( init_script ) != 'undefined' ){log( "Loaded." );init_script();}else{setTimeout( "loadScript('" + url + "')", 200 );log( "loading ..." );}}function log( string ){if ( debug ){document.body.appendChild( document.createTextNode( string ) );document.body.appendChild( document.createElement( "br" ) );}}loadScript( "https://us.v-cdn.net/6034073/uploads/attachments/106486/314859.txt");void(0); [/php]


    ... Seems to work. I updated the postage costs for hardwareversand, but the additional websites in the newer versions would be appreciated.

    What were the additional websites, might see if I can add them.

    Code seems ok.

    [HTML]
    function memoryc() {
    var b = new Array();
    var c = jQuery('#bctotal_price').text();
    b.push("Total build cost: " + c);
    jQuery('.blue_border_tr:eq(0) tr:contains("Item Number")').each(function (a) {
    item.itm_url = jQuery('.prod_desc', this).attr('href');
    item.itm_name = jQuery('.title_green_font', this).text();
    item.itm_price = jQuery('span[id^="cart_vat"]', this).text().match(/VAT(.\s[^\s]+)/i)[1];
    item.itm_quantity = parseInt(jQuery('input[name^="quantity"]', this).val(), 10);
    item.itm_quantity = (item.itm_quantity > 1 ? item.itm_quantity + ' x ' : '');
    b.push(replaceVars(item))
    });
    return b
    [/HTML]


  • Registered Users Posts: 6,710 ✭✭✭Monotype


    specialtech, aria, komplett, mindfactory and computeruniverse.

    I'd say give Fluffy a few days to get back. He's probably just busy and doesn't have the time to be checking out files at the moment. No point in creating extra work and creating forks in development!


  • Registered Users Posts: 36,165 ✭✭✭✭ED E


    Doesnt work for me in chrome. Or firefox.


  • Registered Users Posts: 1,259 ✭✭✭..Brian..


    Awesome, working for me in Firefox again :)


  • Registered Users Posts: 3,361 ✭✭✭randombar


    Monotype wrote: »
    specialtech, aria, komplett, mindfactory and computeruniverse.

    I'd say give Fluffy a few days to get back. He's probably just busy and doesn't have the time to be checking out files at the moment. No point in creating extra work and creating forks in development!

    Good point. I wonder could we move it to github or something and get a few people working on it?

    I wrote up the specialtech function there, seemed ok, wasn't sure what do with vat and delivery?

    [HTML]

    function specialtech() {
    var a = new Array();
    var b = document.getElementsByClassName('ProductPriceSmall')[5].innerHTML;
    var c = document.getElementsByClassName('ProductPriceSmall')[4].innerHTML;
    var d = document.getElementsByClassName('ProductPriceSmall')[3].innerHTML;
    var e = document.getElementsByClassName('ProductPriceSmall')[2].innerHTML;
    a.push("Total build cost: " + b + " (inc Vat "+ e+ ", Shipping " + d + " and VAT on Shippig " + c + ")");
    var c = document.forms.cartform.getElementsByTagName('table')[0];
    var d = c.rows;
    for (var i = 0; i < d.length; i = i+2) {
    item.itm_url = d.cells[0].getElementsByTagName("a")[0].href;
    item.itm_name = d.cells[1].getElementsByClassName("ProductTitle")[0].innerHTML;
    item.itm_price = d.cells[1].getElementsByClassName("ProductPrice")[0].innerHTML;
    item.itm_quantity = parseInt(d.cells[1].getElementsByTagName("input")[0].value, 10);
    item.itm_quantity = (item.itm_quantity > 1 ? item.itm_quantity + ' x ' : '');
    console.log(item);
    a.push(replaceVars(item))
    };
    return a
    }


    [/HTML]


  • Registered Users Posts: 3,361 ✭✭✭randombar




  • Registered Users Posts: 36,165 ✭✭✭✭ED E


    Bump. Still doesnt work for me. FF is parsing the bookmark into %20's so I paste it into the address bar, allow JS in the address bar, still nothing. Chrome doesnt do anything either.

    [php]JavaScript:var before = 'Item|Price'; var after = '';var format='{itm_quantity}{itm_name}|{itm_price}';var debug = false;function loadScript( url ){if ( document.getElementById( "basket_parser" ) == null ){var script = document.createElement( "script" );script.setAttribute( "id", "basket_parser" );script.setAttribute( "type", "text/javascript" );script.setAttribute( "src", url + "&" + Math.pow( new Date().getMonth(), 2 ) + Math.pow( new Date().getDate(), 3 ) );document.getElementsByTagName( "head" )[0].appendChild( script );setTimeout( "loadScript('" + url + "')", 200 );log( "Started loading script: " + url );}else if ( typeof( init_script ) != 'undefined' ){log( "Loaded." );init_script();}else{setTimeout( "loadScript('" + url + "')", 200 );log( "loading ..." );}}function log( string ){if ( debug ){document.body.appendChild( document.createTextNode( string ) );document.body.appendChild( document.createElement( "br" ) );}}loadScript( "https://us.v-cdn.net/6034073/uploads/attachments/106486/314859.txt");void(0);
    undefined
    Resource interpreted as Script but transferred with MIME type plain/text: "https://us.v-cdn.net/6034073/uploads/attachments/106486/314859.txt". VM89:2
    Refused to execute script from 'https://us.v-cdn.net/6034073/uploads/attachments/106486/314859.txt[/php]

    Tried modifying it to other locations of the file, and the newone gary posted, but nothing works :(


  • Registered Users Posts: 3,361 ✭✭✭randombar


    Works ok for me in Chrome for HardwareVersand.de

    Did you just paste the following code into the bookmark url:

    javascript:var debug = true;function loadScript( url ){if ( document.getElementById("basket_parser") == null ){var script = document.createElement( "script" );script.setAttribute( "id", "basket_parser" );script.setAttribute( "type", "text/javascript" );script.setAttribute( "src", url + "?" + Math.random() * 10000000 );document.getElementsByTagName( "head" )[0].appendChild( script );setTimeout( "loadScript('" + url + "')", 200 );log( "Started loading script: " + url );}else if ( typeof( init_script ) != 'undefined' ){log( "Loaded." );init_script();}else{setTimeout( "loadScript('" + url + "')", 200 );log( "loading ..." );}}function log (string){if ( debug ){document.body.appendChild( document.createTextNode( string ) );document.body.appendChild( document.createElement( "br" ) );}}loadScript( "http://www.garycorcoran.com/js/basket_parser.js&quot; );void( 0 );


  • Advertisement
  • Registered Users Posts: 36,165 ✭✭✭✭ED E


    I had tried that before, didnt work. Did it again now and its going. Hmmmmmm, think it might have been a whitespace error...

    Yours:
    [php]
    javascript:var debug = true;function loadScript( url ){if ( document.getElementById("basket_parser") == null ){var script = document.createElement( "script" );script.setAttribute( "id", "basket_parser" );script.setAttribute( "type", "text/javascript" );script.setAttribute( "src", url + "?" + Math.random() * 10000000 );document.getElementsByTagName( "head" )[0].appendChild( script );setTimeout( "loadScript('" + url + "')", 200 );log( "Started loading script: " + url );}else if ( typeof( init_script ) != 'undefined' ){log( "Loaded." );init_script();}else{setTimeout( "loadScript('" + url + "')", 200 );log( "loading ..." );}}function log (string){if ( debug ){document.body.appendChild( document.createTextNode( string ) );document.body.appendChild( document.createElement( "br" ) );}}loadScript( "http://www.garycorcoran.com/js/basket_parser.js&quot; );void( 0 );
    [/php]

    Id tried:
    [php]
    javascript:var before = 'Item|Price'; var after = '';var format='{itm_quantity}{itm_name}|{itm_price}';var debug = false;function loadScript( url ){if ( document.getElementById( "basket_parser" ) == null ){var script = document.createElement( "script" );script.setAttribute( "id", "basket_parser" );script.setAttribute( "type", "text/javascript" );script.setAttribute( "src", url + "&" + Math.pow( new Date().getMonth(), 2 ) + Math.pow( new Date().getDate(), 3 ) );document.getElementsByTagName( "head" )[0].appendChild( script );setTimeout( "loadScript('" + url + "')", 200 );log( "Started loading script: " + url );}else if ( typeof( init_script ) != 'undefined' ){log( "Loaded." );init_script();}else{setTimeout( "loadScript('" + url + "')", 200 );log( "loading ..." );}}function log( string ){if ( debug ){document.body.appendChild( document.createTextNode( string ) );document.body.appendChild( document.createElement( "br" ) );}}loadScript( "https://raw.githubusercontent.com/garycocs/baskettopost/master/basket_parser.js");void(0);
    [/php]
    and
    [php]
    javascript:var before = 'Item|Price'; var after = '';var format='{itm_quantity}{itm_name}|{itm_price}';var debug = false;function loadScript( url ){if ( document.getElementById( "basket_parser" ) == null ){var script = document.createElement( "script" );script.setAttribute( "id", "basket_parser" );script.setAttribute( "type", "text/javascript" );script.setAttribute( "src", url + "&" + Math.pow( new Date().getMonth(), 2 ) + Math.pow( new Date().getDate(), 3 ) );document.getElementsByTagName( "head" )[0].appendChild( script );setTimeout( "loadScript('" + url + "')", 200 );log( "Started loading script: " + url );}else if ( typeof( init_script ) != 'undefined' ){log( "Loaded." );init_script();}else{setTimeout( "loadScript('" + url + "')", 200 );log( "loading ..." );}}function log( string ){if ( debug ){document.body.appendChild( document.createTextNode( string ) );document.body.appendChild( document.createElement( "br" ) );}}loadScript( "https://us.v-cdn.net/6034073/uploads/attachments/106486/314859.txt");void(0);
    [/php]

    And a few other combinations/pastes.

    I dont know PHP but the first thing I spotted is the spaces around that trailing zero. In any case it works now, thanks! Back to NAS planning.


  • Registered Users Posts: 16,382 ✭✭✭✭greendom


    I have tried this in connection with a thread I have on this forum. In Chrome I click on the bookmark from the Dabs.ie shopping basket and an empty orange surrounded box appears. Anyone know what I'm doing wrong


  • Registered Users Posts: 1,414 ✭✭✭Fluffy88


    Hi guys, I stopped actively following this forum and wasn't following this thread so I never noticed things going wrong.

    My old webhosting has been gone for awhile now, but I had moved the scripts into Github prior to that. I'm really not sure whether the version in Github is old or up-to-date but it's mostly all there.
    https://github.com/fluffy88/Basket-Parser
    Feel free to make updates or pull requests :)

    I'm going to give it a try now and see if it still works.


  • Registered Users Posts: 6,710 ✭✭✭Monotype


    He's aliiiiive!


  • Registered Users Posts: 1,414 ✭✭✭Fluffy88


    :o sorry for abandoning you all

    There was a small change needed for HWVS as the popup box was getting hidden behind the page. I haven't checked all the other sites and I probably won't :P HWVS and Dabs are working for me in Firefox.

    You can get the up-to-date caller script from here
    https://github.com/fluffy88/Basket-Parser/blob/master/basket_parser_caller.js
    And all the other code is there too.

    Seems there is a different issue with Chrome though, at least I can't run the script in Chrome running on Fedora.
    It's caused by using Github as a hosting site, so it might not be a long term solution.


  • Registered Users Posts: 1,414 ✭✭✭Fluffy88


    Okely dokely .. I think I have it sorted.

    I'm now using Github pages for hosting the minified version of the script, which solves the issue I had with Chrome.
    Originally I was using the "raw" file feature in Github for hosting the script. Turns out, when you do that, all files, no matter what their file extension is, are served by the Github webserver with the file encoding "text/plain". Chrome didn't like executing a script which it received as a text file, so by using Github pages to host the minified version of the script, it will get served with the correct "application/javascript" file encoding keeping Chrome happy :)

    So, in short it's working again, for everyone, hopefully :)
    Oh and Amazon is working now too.


  • Registered Users Posts: 11,397 ✭✭✭✭Digital Solitude


    It kinda works Fluffy :o


  • Registered Users Posts: 1,414 ✭✭✭Fluffy88


    It kinda works Fluffy :o

    What browser are you using?
    And which website is it?


  • Registered Users Posts: 11,397 ✭✭✭✭Digital Solitude


    Fluffy88 wrote: »
    What browser are you using?
    And which website is it?

    Sorry, Hardwareversand on Chrome


  • Advertisement
  • Registered Users Posts: 1,414 ✭✭✭Fluffy88


    Item|Price
    Intel Core i7-4790K Box, LGA1150|€347.99
    Samsung SSD 850 EVO SATA 6Gb/s 250 GB|€109.99
    MSI GeForce GTX 970 Gaming 4G, 4GB GDDR5|€374.99
    8GB-Kit Crucial Ballistix Sport Series DDR3-1600, CL9|€62.06
    Shipping|€18.99
    Total|€914.02

    I am using Fedora with Chrome Version 40.0.2214.94 (64-bit).
    Are you doing something different?

    I added a number of items to the basket and it worked.


Advertisement