Welcome Guest ( Log In | Register )

291 Pages V « < 160 161 162 163 164 > »   
Reply to this topicStart new topic
> HV Script Thread, Discuss your creations. Includes guidelines and infos for script creation (2020-02-28 upd)

 
post Aug 29 2016, 15:51
Post #3221
DamienCash



Former Delinquent, 1H Cold Arcanist!
***
Group: Gold Star Club
Posts: 241
Joined: 14-October 13
Level 385 (Godslayer)


QUOTE(redphil @ Aug 29 2016, 08:18) *

Well, that didn't go anywhere.

How about a bounty to develop a script that will show total tokens used on each monster page, and total tokens for all monster pages on the monster summary page?

2m credits or 320 Hath?
Theoretically, each filled Chaos level is represented by the following HTML:
CODE
<div style="float:left; width:8px; height:15px; background:url(/y/monster/upg2.png) no-repeat"> </div>

A clumsy way of calculating Chaos Tokens would be to count the number of "upg2.png"s per table row and applying any necessary calculations. I am somewhat capable of scripting, but I am sure someone else can make a more efficient script more easily.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 29 2016, 16:35
Post #3222
DamienCash



Former Delinquent, 1H Cold Arcanist!
***
Group: Gold Star Club
Posts: 241
Joined: 14-October 13
Level 385 (Godslayer)


QUOTE(redphil @ Aug 29 2016, 08:18) *

Well, that didn't go anywhere.

How about a bounty to develop a script that will show total tokens used on each monster page, and total tokens for all monster pages on the monster summary page?

2m credits or 320 Hath?
CODE
var chaosRows = document.getElementById("chaos_pane").getElementsByTagName("tr");
var chaosTotal = 0;

for (var i = 0; i < chaosRows.length; i++) {
    var chaosCount = chaosRows[i].innerHTML.split(/upg2.png/).length - 1;
    var chaosIncrement = 0;

    while (chaosCount > 0) {
        chaosIncrement++
        chaosTotal += chaosIncrement;
        chaosCount--;
    }
}

var button = document.createElement("input");
button.id = "chaosText";
button.readOnly = true;
button.type = "text";
button.value = chaosTotal + " Chaos Tokens";
document.getElementById("feed_pane").appendChild(button);
Done, at least the first half.
EDIT: Unnecessary button is unnecessary.
EDIT 2: Still working on getting all the Chaos Token total of all monsters. First time working with localStorage and DOM manipulation, but I believe I am making headway.

This post has been edited by DamienCash: Aug 30 2016, 02:16
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 30 2016, 03:54
Post #3223
RoadShoe



Press any key to continue... Where's the any key?
********
Group: Catgirl Camarilla
Posts: 3,241
Joined: 9-August 15
Level 500 (Godslayer)


QUOTE(DamienCash @ Aug 29 2016, 16:35) *

CODE
var chaosRows = document.getElementById("chaos_pane").getElementsByTagName("tr");
var chaosTotal = 0;

for (var i = 0; i < chaosRows.length; i++) {
    var chaosCount = chaosRows[i].innerHTML.split(/upg2.png/).length - 1;
    var chaosIncrement = 0;

    while (chaosCount > 0) {
        chaosIncrement++
        chaosTotal += chaosIncrement;
        chaosCount--;
    }
}

var button = document.createElement("input");
button.id = "chaosText";
button.readOnly = true;
button.type = "text";
button.value = chaosTotal + " Chaos Tokens";
document.getElementById("feed_pane").appendChild(button);
Done, at least the first half.
EDIT: Unnecessary button is unnecessary.
EDIT 2: Still working on getting all the Chaos Token total of all monsters. First time working with localStorage and DOM manipulation, but I believe I am making headway.


Outstanding! Yes!!

Let me know up front if you're going to be wanting the Hath or credits. If Hath, I need to let it grow for 3 days or so. (IMG:[invalid] style_emoticons/default/smile.gif)

Edit: Of course I could just buy the Hath.. duh.. Sometimes I don't think. (IMG:[invalid] style_emoticons/default/rolleyes.gif)

Let me know, and great work so far!! (IMG:[invalid] style_emoticons/default/smile.gif)

This post has been edited by redphil: Aug 30 2016, 04:03
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 30 2016, 17:27
Post #3224
DamienCash



Former Delinquent, 1H Cold Arcanist!
***
Group: Gold Star Club
Posts: 241
Joined: 14-October 13
Level 385 (Godslayer)


HV Chaos Calculator 1.1
See here.

This post has been edited by DamienCash: Aug 30 2016, 19:23
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 30 2016, 18:06
Post #3225
Sapo84



Deus lo vult
********
Group: Gold Star Club
Posts: 3,332
Joined: 14-June 09
Level 500 (Ponyslayer)


QUOTE(DamienCash @ Aug 30 2016, 17:27) *

HV Chaos Calculator 1.0
[attachmentid=91047]
Adds two textboxes to a monster's page to see just how many Chaos Tokens you fed to your favorite monsters. Powered by your browser's local storage.

Note: First-time users will need to visit each monster's page individually to run the calculator. From then on, the calculator will automatically update whenever you upgrade an existing monster.


Just took a look at the code.
Couple of suggestions:
  • Don't use toString() before local storage and split after reading, the correct way to store object is JSON.stringify(*yourObject*) before saving and JSON.parse(*theStringYouGetFromLocalstorage*) for getting the array. In this way you don't even need the parseInt part.
  • I would execute line 66 and 67 only if the chaosTotal is different than the previously stored one
  • Line 91 should be outside of the for inner for but inside of the if.
  • It's better to make the // @match more specific, I think it should run it only on monster lab, not everywhere (otherwise if you don't have reloader it could even slow down combat)


This post has been edited by Sapo84: Aug 30 2016, 18:06
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 30 2016, 18:36
Post #3226
DamienCash



Former Delinquent, 1H Cold Arcanist!
***
Group: Gold Star Club
Posts: 241
Joined: 14-October 13
Level 385 (Godslayer)


QUOTE(Sapo84 @ Aug 30 2016, 12:06) *

Just took a look at the code.
Couple of suggestions:
  • Don't use toString() before local storage and split after reading, the correct way to store object is JSON.stringify(*yourObject*) before saving and JSON.parse(*theStringYouGetFromLocalstorage*) for getting the array. In this way you don't even need the parseInt part.
  • I would execute line 66 and 67 only if the chaosTotal is different than the previously stored one
  • Line 91 should be outside of the for inner for but inside of the if.
  • It's better to make the // @match more specific, I think it should run it only on monster lab, not everywhere (otherwise if you don't have reloader it could even slow down combat)
Righto, I will get on that within two Dawns. I figured I would need to make at least some performance changes. Thanks for the feedback.

EDIT: I surprisingly managed to not break anything, or at least it still works on my end. New build coming up soon.

This post has been edited by DamienCash: Aug 30 2016, 19:07
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 30 2016, 19:18
Post #3227
DamienCash



Former Delinquent, 1H Cold Arcanist!
***
Group: Gold Star Club
Posts: 241
Joined: 14-October 13
Level 385 (Godslayer)


HV Chaos Calculator 2.0
See here.

This post has been edited by DamienCash: Aug 31 2016, 18:59
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 31 2016, 03:19
Post #3228
RoadShoe



Press any key to continue... Where's the any key?
********
Group: Catgirl Camarilla
Posts: 3,241
Joined: 9-August 15
Level 500 (Godslayer)


QUOTE(DamienCash @ Aug 30 2016, 19:18) *

HV Chaos Calculator 1.1

Adds two textboxes to a monster's page to see just how many Chaos Tokens you fed to your favorite monsters. Powered by your browser's local storage.

Note: First-time users will need to visit each monster's page individually to run the calculator. From then on, the calculator will automatically update whenever you upgrade an existing monster.

Changelog 1.1:
- Logic changes to run only when needed
- Matched exclusively to monster pages
- Use JSON during local storage

Special thanks to Sapo84 for code review.



It works like a charm, and is exactly what I was looking for!

Thank you!

The bounty of 320 Hath has been sent via mm.

YES!!!! Thanks DamienCash!!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 31 2016, 03:25
Post #3229
RoadShoe



Press any key to continue... Where's the any key?
********
Group: Catgirl Camarilla
Posts: 3,241
Joined: 9-August 15
Level 500 (Godslayer)


QUOTE(Sapo84 @ Aug 30 2016, 18:06) *

Just took a look at the code.
Couple of suggestions:
  • Don't use toString() before local storage and split after reading, the correct way to store object is JSON.stringify(*yourObject*) before saving and JSON.parse(*theStringYouGetFromLocalstorage*) for getting the array. In this way you don't even need the parseInt part.
  • I would execute line 66 and 67 only if the chaosTotal is different than the previously stored one
  • Line 91 should be outside of the for inner for but inside of the if.
  • It's better to make the // @match more specific, I think it should run it only on monster lab, not everywhere (otherwise if you don't have reloader it could even slow down combat)


I'm not suppose to make two consecutive posts, but I missed this Sapo84's post in my excitement. (IMG:[invalid] style_emoticons/default/biggrin.gif)

Thanks Sapo84 for the enhancements!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 31 2016, 18:47
Post #3230
DamienCash



Former Delinquent, 1H Cold Arcanist!
***
Group: Gold Star Club
Posts: 241
Joined: 14-October 13
Level 385 (Godslayer)


HV Chaos Calculator 3.0
See here.

This post has been edited by DamienCash: Sep 27 2016, 13:16
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Sep 27 2016, 13:15
Post #3231
DamienCash



Former Delinquent, 1H Cold Arcanist!
***
Group: Gold Star Club
Posts: 241
Joined: 14-October 13
Level 385 (Godslayer)


HV Chaos Calculator 3.0
- It does Crystals now too

Attached File  HV_Chaos_Calculator.user3.0.zip ( 2.9k ) Number of downloads: 61

Adds an interface to the Monster Lab and two textboxes to a specific monster's page to see just how many Chaos Tokens you fed to your favorite monsters. Powered by your browser's local storage.

NEW: Hovering over an upgrade will add that upgrade's current total to the normal upgrade text.

Note: First-time users can use the new button in the Monster Lab to initialize the calculator. From then on, the calculator will automatically update whenever you upgrade an existing monster.

Screenshots:
Attached ImageAttached Image
Changelog 3.0:
- Added total upgrade cost to existing upgrade mouseovers
- Improved logic
- Removed redundant calculations

Special thanks to Sapo84 for code review.

Author's Note:
Finished the some changes I have been chipping away at. Current thinking is that, while I am digging around in the HTML anyway, I may as well provide information on Crystals too. This script does not seem to be used too too much, but I have soft plans to compile all the new information in a new tab with the press of a button. That way I can give a estimated Credits-value of monsters too. Let me know what you think.

This post has been edited by DamienCash: Sep 27 2016, 13:24
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Sep 29 2016, 10:27
Post #3232
edu5ardo



Casual Poster
***
Group: Members
Posts: 153
Joined: 6-October 11
Level 483 (Godslayer)


can it compatible HVStat 5.6.8.2 with reloader?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Sep 30 2016, 03:40
Post #3233
Simpleton8



Casual Poster
****
Group: Members
Posts: 336
Joined: 2-November 15
Level 264 (Godslayer)


I am having trouble making API requests for tag flagging. I pasted Blue Penguin's code ([github.com] https://github.com/neptunepenguin/eh_script...ry-size.user.js) into the E-hentai Highlighter ([sleazyfork.org] https://sleazyfork.org/en/scripts/1605-e-hentai-highlighter). Issue is probably related to XMLHttpRequest.

Relevant code:

CODE
      
var EHH = { //javascript class with a lot of functions.
...
send_req: function (gdata, elems, aurl) {
          var req = new XMLHttpRequest();
          req.onreadystatechange = (function() {
            if (4 === req.readyState) {
              if (200 !== req.status) {
                console.error('gallery-size: cannot send request to ' + aurl);
              } else {
                  console.error('ready');
                var apirsp = JSON.parse(req.responseText);
                elems.forEach(function(e,i,arr) {
                    EHH.addfcount(e,apirsp.gmetadata[i]); });
              }
            }
              else
                  {
                      console.error('failed?????');
                      console.error(req.responseText);
                  }
          });
          req.open("POST", "http://g.e-hentai.org/api.php", true);
          console.error("sending"+JSON.stringify(gdata));
          req.send(JSON.stringify(gdata));
        }
}
EHH.init();

console printed out: failed????? and null for responseText. gdata is fine e.g., {"method":"gdata","gidlist":[["981364","2a53419339"],["981352","e16c5f03bc"],["981351","3972fb6aee"],["981344","5920ff3910"],["981334","8e0e3ded42"],["979195","847140ad9e"],["981336","006be96961"],["981333","510e8280ba"],["981330","82ee024bfc"],["981332","8297f28408"],["981329","56d758d303"],["981310","70491e92b4"],["981315","edc11e8814"],["981222","d24963efbb"],["981156","ba753f38aa"],["981343","1c87fc54aa"],["981326","949548045e"],["981324","c076d69c37"],["903797","b67b92fef2"],["902323","a3ff0ffea1"]]}


Full code ([pastebin.com] http://pastebin.com/YmzsqxRF). It's ugly, but I just want to get it to work with minimum effort.

This post has been edited by Simpleton8: Sep 30 2016, 03:41
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Sep 30 2016, 04:01
Post #3234
blue penguin



in umbra, igitur, pugnabimus
***********
Group: Gold Star Club
Posts: 10,046
Joined: 24-March 12
Level 500 (Godslayer)


^ that may as well have worked, you just printed too much stuff.

CODE
4 == req.readyState
Is not the only state the request will be in. It will start at 0, get to 1 when it is sent. 2 waiting for answer, 3 something was sent back, 4 everything was received.

You can't put a plain else there indicating error, since 1 == req.readyState isn't an error. For fun (and learning) you can print req.readyState in the else.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Sep 30 2016, 04:09
Post #3235
Superlatanium



Dreaming of optimizing the system
**********
Group: Gold Star Club
Posts: 7,575
Joined: 27-November 13
Level 500 (Godslayer)


QUOTE(Simpleton8 @ Sep 30 2016, 01:40) *
Full code ([pastebin.com] http://pastebin.com/YmzsqxRF). It's ugly, but I just want to get it to work with minimum effort.
Also, line 657
CODE
        var filtered = document.
        ClassName('e-Filtered').length;
        document.getElementById('e-FilteredItems').textContent = filtered;
Looks like it was supposed to be getElementsByClassName there
User is online!Profile CardPM
Go to the top of the page
+Quote Post

 
post Sep 30 2016, 04:10
Post #3236
Simpleton8



Casual Poster
****
Group: Members
Posts: 336
Joined: 2-November 15
Level 264 (Godslayer)


QUOTE(blue penguin @ Sep 30 2016, 04:01) *

^ that may as well have worked, you just printed too much stuff.

CODE
4 == req.readyState
Is not the only state the request will be in. It will start at 0, get to 1 when it is sent. 2 waiting for answer, 3 something was sent back, 4 everything was received.

You can't put a plain else there indicating error, since 1 == req.readyState isn't an error. For fun (and learning) you can print req.readyState in the else.


Look like my problem is that I'm not getting anything back? Ready is never printed (when 4 === req.readyState & 200 === req.status).

Highlighter works again (i.e., highlighting by colors & filtering galleries) when I comment out: req.send(JSON.stringify(gdata));

QUOTE(Superlatanium @ Sep 30 2016, 04:09) *

Also, line 657
CODE
        var filtered = document.
        ClassName('e-Filtered').length;
        document.getElementById('e-FilteredItems').textContent = filtered;
Looks like it was supposed to be getElementsByClassName there


Cool. Don't think that's my issue though, so I will probably look into this after I get Tag Flagging w/ API to work in general.

This post has been edited by Simpleton8: Sep 30 2016, 04:28
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Sep 30 2016, 12:53
Post #3237
Simpleton8



Casual Poster
****
Group: Members
Posts: 336
Joined: 2-November 15
Level 264 (Godslayer)


The issue is that the url "https://e-hentai.org/api.php" is not in https but fjord is. Error from console is:

CODE
Blocked loading mixed active content “http://g.e-hentai.org/api.php”


[developer.mozilla.org] https://developer.mozilla.org/en-US/docs/We...h_mixed_content

"For other domains, use the site's HTTPS version if available. If HTTPS is not available, you can try contacting the domain and asking them if they can make the content available via HTTPS."

Pming Tenboro to ask if he can make the api available in HTTPs.

This post has been edited by Simpleton8: Sep 30 2016, 16:24
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Sep 30 2016, 13:03
Post #3238
Superlatanium



Dreaming of optimizing the system
**********
Group: Gold Star Club
Posts: 7,575
Joined: 27-November 13
Level 500 (Godslayer)


Seems like HTTPS is forced on one site, and impossible to use from g.e-hentai. That is very peculiar, anyone know why? (regardless, the source images over H@H aren't secure, obviously)

I use the API regularly, but always from http. I guess that's not an optimal solution for you though since you don't have a star
User is online!Profile CardPM
Go to the top of the page
+Quote Post

 
post Sep 30 2016, 13:12
Post #3239
Simpleton8



Casual Poster
****
Group: Members
Posts: 336
Joined: 2-November 15
Level 264 (Godslayer)


QUOTE(Superlatanium @ Sep 30 2016, 13:03) *

I use the API regularly, but always from http. I guess that's not an optimal solution for you though since you don't have a star


Do you just need a bronze star? What does that do for using the API?

Chrome/firefox can allow mixed content but "the HTTP portion can be read or modified by attackers, even though the main page is served over HTTPS."
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Sep 30 2016, 13:32
Post #3240
Superlatanium



Dreaming of optimizing the system
**********
Group: Gold Star Club
Posts: 7,575
Joined: 27-November 13
Level 500 (Godslayer)


QUOTE(Simpleton8 @ Sep 30 2016, 11:12) *
Do you just need a bronze star? What does that do for using the API?
A star means I can always use https://e-hentai.org/ (and therefore connect to the API due to using http).
QUOTE(Simpleton8 @ Sep 30 2016, 11:12) *
Chrome/firefox can allow mixed content but "the HTTP portion can be read or modified by attackers, even though the main page is served over HTTPS."
Yeah, browsers likely won't allow you to do active requests over HTTP if the page is HTTPS (such as Post to API), but passive requests are OK (including images, source files).
User is online!Profile CardPM
Go to the top of the page
+Quote Post


291 Pages V « < 160 161 162 163 164 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 20th January 2025 - 10:29