[userscript] OC Icon API - BROKEN
-
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 APILast edited by PsycWard on 01:27:45 - 19/03/18 (8 years ago) -
-
Posted on 19:01:55 - 16/09/15 (11 years ago)Post link copied to clipboard Copy post linkR+ very useful!
-
-
Posted on 19:43:12 - 16/09/15 (11 years ago)Post link copied to clipboard Copy post linkDoesn't work for me...













-
-
Posted on 00:14:24 - 17/09/15 (11 years ago)Post link copied to clipboard Copy post linkTry 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)
-
-
Posted on 00:32:18 - 17/09/15 (11 years ago)Post link copied to clipboard Copy post linkah. thankyou very much.

-
-
Posted on 00:37:19 - 17/09/15 (11 years ago)Post link copied to clipboard Copy post linkIt's fine, I fixed it.













-
-
Posted on 08:01:36 - 17/09/15 (11 years ago)Post link copied to clipboard Copy post linkworking :)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
-
-
Posted on 09:15:23 - 17/09/15 (11 years ago)Post link copied to clipboard Copy post linkDude, it messes with your Travel Countdown Timer [:tired:]
This is how it looks when active:
and when not, the usual:

-
-
Posted on 10:59:50 - 17/09/15 (11 years ago)Post link copied to clipboard Copy post linkInteresting, I'll look into it. I haven't traveled since I wrote it so I had not seen that.
-
-
Posted on 12:07:30 - 17/09/15 (11 years ago)Post link copied to clipboard Copy post linkI 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. -
-
Posted on 21:17:20 - 18/09/15 (11 years ago)Post link copied to clipboard Copy post linkthe 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 xDLast edited by Harley on 21:24:56 - 18/09/15 (11 years ago) -
-
Posted on 22:36:28 - 18/09/15 (11 years ago)Post link copied to clipboard Copy post linkThank 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. -
-
-
Posted on 00:26:20 - 22/09/15 (11 years ago)Post link copied to clipboard Copy post linkDoesn't display correctly if OC time is over 100 hours.
-
-
Posted on 01:46:28 - 22/09/15 (11 years ago)Post link copied to clipboard Copy post linkI'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) -
-
-
Posted on 03:31:19 - 14/10/15 (11 years ago)Post link copied to clipboard Copy post linkEdit: 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) -
-
-
Posted on 02:54:10 - 18/10/15 (11 years ago)Post link copied to clipboard Copy post linkit dosent seem to work for me, can you please post link for newest update. thanks
-
-
Posted on 03:11:39 - 18/10/15 (11 years ago)Post link copied to clipboard Copy post linkI 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?
-







![[BS] [BS]](https://factiontags.torn.com/9412-79697.png)