From ee3dd2e72a1d24900d2c295c720793c5290ce94c Mon Sep 17 00:00:00 2001 From: toyg Date: Fri, 17 Jan 2014 01:08:33 +0000 Subject: [PATCH 1/5] Added readme --- README.md | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..9afa6a9 --- /dev/null +++ b/README.md @@ -0,0 +1,84 @@ +twister-html +============ + +HTML interface for [Twister](http://twister.net.co). +To use it, clone this repo under ~/.twister/html like this: + + git clone https://github.com/miguelfreitas/twister-html.git ~/.twister/html + +Localisation +------------ + +If you want a localised interface (currently available only for NL, IT, FR and soon RU), +use the experimental `i18n` branch: + + git checkout i18n + +If you want to translate it in your own language, check [these instructions](#translations) + +Contribute +---------- + +Feel free to fork and send pull requests! +To make it easier for us to accept your patches, please follow the conventional +GitHub workflow: + + # after forking, clone your repo + rm -rf ~/.twister/html + git clone git@github.com:yournickname/twister-html.git ~/.twister/html + cd ~/.twister/html + # CREATE A NEW BRANCH, specific to the fix you're implementing + git checkout -b my-fix + # ... make your changes ... + # commit and push + git commit -m "Fixing #1234 - bad foobarizer" && git push + # Now open a pull request from branch my-fix to miguelfreitas:master on github. + # Once the request is accepted, switch back to master and track upstream + git remote add upstream https://github.com/miguelfreitas/twister-html.git # one-off setup + git fetch upstream + git checkout master + git merge upstream/master # you should get a fast-forward message here + git push + +Translations +------------ + +If you want to add your own translation, edit `interface_localization.js` like this: + +1. fork the repo, checkout `i18n` and create a new branch + + + git clone git@github.com:yournickname/twister-html.git ~/.twister/html + cd ~/.twister/html + git checkout i18n + git checkout -b Klingon + +2. add your language to the list of available choices. You should use your ISO code here, +it should match what the browser reports. The Klingon ISO is "tlh", so: + + + var knownLanguages = ["en","nl","it","fr","tlh"];` + +For multi-region languages, if you want to catch them all, use only the first half +(e.g. to match it and it-ch, specify "it"). + +3. add a new wordset block after existing ones + + + if(preferredLanguage == "tlh"){ + polyglot.locale("tlh"); + wordset = { + "Insults": "mu'qaD, + .... + } + } + + +4. commit & push + + + git commit -m "Klingon translation" + git push + +3. When opening the pull request on github, make sure you're pointing to `miguelfreitas:i18n` +as the base, so we can merge it straight away in the right place. For any help, ping @toyg. From 3ac31ee546b51554bbfc7caa198ad629490403e4 Mon Sep 17 00:00:00 2001 From: Block Tester Date: Fri, 17 Jan 2014 04:35:19 +0000 Subject: [PATCH 2/5] Small css fix to break very long nonbreaking space (ie: added word break) --- css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/css/style.css b/css/style.css index bb8ec7e..aefa0e0 100644 --- a/css/style.css +++ b/css/style.css @@ -839,6 +839,7 @@ button.disabled:hover { font-size: 13px; margin: 2px 10px 4px 60px; + word-break: break-all; } .post-context { From 64cf4d0a3e924dcebdf62d9fc9ac27f4e9357aee Mon Sep 17 00:00:00 2001 From: Block Tester Date: Fri, 17 Jan 2014 05:22:06 +0000 Subject: [PATCH 3/5] Fixes #17 add 'exit' button --- abort.html | 40 ++++++++++++++++++++++++++++++++++++++++ network.html | 5 +++++ twister_network.js | 19 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 abort.html diff --git a/abort.html b/abort.html new file mode 100644 index 0000000..a136425 --- /dev/null +++ b/abort.html @@ -0,0 +1,40 @@ + + + + + Aborting... + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

Daemon exited...

+
+ +
+ + + diff --git a/network.html b/network.html index eafb023..ecde17c 100644 --- a/network.html +++ b/network.html @@ -83,6 +83,11 @@
  • 00.00.00.00 +
  • +
  • + + +
  • Detailed information

    diff --git a/twister_network.js b/twister_network.js index 2974209..75b263d 100644 --- a/twister_network.js +++ b/twister_network.js @@ -223,6 +223,24 @@ function setSpamMsg() { }, {}); } +function exitDaemon() { + $( ".terminate-daemon").text("Exiting..."); + $( ".terminate-daemon").addClass("disabled"); + $.MAL.disableButton( $( ".terminate-daemon") ); + + twisterRpc("stop", undefined, + function(args, ret) { + console.log("daemon exiting"); + + setTimeout(function _reload_after_exit() { + window.location.href = '/abort.html'; + }, 2000); + }, {}, + function(args, ret) { + console.log("error while exiting daemon"); + }, {}); +} + // handlers common to both desktop and mobile function interfaceNetworkHandlers() { $( ".new-peer-addr" ).keyup( peerKeypress ); @@ -231,6 +249,7 @@ function interfaceNetworkHandlers() { $( ".add-dns").bind( "click", addDNSClick ); $( "select.genblock").change( setGenerate ); $( ".update-spam-msg").bind( "click", setSpamMsg ); + $( ".terminate-daemon").bind( "click", exitDaemon ) } From 5323072be765d0cbb9fc2a79a331c3e1de0999f9 Mon Sep 17 00:00:00 2001 From: Block Tester Date: Fri, 17 Jan 2014 05:32:39 +0000 Subject: [PATCH 4/5] Fixes #17 Added exit daemon button to mobile interface --- tmobile.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmobile.html b/tmobile.html index ea7327c..12dc101 100644 --- a/tmobile.html +++ b/tmobile.html @@ -478,7 +478,8 @@
     
    - + +

    Detailed information

    • From beb80b660625bee5ceced7b58ac7a83865631c33 Mon Sep 17 00:00:00 2001 From: Block Tester Date: Fri, 17 Jan 2014 07:08:13 +0000 Subject: [PATCH 5/5] Added confirmation popup. --- twister_network.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/twister_network.js b/twister_network.js index 75b263d..cfecab1 100644 --- a/twister_network.js +++ b/twister_network.js @@ -224,21 +224,24 @@ function setSpamMsg() { } function exitDaemon() { - $( ".terminate-daemon").text("Exiting..."); - $( ".terminate-daemon").addClass("disabled"); - $.MAL.disableButton( $( ".terminate-daemon") ); - - twisterRpc("stop", undefined, - function(args, ret) { - console.log("daemon exiting"); - - setTimeout(function _reload_after_exit() { - window.location.href = '/abort.html'; - }, 2000); - }, {}, - function(args, ret) { - console.log("error while exiting daemon"); - }, {}); + if (confirm('Are you sure you want to exit the daemon?\nThe Twister client will stop working.')) { + $( ".terminate-daemon").text("Exiting..."); + $( ".terminate-daemon").addClass("disabled"); + $.MAL.disableButton( $( ".terminate-daemon") ); + + twisterRpc("stop", undefined, + function(args, ret) { + console.log("daemon exiting"); + + setTimeout(function _reload_after_exit() { + window.location.href = '/abort.html'; + }, 2000); + }, {}, + function(args, ret) { + console.log("error while exiting daemon"); + }, {}); + + } } // handlers common to both desktop and mobile