NATION

PASSWORD

NSBreeze | Keyboard Shortcuts Extension (Chrome)

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
Shizensky
Diplomat
 
Posts: 602
Founded: Mar 29, 2004
New York Times Democracy

NSBreeze | Keyboard Shortcuts Extension (Chrome)

Postby Shizensky » Wed Feb 11, 2015 3:34 pm

*Extension in development and currently only available on the Chrome Store.

NSBreeze on the Chrome Web Store

NSBreeze adds keyboard shortcuts to nationstates.net.

d - Visit the nation page for the current region's delegate.

f - Visit the nation page for the current region's founder.

m - Move to the current region being viewed.

e - Endorse the nation currently being viewed.

r - Visit your home region's page.

n - Visit your nation's home page.



NSBreeze is currently in very early stages of development. I've only got a few keys mapped to add functionality. There's a bit of cleaning up to do, but everything seems to work as expected. I'm happy to hear suggestions for other shortcuts, but I can't promise that any of them will be implemented due to RL responsibilities. Please use this thread to report any bugs, comments, or suggestions for improvement.

Based on my understanding of NS script rules, this extension should be completely legal as it has been designed to strictly adhere to the "one action per click" rule. This extension simply replaces the need to move the mouse with a keystroke.


Version 0.5.1.2 Source Code:
Code: Select all
 $(document).ready(function () {

 
      $(window).keypress(function (e) {
         if($("input,textarea").is(":focus")){
            return;
         }      
         else{
           if(e.keyCode == 101){
              $('.unbox').children('form').submit(); 
           }
           else if(e.keyCode == 109){
              $('.button[name=move_region]').trigger('click');
           }
           else if(e.keyCode == 100){
              $('#content').children('p:nth-child(2)').children('a.nlink:first')[0].click();
           }
           else if(e.keyCode == 102){
              $('#content').children('p:nth-child(3)').children('a.nlink')[0].click();
           }
           else if(e.keyCode == 110){
            if ($('#paneltitle').length > 0){
               // using Rift
               $('#paneltitle').children('a')[0].click();
            }
            else{
               // Default theme
               $('#banner').children('a')[0].click();
            }
           }
          
           else if (e.keyCode == 114){
            if ($('#paneltitle').length > 0){
               // using Rift
                $('#panel').children('.panelcontent').children('.menu').children('li').children('a')[0].click();
            }
            else{
               // Default theme
               $('#panel').children('ul').children('li').children('a')[1].click();
            }
         
           }
         }
      });

});


I'll add more comments in the next update so less technically inclined individuals can better understand what's going on.
Last edited by Shizensky on Fri Feb 13, 2015 10:19 am, edited 5 times in total.
"Look, that's why there's rules, understand?
So that you think before you break 'em."
My favorite thing about UDP jokes
is I don't care if you get them or not.

User avatar
The Church of Satan
Minister
 
Posts: 2193
Founded: Apr 15, 2013
Ex-Nation

Postby The Church of Satan » Wed Feb 11, 2015 4:30 pm

So far so good! Good work Shiz, love NSBreeze!

Suggestion: A shortcut that goes to the region your nation is in. You know, kind of like a shortcut "home."
Last edited by The Church of Satan on Wed Feb 11, 2015 4:42 pm, edited 1 time in total.
The Rejected Realms: Former Delegate | Former Vice Delegate | Longest Consecutively Serving Officer in TRR History - 824 Days
Free the WA gnomes!

Chanku: This isn't an election it's an assault on the eyes. | Ikania: Hear! The Gospel of... Satan. Erh...
Yuno: Not gonna yell, but CoS is one of the best delegates ever | Ever-Wandering Souls: In the liberal justice system, raiding-based offenses are considered especially heinous. In The South Pacific, the dedicated defenders who investigate these vicious felonies are members of an elite squad known as the Council on Regional Security. These are their proscriptions. DUN DUN.

User avatar
Ever-Wandering Souls
Negotiator
 
Posts: 7267
Founded: Jan 01, 2014
Father Knows Best State

Postby Ever-Wandering Souls » Wed Feb 11, 2015 5:46 pm

:twisted: "...man, that'll make things so much faster and easier!"

:ugeek: "...You can't do that, that's too easy. Takes the fun, the human element out. Why not bind every step of the raid to a key and do it in two seconds flat by hitting qwertyuiop? Same reason you use manual triggers, not sheets!"
Proud Raider; General of The Black Hawks, Ret.
TG me anytime; I'm always happy to talk about anything!

The Alicorns (Equestria) wrote:Let them stay, no need to badmouth them...From our view a bunch of nations just came in, seized the delegate position, and changed a few superficial things...we play NationStates differently...there's really no reason for us to be butthurt.
http://www.nationstates.net/page=rmb/postid=8944227
http://www.nationstates.net/page=rmb/postid=8951258

Misley wrote:
Hobbesistan wrote:Don't think I understand the question.
The color or what?..

Jesus, Hobbes, it's 2015. You can't just call someone "the color".

Reploid Productions wrote:Raiders are endlessly creative

How Do I Telegram API?

Omnis delenda est.

User avatar
Shizensky
Diplomat
 
Posts: 602
Founded: Mar 29, 2004
New York Times Democracy

Postby Shizensky » Wed Feb 11, 2015 6:38 pm

:P

I thought of the R/D implications after publishing and realized this will likely help defenders more than raiders. Raiders have the advantage of knowing their target ahead of time, and often only need a single click to be done. If they need to endorse anybody, it probably won't be the current delegate. This might make defending easier as it removes the need to scroll and find the move button, click a delegate link, then scroll and find an endorse button, all of which can waste precious seconds in the current R/D landscape. With this tool, interested parties simply type 'm, d, e' between page loads.

I'm sure people will dislike it for further removing the human element, but it's not 2006 anymore and we have tools to make life easier. I'm not going to turn a screw by hand if a power tool allows me to get the job done in 1/10 of the time.
"Look, that's why there's rules, understand?
So that you think before you break 'em."
My favorite thing about UDP jokes
is I don't care if you get them or not.

User avatar
Ever-Wandering Souls
Negotiator
 
Posts: 7267
Founded: Jan 01, 2014
Father Knows Best State

Postby Ever-Wandering Souls » Wed Feb 11, 2015 7:28 pm

but....sometimes the power tool either strips the screw, or cracks the wood :P Best to do things by hand in some cases....
Proud Raider; General of The Black Hawks, Ret.
TG me anytime; I'm always happy to talk about anything!

The Alicorns (Equestria) wrote:Let them stay, no need to badmouth them...From our view a bunch of nations just came in, seized the delegate position, and changed a few superficial things...we play NationStates differently...there's really no reason for us to be butthurt.
http://www.nationstates.net/page=rmb/postid=8944227
http://www.nationstates.net/page=rmb/postid=8951258

Misley wrote:
Hobbesistan wrote:Don't think I understand the question.
The color or what?..

Jesus, Hobbes, it's 2015. You can't just call someone "the color".

Reploid Productions wrote:Raiders are endlessly creative

How Do I Telegram API?

Omnis delenda est.

User avatar
Shizensky
Diplomat
 
Posts: 602
Founded: Mar 29, 2004
New York Times Democracy

Postby Shizensky » Thu Feb 12, 2015 9:35 am

The Church of Satan wrote:So far so good! Good work Shiz, love NSBreeze!

Suggestion: A shortcut that goes to the region your nation is in. You know, kind of like a shortcut "home."


Done! Also added shortcut back to your own nation's home page.

r - Visit your home region's page.

n - Visit your nation's home page.
"Look, that's why there's rules, understand?
So that you think before you break 'em."
My favorite thing about UDP jokes
is I don't care if you get them or not.

User avatar
New Kvenland
Minister
 
Posts: 2068
Founded: Jul 07, 2014
Left-wing Utopia

Postby New Kvenland » Thu Feb 12, 2015 10:08 am

So far, I like it :)

I assume the shortcuts not working forumside is intentional?
californian ultranationalist | the bear flag will fly from cabo to the great salt lake once again | the pretenders in arizona will crumble to the sand they tread on

User avatar
Shizensky
Diplomat
 
Posts: 602
Founded: Mar 29, 2004
New York Times Democracy

Postby Shizensky » Thu Feb 12, 2015 10:27 am

Things are set up a little differently between NS and the forums. I could add a fix sometime today to get n and r to work from the forums, too.
"Look, that's why there's rules, understand?
So that you think before you break 'em."
My favorite thing about UDP jokes
is I don't care if you get them or not.

User avatar
Nullarni
Ambassador
 
Posts: 1348
Founded: Sep 26, 2006
Ex-Nation

Postby Nullarni » Thu Feb 12, 2015 4:46 pm

I know you are only in development, but I added you to my cutesy"Useful Sites and Utilities" dispatch. Let me know if you think it is too early in development for me to include it.
Proud founder of the NEW WARSAW PACT. Visitors welcome.

User avatar
Shizensky
Diplomat
 
Posts: 602
Founded: Mar 29, 2004
New York Times Democracy

Postby Shizensky » Fri Feb 13, 2015 8:54 am

That's fine. There is still room to make improvements beyond simply getting it to work, but I try to make sure I'm not going to break anything before I release updates.

Thanks for the inclusion. :)
"Look, that's why there's rules, understand?
So that you think before you break 'em."
My favorite thing about UDP jokes
is I don't care if you get them or not.

User avatar
Tim Stark
Chargé d'Affaires
 
Posts: 379
Founded: Jun 15, 2012
Inoffensive Centrist Democracy

Postby Tim Stark » Fri Feb 13, 2015 9:52 am

Any chance this is Open Source, or we can know what exactly it collects? I trust you far more than Afforess, but NS extensions always make me a little bit wary :P

Looks great, though, will have to try it out.
Want to be a hero? Join The Grey Wardens - Help Us Save Nationstates
( ͡° ͜ʖ ͡°) Commended by Security Council Resolution #420 ( ͡° ͜ʖ ͡°)

Author of SC#74, SC #203, SC #222, and SC #238 | Co-Author of SC#191
Steward of The Frontier | Founder of Spiritus | Three-Time Delegate of Osiris | Pharaoh of the Islamic Republics of Iran | Hero of Greece
<Koth - 06/30/2020> I mean as far as GPers go, Tim is one of the most iconic

User avatar
Shizensky
Diplomat
 
Posts: 602
Founded: Mar 29, 2004
New York Times Democracy

Postby Shizensky » Fri Feb 13, 2015 10:16 am

I'll paste the current version to a spoiler in the OP. You can always check on your own for the current version of any extension you install. On Windows, you can go to:

C:\Users\[your profile]\AppData\Local\Google\Chrome\User Data\Default\Extensions\hodpmjjbaiacgdjlgebeapapfojemlgo

From there, open the folder with the highest version number to see what you're currently using. Right now we're on 0.5.1.2. I don't have any other OS nearby to find the extension's location, sorry.

For anybody who doesn't know how to read code, I can say that I'm not doing anything to collect any data. I'm looking for certain keys to be pressed, then simulating a click on a specific link for the appropriate key. There are certainly more efficient ways to do this, but right now I'm in a "Proof of concept/Get it done" phase. No data is being stored on either your local machine or a remote server, and I have no plans to change that in the future.
Last edited by Shizensky on Fri Feb 13, 2015 1:05 pm, edited 1 time in total.
"Look, that's why there's rules, understand?
So that you think before you break 'em."
My favorite thing about UDP jokes
is I don't care if you get them or not.

User avatar
Tim Stark
Chargé d'Affaires
 
Posts: 379
Founded: Jun 15, 2012
Inoffensive Centrist Democracy

Postby Tim Stark » Fri Feb 13, 2015 11:59 am

Awesome! Thanks Shiz :)
Want to be a hero? Join The Grey Wardens - Help Us Save Nationstates
( ͡° ͜ʖ ͡°) Commended by Security Council Resolution #420 ( ͡° ͜ʖ ͡°)

Author of SC#74, SC #203, SC #222, and SC #238 | Co-Author of SC#191
Steward of The Frontier | Founder of Spiritus | Three-Time Delegate of Osiris | Pharaoh of the Islamic Republics of Iran | Hero of Greece
<Koth - 06/30/2020> I mean as far as GPers go, Tim is one of the most iconic

User avatar
Ever-Wandering Souls
Negotiator
 
