[userscript] OC Icon API - BROKEN | Tools & Userscripts | TORN

[userscript] OC Icon API - BROKEN

​

    • PsycWard [1579270]
    • Role: Civilian
    • Level: 100
    • Posts: 2,359
    • Karma: 2,575
    • Last Action: 2 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 04:50:12 - 16/09/15 (11 years ago)
    |
    Last replied 01:27:23 - 19/03/18 (8 years ago)
    A faction mate said something in chat about wanting to create an icon that showed organized crime time. So I wrote this, it pulls data from the API and adds it to the faction icon. The script only updates when pages are loaded so it won't constantly update unless you make it. Also if icons refresh which seems to happen every 5 minutes with Nerve it will revert back to normal.

    If you download the script you will have to find var API=""; in the script and enter your API key. You will also need API perms from your faction.
    The similar name problem of the old version should no longer exist thanks to the API displaying user ID. As usual I have tested this on Chrome, I don't use FF or any other browser so if it doesn't work for other browsers sorry. If you experience issues with FF removing the @require line may solve the problem.

    If you have an issue explain your problem, I will simply ignore posts that say it's not working.
    Your browser and what the exact problem is should be included. If you can't be bothered to tell me that, I can't be bothered to look into your problem.






    OC Icon API stores the OC data in a cookie for repeated use without calling to the torn server. This information will then be displayed when hovering over the faction icon the same as above but will still show after the text is cleared out when the icons refresh. In addition I've added a feature that will estimate OC time while traveling. To update the time while travelling refresh the page.
    I have traveled a few times, as of right now it seems to be accurate to the minute but there maybe bugs that I don't know about. This does use a jQuery cookie library so I don't know if GM users will experience problems or not.



    OC Icon API
    Last edited by PsycWard on 01:27:45 - 19/03/18 (8 years ago)
    • Cursed [1901987]
    • Role: Civilian
    • Level: 100
    • Posts: 5,216
    • Karma: 5,425
    • Last Action: 18 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:01:55 - 16/09/15 (11 years ago)
    Post link copied to clipboard Copy post link
    R+ very useful!
    • Untouchable [1360035]
    • Role: Committee
    • Level: 100
    • Posts: 6,416
    • Karma: 10,142
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:43:12 - 16/09/15 (11 years ago)
    Post link copied to clipboard Copy post link
    Doesn't work for me...

    untouchable.gif

     

    supernatural-forum.gif

     

    8s8scmw.gif

     

    551bf89c-d378-499c-a4a8-144e2909a36f-1360035.jpg

     

    LSD

     

    8240d638-130f-4764-8070-a6a89e54af0e-1360035.png

     

    699ae43a-9cb4-443d-baf8-5c051421ca86-1360035.png

     

    98273d0d-6edf-4e46-98ed-22f265cd8481-1360035.png

     

    de138be2-a016-4e59-9c9c-0fe372ef12b8-1360035.png

     

    74a34a1e-6a68-483c-9f03-c98d4ebef058-1360035.png

     

    untouchableforumsoftware.png

     

    SONIC-2.jpg

     

    b4d1cbe0-5736-4d8e-9d07-b95530f59c2a-1360035.png

    • boo [1544641]
    • Role: Civilian
    • Level: 100
    • Posts: 4,743
    • Karma: 12,155
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 00:14:24 - 17/09/15 (11 years ago)
    Post link copied to clipboard Copy post link

    Untouchable [1360035]

    Doesn't work for me...
    Try this instead:

    // ==UserScript==
    // @name OC Icon
    // @namespace http://www.browserscripts.blogger.com
    // @author PsycWard
    // @include http://*.torn.com/*
    // @version 0.1
    // @require http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js
    // ==/UserScript==

    $.ajax({type: 'post',url: 'http://www.torn.com/factions.php?step=your#/tab=crimes',data:{step: 'crimes'}}).then(function(data){
    var fT=$(data);
    var tempTime=fT.find("li.team:contains('REPLACE YOUR NAME HERE')").siblings("li.status").text();
    if (tempTime.length>0){
    var ocTime= "
    OC - " + tempTime;
    var facI=$("#icon9").attr("title");
    $("#icon9").attr("title",facI+ocTime);}
    });
    Last edited by boo on 00:16:19 - 17/09/15 (11 years ago)

    • LordSam [1900989]
    • Role: Civilian
    • Level: 100
    • Posts: 4,843
    • Karma: 1,987
    • Last Action: 6 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 00:32:18 - 17/09/15 (11 years ago)
    Post link copied to clipboard Copy post link
    ah. thankyou very much.

    LordSam.

    • Untouchable [1360035]
    • Role: Committee
    • Level: 100
    • Posts: 6,416
    • Karma: 10,142
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 00:37:19 - 17/09/15 (11 years ago)
    Post link copied to clipboard Copy post link

    Untouchable [1360035]

    Doesn't work for me...

    boo [1544641]

    Try this instead: // ==UserScript== // @name OC Icon // @namespace http://www.browserscripts.blogger.com // @author PsycWard // @include http://*.torn.com/* // @version 0.1 // @require http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js // ==/UserScript== $.ajax({type: 'post',url: 'http://www.torn.com/factions.php?step=your#/tab=crimes',data:{step: 'crimes'}}).then(function(data){ var fT=$(data); var tempTime=fT.find("li.team:contains('REPLACE YOUR NAME HERE')").siblings("li.status").text(); if (tempTime.length>0){ var ocTime= "
    OC - " + tempTime; var facI=$("#icon9").attr("title"); $("#icon9").attr("title",facI+ocTime);} });
    It's fine, I fixed it.

    untouchable.gif

     

    supernatural-forum.gif

     

    8s8scmw.gif

     

    551bf89c-d378-499c-a4a8-144e2909a36f-1360035.jpg

     

    LSD

     

    8240d638-130f-4764-8070-a6a89e54af0e-1360035.png

     

    699ae43a-9cb4-443d-baf8-5c051421ca86-1360035.png

     

    98273d0d-6edf-4e46-98ed-22f265cd8481-1360035.png

     

    de138be2-a016-4e59-9c9c-0fe372ef12b8-1360035.png

     

    74a34a1e-6a68-483c-9f03-c98d4ebef058-1360035.png

     

    untouchableforumsoftware.png

     

    SONIC-2.jpg

     

    b4d1cbe0-5736-4d8e-9d07-b95530f59c2a-1360035.png

    • VeD [1635794]
    • Role: Civilian
    • Level: 96
    • Posts: 378
    • Karma: 114
    • Last Action: 3 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 08:01:36 - 17/09/15 (11 years ago)
    Post link copied to clipboard Copy post link
    working :)
    Last edited by VeD on 08:02:57 - 17/09/15 (11 years ago)

    "Before you embark on a journey of revenge, you should first dig two graves." - Confucius

    • Comstock [1379070]
    • Role: Civilian
    • Level: 50
    • Posts: 90
    • Karma: 26
    • Last Action: 9 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 09:15:23 - 17/09/15 (11 years ago)
    Post link copied to clipboard Copy post link
    Dude, it messes with your Travel Countdown Timer [:tired:]



    This is how it looks when active:





    and when not, the usual:

    • PsycWard [1579270]
    • Role: Civilian
    • Level: 100
    • Posts: 2,359
    • Karma: 2,575
    • Last Action: 2 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 10:59:50 - 17/09/15 (11 years ago)
    Post link copied to clipboard Copy post link

    Comstock [1379070]

    Dude, it messes with your Travel Countdown Timer [:tired:] This is how it looks when active: [img width=1104 height=539]http://s3.amazonaws.com/profileimages.torn.com/29f2881d-8415-cefd-1379070.png[/img] and when not, the usual: [img width=1131 height=553]http://s3.amazonaws.com/profileimages.torn.com/29f2881d-842b-a9af-1379070.png[/img]
    Interesting, I'll look into it. I haven't traveled since I wrote it so I had not seen that.
    • PsycWard [1579270]
    • Role: Civilian
    • Level: 100
    • Posts: 2,359
    • Karma: 2,575
    • Last Action: 2 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 12:07:30 - 17/09/15 (11 years ago)
    Post link copied to clipboard Copy post link

    Comstock [1379070]

    Dude, it messes with your Travel Countdown Timer [:tired:] This is how it looks when active: [img width=1104 height=539]http://s3.amazonaws.com/profileimages.torn.com/29f2881d-8415-cefd-1379070.png[/img] and when not, the usual: [img width=1131 height=553]http://s3.amazonaws.com/profileimages.torn.com/29f2881d-842b-a9af-1379070.png[/img]
    I have not been able to replicate the problem so far. Are you using Chrome? Do you have developer tools? If so open developer tools and then click on the console tab. Do you see any errors?

    On a side note I did see that the script was running twice in a row for me, once for factions.php then again for /includes so I have added a line to prevent it from running again on includes.
    Related to traveling I originally kept the script very simple and did not have a step to make sure the faction data loaded. While traveling you can't access faction data and an error page is given instead. I've added a step now that will stop the script if the faction page is not loaded but I will need to get back to torn to test it.
    • Harley [258120]
    • Role: Wiki Contributor
    • Level: 100
    • Posts: 13,081
    • Karma: 24,256
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 21:17:20 - 18/09/15 (11 years ago)
    Post link copied to clipboard Copy post link

    Comstock [1379070]

    Dude, it messes with your Travel Countdown Timer [:tired:] This is how it looks when active: [img width=1104 height=539]http://s3.amazonaws.com/profileimages.torn.com/29f2881d-8415-cefd-1379070.png[/img] and when not, the usual: [img width=1131 height=553]http://s3.amazonaws.com/profileimages.torn.com/29f2881d-842b-a9af-1379070.png[/img]

    PsycWard [1579270]

    I have not been able to replicate the problem so far. Are you using Chrome? Do you have developer tools? If so open developer tools and then click on the console tab. Do you see any errors? On a side note I did see that the script was running twice in a row for me, once for factions.php then again for /includes so I have added a line to prevent it from running again on includes. Related to traveling I originally kept the script very simple and did not have a step to make sure the faction data loaded. While traveling you can't access faction data and an error page is given instead. I've added a step now that will stop the script if the faction page is not loaded but I will need to get back to torn to test it.
    the original script works fine for me, even when flying. The timer still works..

    It would also be nice to have like a little timer added which you can configure, that's like under the little plane. So we can see how long till the next oc is coming, just throwing an idea !


    edit: this script is the best by the way.. This should significantly reduce the amount of OC - fines I get xD
    Last edited by Harley on 21:24:56 - 18/09/15 (11 years ago)

    • PsycWard [1579270]
    • Role: Civilian
    • Level: 100
    • Posts: 2,359
    • Karma: 2,575
    • Last Action: 2 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 22:36:28 - 18/09/15 (11 years ago)
    Post link copied to clipboard Copy post link

    Comstock [1379070]

    Dude, it messes with your Travel Countdown Timer [:tired:] This is how it looks when active: [img width=1104 height=539]http://s3.amazonaws.com/profileimages.torn.com/29f2881d-8415-cefd-1379070.png[/img] and when not, the usual: [img width=1131 height=553]http://s3.amazonaws.com/profileimages.torn.com/29f2881d-842b-a9af-1379070.png[/img]

    PsycWard [1579270]

    I have not been able to replicate the problem so far. Are you using Chrome? Do you have developer tools? If so open developer tools and then click on the console tab. Do you see any errors? On a side note I did see that the script was running twice in a row for me, once for factions.php then again for /includes so I have added a line to prevent it from running again on includes. Related to traveling I originally kept the script very simple and did not have a step to make sure the faction data loaded. While traveling you can't access faction data and an error page is given instead. I've added a step now that will stop the script if the faction page is not loaded but I will need to get back to torn to test it.

    Harley [258120]

    the original script works fine for me, even when flying. The timer still works.. It would also be nice to have like a little timer added which you can configure, that's like under the little plane. So we can see how long till the next oc is coming, just throwing an idea ! edit: this script is the best by the way.. This should significantly reduce the amount of OC - fines I get xD
    Thank you.
    I made a version that stores the last loaded time to a cookie so that when the icons refresh the "OC - (time)" doesn't disappear. I was going to add it but I get pretty lazy with this stuff these days. I could easily add "OC Time as of Departure - (time)" to the travel page. Creating something that attempted to give a somewhat accurate current time while traveling might be a little more difficult but I'll put some thought into it, since it does seem like a good idea.
    • PsycWard [1579270]
    • Role: Civilian
    • Level: 100
    • Posts: 2,359
    • Karma: 2,575
    • Last Action: 2 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:10:08 - 19/09/15 (11 years ago)
    Post link copied to clipboard Copy post link
    I have added a version that uses a cookie to estimate OC time while traveling. OC Icon C
    • Valaskjalf [1503919]
    • Role: Civilian
    • Level: 100
    • Posts: 464
    • Karma: 352
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 00:26:20 - 22/09/15 (11 years ago)
    Post link copied to clipboard Copy post link
    Doesn't display correctly if OC time is over 100 hours.
    • PsycWard [1579270]
    • Role: Civilian
    • Level: 100
    • Posts: 2,359
    • Karma: 2,575
    • Last Action: 2 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 01:46:28 - 22/09/15 (11 years ago)
    Post link copied to clipboard Copy post link

    Valaskjalf [1503919]

    Doesn't display correctly if OC time is over 100 hours.
    I'll switch the name and see what I can find.

    Edit: I'll have to wait there are none 100+ right now. Which browser and script are you using? What is does the display look like and is the problem with the icon, while traveling or both?

    Edit#2: I'm now in a 100+ crime and I see no problems OC Icon C.

    Last edited by PsycWard on 13:02:51 - 26/09/15 (11 years ago)
    • NoodlyPiggy [1863033]
    • Role: Civilian
    • Level: 24
    • Posts: 817
    • Karma: 574
    • Last Action: 7 years
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:54:40 - 14/10/15 (11 years ago)
    Post link copied to clipboard Copy post link
    Doesn't work if using https rather than http



    Please add me to your friend list :)

    • PsycWard [1579270]
    • Role: Civilian
    • Level: 100
    • Posts: 2,359
    • Karma: 2,575
    • Last Action: 2 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 03:31:19 - 14/10/15 (11 years ago)
    Post link copied to clipboard Copy post link

    NoodlyPiggy [1863033]

    Doesn't work if using https rather than http
    Edit: Okay, I looked at it a bit and I think it's the same reason tornstats script doesn't work on https.
    I believe while using https it doesn't allow http connections. So if you have the cookie stored already (by using http://) it will work to an extent. If you use https all the time you may want to try adding a "s" to url: 'http://www.torn.com/factions.php' in the script. I don't use https so it hasn't been a problem for me.
    Last edited by PsycWard on 03:45:14 - 14/10/15 (11 years ago)
    • NoodlyPiggy [1863033]
    • Role: Civilian
    • Level: 24
    • Posts: 817
    • Karma: 574
    • Last Action: 7 years
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 04:34:31 - 14/10/15 (11 years ago)
    Post link copied to clipboard Copy post link

    NoodlyPiggy [1863033]

    Doesn't work if using https rather than http

    PsycWard [1579270]

    Edit: Okay, I looked at it a bit and I think it's the same reason tornstats script doesn't work on https. I believe while using https it doesn't allow http connections. So if you have the cookie stored already (by using http://) it will work to an extent. If you use https all the time you may want to try adding a "s" to url: 'http://www.torn.com/factions.php' in the script. I don't use https so it hasn't been a problem for me.
    Thanks for the quick reply. :)



    Please add me to your friend list :)

    • krazy_kiwi [372539]
    • Role: Civilian
    • Level: 100
    • Posts: 1,010
    • Karma: 445
    • Last Action: Now
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:54:10 - 18/10/15 (11 years ago)
    Post link copied to clipboard Copy post link
    it dosent seem to work for me, can you please post link for newest update. thanks
    • PsycWard [1579270]
    • Role: Civilian
    • Level: 100
    • Posts: 2,359
    • Karma: 2,575
    • Last Action: 2 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 03:11:39 - 18/10/15 (11 years ago)
    Post link copied to clipboard Copy post link

    krazy_kiwi [372539]

    it dosent seem to work for me, can you please post link for newest update. thanks
    I just tried both links, they both worked for me. Are one of the links not working, if so which one or once installed the script isn't working?
Reply
Thread Title: