10-21-2013, 12:06 PM | #16 | |
but forgot what it's like
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Quote:
This code executed in context of default_status_bar should work as a wireless switch. Code:
var invertedState = (ConnectionState.connectionOnOff ? 0 : 1); nativeBridge.setIntLipcProperty("com.lab126.cmd", "wirelessEnable", invertedState); |
|
10-21-2013, 12:48 PM | #17 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Oh, wonderful, thanks!
I'm trying with: Code:
document.getElementsByClassName("statusBarConnectionDiv").onclick=function(){ var invertedState = (ConnectionState.connectionOnOff ? 0 : 1); nativeBridge.setIntLipcProperty("com.lab126.cmd", "wirelessEnable", invertedState); }; Last edited by twobob; 10-21-2013 at 01:15 PM. Reason: converted to code tag |
10-21-2013, 05:52 PM | #18 |
Book Addict
Posts: 132
Karma: 1040318
Join Date: Apr 2013
Location: USA
Device: Kindle Paperwhite
|
This works great on my PW, thanks!
|
10-22-2013, 04:26 AM | #19 | |
but forgot what it's like
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Quote:
But then, after disabling wireless this div is hidden by default script (using display: none style), so it couldn't be clicked afterwards, until wireless is enabled again. So final solution should be more complex. UPD: ah, it's possibly not a problem on PW where div isn't hidden, but inner icon is just changed to "airplane" (I'm speculating here, because I don't have a real PW). Last edited by eureka; 10-22-2013 at 04:48 AM. |
|
10-22-2013, 06:14 AM | #20 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Code:
<div class="statusBarRightIconDock" id="statusBarRightIconDock"> <div id="statusBarParentalControlsIconDiv" class="parentalControlsOn"> </div> <div class="statusBarConnectionDiv"> <div id="connectionStatusIconDiv"></div> <div id="connectionSignalStrengthIconDiv"></div> </div> <div id="batteryStatusIconDiv"> <div id="batteryFillContainer"> <div id="batteryFill"></div> </div> </div> <div class="statusBarTimeDiv" id="timeDiv"> <span class="statusBarText" id="timeSpan"></span> </div> </div> As reference I've used this: http://www.w3schools.com/htmldom/dom_events.asp where it says: Code:
<button id="myBtn">Try it</button> <script> document.getElementById("myBtn").onclick=function(){displayDate()}; </script> http://www.w3schools.com/htmldom/try...tmldom_events2 Last edited by Aeris; 10-22-2013 at 06:33 AM. |
10-22-2013, 06:39 AM | #21 |
but forgot what it's like
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
@Aeris, we aren't contradicting each other.
Yes, exactly that outer div is hidden on disabling wireless (as seen in relevant script of KT 5.3.2.1). As I've said, it might be wrong assumption in case of PW firmware. Yes, getElementById (in case of success) returns an HTMLElement value suitable for attaching event listener. |
10-22-2013, 06:43 AM | #22 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Ahhhh ok now I got it! Same class name could return multiple nodes... I will try again now that I know these things
I'm also thinking if it would be appropriate to modify system files directly or not, to make persistent changes (embedding the javascript in the head at least). For now it seems to me too risky Last edited by Aeris; 10-22-2013 at 06:53 AM. |
10-22-2013, 07:17 AM | #23 | |
but forgot what it's like
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Quote:
However, it should possible to add new Upstart job definition (into /etc/init) for running that shell script right after (re)starting pillow. Something like /etc/init/pillow_local_mod.conf (not tested at all!!): Code:
start on started pillow task script # put here any shell code end script Code:
start on mounted_userstore and started pillow task exec /bin/sh /mnt/us/extensions/pillow_mod.sh UPD: as you've participated in thread about substituting of "shopping cart" icon, I'd like to inform you about search_bar (containing that icon) being a pillow sub-app. So icon and its tap action could be changed in runtime without modifying any files. Slightly relevant example. Last edited by eureka; 10-22-2013 at 07:44 AM. |
|
10-22-2013, 08:22 AM | #24 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
small reminder.
Breaking upstart WILL most likely brick your kindle. "Word to the wise" and all that. |
10-22-2013, 08:35 AM | #25 |
but forgot what it's like
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Right. That said, this job and its depending behavior could be tested without reboot by restart pillow command. It will not break anything and if it works, reboot will not break anything too. It it doesn't work, just don't forget to delete its job configuration file before reboot.
|
10-22-2013, 09:56 AM | #26 |
but forgot what it's like
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
On KT/PW differences in element's positioning. At least KT 5.3.2.1 (and, I assume, PW with equally recent firmware) provides Pillow.dpi global variable in javascripts/pillow.js script included in most (all?) Pillow HTML pages. Absence of this variable could point to device definitely being KT (but I'm not sure).
This variable, not suprisingly, contains DPI value. First part of this article explains connection between points ("pt" value in CSS), pixels and DPI. With using of this information, concrete margin values could be computed dynamically. BTW, KT has 167 DPI, PW has 212 DPI. |
10-22-2013, 10:08 AM | #27 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Eureka, adding a <script> import row in this file:
/usr/share/webkit-1.0/pillow/default_status_bar.html in the head wouldn't be a safer approach? If default_status_bar.html file goes fucked up someway, the kindle shouldn't brick anyway, right? |
10-22-2013, 10:37 AM | #28 | |
but forgot what it's like
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Quote:
"Upstart job" way with automatic runtime modifications of Pillow app internals is appealing me much more than your alternative and I personally can deal with its known quirks. I have KT with easy accessible USB downloader mode, so any "bricking" concern is not a problem for me. But even if I would have PW, possible "unsafeness" of adding new Upstart job wouldn't bother me at all. And direct modifying of files on system partition is just not sexy solution. So its "safeness" is not an interesting discussion subject for me in this case. UPD: that said, both methods are equally safe from my POV. Last edited by eureka; 10-22-2013 at 10:46 AM. |
|
10-22-2013, 11:26 AM | #29 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
OK, thanks for infos!
|
10-22-2013, 08:22 PM | #30 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Currently I switched to this safe solution: I append the script launcher as last line of every program that restart pillow during the execution (like Koreader does, for example... maybe few others)
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
support for IBM/360/370/S-390 code on the Kindles (KUAL) | knc1 | Kindle Developer's Corner | 63 | 01-08-2014 06:02 PM |
Bible app for e-ink Kindles (Kindle Active Content) | draytonbenner | Self-Promotions by Authors and Publishers | 0 | 10-18-2012 10:23 AM |
iPad Amazon’s Kindle iOS app now ready for the new iPad’s Retina*Display | monkeyluis | Apple Devices | 9 | 03-18-2012 08:27 PM |
A tray app for Calibre ? | thomass | Calibre | 3 | 08-21-2011 05:19 PM |
So is the Iliad really production ready and is the market ready for e-readers? | pdam | iRex | 28 | 09-14-2006 05:24 PM |