Last active
December 30, 2015 07:29
-
-
Save tomgidden/87aeee7209f5bed813bf to your computer and use it in GitHub Desktop.
Grotesque, bloated and inefficient inlining of HTML in PebbleJS app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pebble.addEventListener('showConfiguration', function(e) { | |
var o = Pebble.openURL('data:text/html;base64,PGh0bWw+PGhlYWQ+PG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPTMyMCwgaW5pdGlhbC1zY2FsZT0xIj48c3R5bGU+bGFiZWwse2Rpc3BsYXk6YmxvY2t9bGFiZWx7Y2xlYXI6Ym90aDtoZWlnaHQ6NTBweH1pbnB1dHtmbG9hdDpyaWdodH08L3N0eWxlPjwvaGVhZD48Ym9keT48aDE+UGViYmxlSlMgYmxvYXRlZCBpbmxpbmUgSFRNTDwvaDE+PGZvcm0gaWQ9ImYiIG9uc3VibWl0PSJyZXR1cm4gcyh0aGlzKSI+PGxhYmVsPkZvbzxpbnB1dCB0eXBlPSJjaGVja2JveCIgbmFtZT0iZm9vIj48L2xhYmVsPjxsYWJlbD5CYXI8aW5wdXQgdHlwZT0iY2hlY2tib3giIG5hbWU9ImJhciI+PC9sYWJlbD48bGFiZWw+U2F2ZTxpbnB1dCB0eXBlPSJzdWJtaXQiPjwvbGFiZWw+PC9mb3JtPjxzY3JpcHQ+ZnVuY3Rpb24gcyhlKXtmb3Iobz17fSxpPTA7aTxlLmxlbmd0aDtpKyspKGo9ZVtpXS5uYW1lKSYmKG9bal09ZVtpXS5jaGVja2VkPzE6MCk7cmV0dXJuIHdpbmRvdy5sb2NhdGlvbi5ocmVmPSJwZWJibGVqczovL2Nsb3NlIyIrSlNPTi5zdHJpbmdpZnkobyksITF9PC9zY3JpcHQ+PC9ib2R5PjwvaHRtbD4K'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<!-- For reference only: This is (roughly) what comes out of the Base64 chunk in pebble-js-app.js when decoded --> | |
<head> | |
<meta name="viewport" content="width=320, initial-scale=1"> | |
<style> | |
label,input { display:block } | |
label { clear:both; height:50px } | |
input { float:right } | |
</style> | |
</head> | |
<body> | |
<h1>PebbleJS bloated inline HTML</h1> | |
<form id="f" onsubmit="return s(this)"> | |
<label>Foo<input type="checkbox" name="foo"></label> | |
<label>Bar<input type="checkbox" name="bar"></label> | |
<label>Save<input type="submit"></label> | |
</form> | |
<script> | |
function s(f) { | |
o = {}; | |
for(i=0; i<f.length; i++) | |
if(j=f[i].name) | |
o[j] = f[i].checked ? 1 : 0; | |
window.location.href = 'pebblejs://close#'+JSON.stringify(o); | |
return false; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment