Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: 1 2 [3] 4 5 ... 8  All

Author Topic: Goko log parser - now for Chrome!  (Read 65792 times)

0 Members and 1 Guest are viewing this topic.

1wheel

  • Chancellor
  • ***
  • Offline Offline
  • Posts: 24
  • Respect: +86
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #50 on: February 16, 2013, 07:54:07 pm »
0

I converted my script into a Greasemonkey script (attached), showing the live log on the right of the game window. The result looks like this:

To use it you have to install Firefox with the Greasemonkey plugin and open the attached file with 'File'>'Open File...'

Will it also work on Chrome/Greasemonkey?

I'm not sure about how greasemonkey works on chrome, but I have the script running with chrome right now. Steps:

1. Open Goko_log_prettifier.user.js with a text editor
2. Select all the text and copy it to the clipboard
3. Start a new game on Goko.
4. Press ctrl-shift-j to open the chrome dev console.
5. Paste and press enter

The log might not appear till you've clicked a few cards.

If you'd like to have the logs appear the dev console (no highlighting, but you can undock the window by clicking the left most button on the bottom of the dev window), follow the same steps as before, but copy/paste this instead:
 
Code: [Select]
Dom.LogManager.prototype.old_addLog = Dom.LogManager.prototype.addLog;
Dom.LogManager.prototype.addLog = function (opt) {
    this.old_addLog(opt);
    console.log(opt.text);
};

Beyond Awesome

  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 2941
  • Shuffle iT Username: Beyond Awesome
  • Respect: +2466
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #51 on: February 16, 2013, 08:34:58 pm »
0

I converted my script into a Greasemonkey script (attached), showing the live log on the right of the game window. The result looks like this:

To use it you have to install Firefox with the Greasemonkey plugin and open the attached file with 'File'>'Open File...'

Will it also work on Chrome/Greasemonkey?

I'm not sure about how greasemonkey works on chrome, but I have the script running with chrome right now. Steps:

1. Open Goko_log_prettifier.user.js with a text editor
2. Select all the text and copy it to the clipboard
3. Start a new game on Goko.
4. Press ctrl-shift-j to open the chrome dev console.
5. Paste and press enter

The log might not appear till you've clicked a few cards.

If you'd like to have the logs appear the dev console (no highlighting, but you can undock the window by clicking the left most button on the bottom of the dev window), follow the same steps as before, but copy/paste this instead:
 
Code: [Select]
Dom.LogManager.prototype.old_addLog = Dom.LogManager.prototype.addLog;
Dom.LogManager.prototype.addLog = function (opt) {
    this.old_addLog(opt);
    console.log(opt.text);
};

Thanks! I got this to work in Chrome. This thing is great.
Logged

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7096
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9412
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #52 on: February 16, 2013, 09:21:41 pm »
+1

Got it working in FF after a few tweaks.  For my 1920x1080 monitor, I had to change:

position:absolute; overflow:auto; left:1020px;
var w = window.innerWidth - 960 - 80;

Perhaps that will help other playing at the same resolution.

Also: OMG THANK YOU THIS ROCKS SO HARD.
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7096
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9412
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #53 on: February 16, 2013, 09:38:05 pm »
0

In all seriousness, though, can this get a sticky?
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

Beyond Awesome

  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 2941
  • Shuffle iT Username: Beyond Awesome
  • Respect: +2466
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #54 on: February 16, 2013, 10:24:46 pm »
0

In all seriousness, though, can this get a sticky?

I agree this should be stickied. It should actually probably go in the first post as well so people can more easily get to the code. Anyway, this goes to show that if Goko won't do it, someone else will. The log is quite nice. It is great to have it out all the time while playing.
Logged

nutki

  • Scout
  • ****
  • Offline Offline
  • Posts: 40
  • Respect: +195
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #55 on: February 17, 2013, 08:53:08 am »
+3

Here is the github project I created:
https://github.com/nutki/Goko-Live-Log-Viewer