Posts: 7267
Founded: Jan 01, 2014
Father Knows Best State

Postby Ever-Wandering Souls » Fri Feb 13, 2015 3:30 pm

So, as an uneducated question....

If you're on a region, and boom, you start typing in the RMB....you'll set off these keys, right? So yo'd have to disable the extension to do any typing gameside?
Proud Raider; General of The Black Hawks, Ret.
TG me anytime; I'm always happy to talk about anything!

The Alicorns (Equestria) wrote:Let them stay, no need to badmouth them...From our view a bunch of nations just came in, seized the delegate position, and changed a few superficial things...we play NationStates differently...there's really no reason for us to be butthurt.
http://www.nationstates.net/page=rmb/postid=8944227
http://www.nationstates.net/page=rmb/postid=8951258

Misley wrote:
Hobbesistan wrote:Don't think I understand the question.
The color or what?..

Jesus, Hobbes, it's 2015. You can't just call someone "the color".

Reploid Productions wrote:Raiders are endlessly creative

How Do I Telegram API?

Omnis delenda est.

User avatar
Shizensky
Diplomat
 
Posts: 602
Founded: Mar 29, 2004
New York Times Democracy

Postby Shizensky » Fri Feb 13, 2015 3:35 pm

Code: Select all
...
        if($("input,textarea").is(":focus")){
            return;
         }     
         else{
...


That's precisely what this part checks for. If you've clicked in a text area (:focus), the rest of the script is ignored.
"Look, that's why there's rules, understand?
So that you think before you break 'em."
My favorite thing about UDP jokes
is I don't care if you get them or not.

User avatar
Ever-Wandering Souls
Negotiator
 
Posts: 7267
Founded: Jan 01, 2014
Father Knows Best State

Postby Ever-Wandering Souls » Fri Feb 13, 2015 3:37 pm

Hm. Nice. :clap:
Proud Raider; General of The Black Hawks, Ret.
TG me anytime; I'm always happy to talk about anything!

The Alicorns (Equestria) wrote:Let them stay, no need to badmouth them...From our view a bunch of nations just came in, seized the delegate position, and changed a few superficial things...we play NationStates differently...there's really no reason for us to be butthurt.
http://www.nationstates.net/page=rmb/postid=8944227
http://www.nationstates.net/page=rmb/postid=8951258

Misley wrote:
Hobbesistan wrote:Don't think I understand the question.
The color or what?..

Jesus, Hobbes, it's 2015. You can't just call someone "the color".

Reploid Productions wrote:Raiders are endlessly creative

How Do I Telegram API?

Omnis delenda est.

User avatar
Dominionaire
Political Columnist
 
Posts: 3
Founded: Jan 18, 2011
Father Knows Best State

Postby Dominionaire » Tue Jun 02, 2015 5:39 pm

Could it be possible to add shortcuts for bold text, italics, underlined text, and so forth on regional RMBs and telegrams? That would be really useful. Just a suggestion :)

User avatar
Hobbesistan
Minister
 
Posts: 2448
Founded: Jul 01, 2013
Ex-Nation

Postby Hobbesistan » Wed Jun 03, 2015 1:31 am

Dominionaire wrote:Could it be possible to add shortcuts for bold text, italics, underlined text, and so forth on regional RMBs and telegrams? That would be really useful. Just a suggestion :)

I do believe this was designed more for Gameplay than general use.
Hobbes
ra, ra rasputin

(Ret.) Maintainer of the Nationstates FAQ and Deletiger (Ret.) of The East Pacific
russia's greatest

Hobbes is always winning, like Charlie Sheen. - Jurisdictions
love machine

Stop right there (hobbes), your rational thought and intellect will destroy the internet. - Sovreignry
it was a shame how

Giraffes think Hobbes regret a lot. A lot of giraffes do. - Rachel
he carried on.


Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Aunland and Rurania, Cybus1, Erosodom, Haku, Hiybkk, JILKAT, North American Imperial State, Patriums, Peoples Guerilla Armed Coalition, Planetary Soviet Socialist Republics, Tomkmenistan, Turateria, TyRaNnIcAl pOrCuPiNeS UnItEd, Zebastani

Advertisement

Remove ads