I know of some layout issues as for now I just reapply the layout each time a new log line is produced. So resizing the window is expected to break the layout until the next log event. As this is my first greasemonkey script, I don't know how to properly tap to the widow resize event (after original goko handler triggers). I tried to do that on a timer instead (the traces of this are in the source code), but also did not get the results I wanted.
Basically the layout adjustment code is currently:
Code: [Select]
document.getElementById("myCanvas").style.marginLeft="0px"; // move the main game window to the left;
var w = window.innerWidth - 960 - 10; // log window width is total window size minus 960 for goko viewport and 10 for padding
var t = (window.innerHeight - 640)/2; // 640 is goko window height
newLog.setAttribute("style", "position:absolute; overflow:auto; left:960px; width:"+w+"px; top:"+t+"px; height:640px; background-color: white; z-index: -1");

And I agree this should be probably now a separate thread. If somebody splits everything from my previous post, I can edit it then to make it more informative.
Logged
Want a better Goko experience?
Get Firefox, Grease monkey and my script.

qmech

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1918
  • Shuffle iT Username: qmech
  • What year is it?
  • Respect: +2320
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #56 on: February 17, 2013, 10:06:02 am »
0

You fixed Goko!  It's now just about playable.

I tried and failed to work out how to get the log to display somewhere permanently (never mind formatted).  Well done for figuring it out!
Logged

loppo

  • 2014 Austrian Champion
  • *
  • Offline Offline
  • Posts: 176
  • Respect: +194
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #57 on: February 17, 2013, 04:11:22 pm »
0

this sounds great. I tried to make it work in chrome, but i failed terribly. all i achieved was that goko stopped working. In the dev console there appeared a lot of red words. I admit that i have very little computing skills, so can anybody of you give an foolproof explanation of what to copy where.

Please
Logged

Polk5440

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1708
  • Respect: +1788
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #58 on: February 17, 2013, 05:14:11 pm »
0

Hmm, got it working on FF, but having layout issues like 1wheel.

Same here. For me, the log is partially covered up by the play area (the log needs to be moved to the right in order to line up, like the screenshot). Which parameters in the code should I adjust?

Edit: Kirian found the places to adjust this.
« Last Edit: February 17, 2013, 05:23:06 pm by Polk5440 »
Logged

Watno

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2745
  • Shuffle iT Username: Watno
  • Respect: +2983
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #59 on: February 17, 2013, 05:16:24 pm »
0

Great thing.

Would it be possible to relocate chat too?
Logged

Polk5440

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1708
  • Respect: +1788
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #60 on: February 17, 2013, 05:22:32 pm »
0

Got it working in FF after a few tweaks.  For my 1920x1080 monitor, I had to change:

position:absolute; overflow:auto; left:1020px;
var w = window.innerWidth - 960 - 80;

Perhaps that will help other playing at the same resolution.

Also: OMG THANK YOU THIS ROCKS SO HARD.

This works for me, too.
Logged

1wheel

  • Chancellor
  • ***
  • Offline Offline
  • Posts: 24
  • Respect: +86
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #61 on: February 17, 2013, 05:36:42 pm »
+1

nutki -
I sent a pull request with the layout changes and a working onresize call.

Watno-
Where do you think the chat should go?

loppo -
If you copy/paste the 4 line snippet I posted above and post a screen shot I might be able to help.

I was looking to see if the point tracker could be ported to goko and it turns out drheld already done most of the work several months ago:
http://imgur.com/5S7hkRs
https://github.com/drheld/goko_dominion_extension

I sent him a message asking if he wanted any help/if he was planning on putting it out anytime soon.

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7096
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9412
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #62 on: February 17, 2013, 05:39:35 pm »
0

Argh not the point tracker extension!!

Chat:  At my resolution, things would work best if everything were shifted upward about 80px, then chat was placed below.
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

Watno

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2745
  • Shuffle iT Username: Watno
  • Respect: +2983
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #63 on: February 17, 2013, 05:43:04 pm »
0

Ideally, it would be possible to customize where everything goes, but Kirian's suggestion is what I imagined too.
Logged

Beyond Awesome

  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 2941
  • Shuffle iT Username: Beyond Awesome
  • Respect: +2466
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #64 on: February 17, 2013, 05:44:38 pm »
0

Agreed. What Kirian said.
Logged

1wheel

  • Chancellor
  • ***
  • Offline Offline
  • Posts: 24
  • Respect: +86
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #65 on: February 17, 2013, 06:45:54 pm »
0

Argh not the point tracker extension!!

Chat:  At my resolution, things would work best if everything were shifted upward about 80px, then chat was placed below.

Oh I see. This is a little tricker than it should be since the chat box is implemented with canvas, but I'll look into later tonight.

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7096
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9412
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #66 on: February 17, 2013, 07:01:23 pm »
0

Ideally, it would be possible to customize where everything goes, but Kirian's suggestion is what I imagined too.

Well, it *is* possible to customize it... you just have to go in and change the code slightly.
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

nutki

  • Scout
  • ****
  • Offline Offline
  • Posts: 40
  • Respect: +195
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #67 on: February 18, 2013, 04:56:19 am »
+4

Thanks to 1wheel's input I realized that the Goko viewport frame is not constant size. On my small laptop screen is actually a bit smaller (960x640) than on other devices (1024x768). I modified my script to be independent of that:
https://github.com/nutki/Goko-Live-Log-Viewer/raw/master/Goko_Live_Log_Viewer.user.js

The chat window can be moved away in similar fashion, I believe. It can be a bit more complex as it also requires input. The added value would be standard editing options and copy and paste for free.
Logged
Want a better Goko experience?
Get Firefox, Grease monkey and my script.

loppo

  • 2014 Austrian Champion
  • *
  • Offline Offline
  • Posts: 176
  • Respect: +194
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #68 on: February 18, 2013, 08:27:22 am »
0

loppo -
If you copy/paste the 4 line snippet I posted above and post a screen shot I might be able to help.

Thank you for the offer. I fiddled around a little bit and found out that i forgot to press "Enter" after copy/paste. so no wonder it didn't do anything.

i feel real silly now.
Logged

Slyfox

  • Coppersmith
  • ****
  • Offline Offline
  • Posts: 47
  • Respect: +78
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #69 on: February 18, 2013, 02:09:01 pm »
0

This is really, really nice.  I would agree that this goes a long way to make Goko more playable.

I was considering adding a few lines to the script to also colorize "shuffles deck" as it would be nice to be able to quickly skim the log for that.  Would anyone else find that useful?  If so, any preference on how to highlight it?  Maybe some sort of inverse color scheme like what is used for victory point chips?  Or simply putting it in bold?
Logged

^_^_^_^

  • Minion
  • *****
  • Offline Offline
  • Posts: 502
  • Crazy, You Have Been Warned
  • Respect: +111
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #70 on: February 18, 2013, 05:28:57 pm »
0

Please don't.
Logged
"Chicken Chicken Chicken"-Doug Z
"Chicken Chicken Chicken"-Donald X
The cost to buy me is 5Copper. What's Your Cost?

Beyond Awesome

  • Global Moderator
  • *****
  • Offline Offline
  • Posts: 2941
  • Shuffle iT Username: Beyond Awesome
  • Respect: +2466
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #71 on: February 18, 2013, 08:40:07 pm »
0

I'm not the best at this script stuff. Is there some way I can put in the script so I don't have to add it in each time I log into Goko?
Logged

bedlam

  • Bishop
  • ****
  • Offline Offline
  • Posts: 124
  • Respect: +72
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #72 on: February 18, 2013, 09:31:38 pm »
0

Is this something that someone with no programming experience should avoid messing around with? I can't seem to make heads or tails of any of this...Or can someone give me an step-by-step way to put this into Chrome? Specifically I can't figure how to paste the code after I pres ctrl-shift-j in a goko game.
« Last Edit: February 18, 2013, 09:36:49 pm by bedlam »
Logged

rrenaud

  • Administrator
  • *****
  • Offline Offline
  • Posts: 991
  • Uncivilized Barbarian of Statistics
  • Respect: +1197
    • View Profile
    • CouncilRoom
Re: Goko log parser - v1.5 DONE
« Reply #73 on: February 18, 2013, 09:43:08 pm »
+1

If some programmer wants to make this easy on others, you can distribute it via the Chrome Web Store (for free).  Then installing it becomes super easy.
Logged

Watno

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2745
  • Shuffle iT Username: Watno
  • Respect: +2983
    • View Profile
Re: Goko log parser - v1.5 DONE
« Reply #74 on: February 19, 2013, 07:46:19 am »
0

Since the last goko update the main game screen stays in the middle of my screen, with the log on its right being cut off. Before the upfate the main screen would move to the left. Does anyone else have this problem / know how to fix it?
Logged
Pages: 1 2 [3] 4 5 ... 8  All
 

Page created in 0.052 seconds with 21 queries.