{ "name":"count systems",// "launch_path": "/index.html",// "developer": { "name":"RAZVOR",// "url":""// }, "description":"count systems app",// "icons":{ "128":"/icon.png"// } }
<html> <head><script src="https://myapps.mozillalabs.com/jsapi/include.js"></script></head> <body><p>hello world</p></body> <script></script> </html>
<html> <head> <meta charset="UFT-8"> <script src="https://myapps.mozillalabs.com/jsapi/include.js"></script> <script src="jquery.js"></script> <link href="app.css" rel="stylesheet" type="text/css"> </head> <body><p>hello world</p></body> <script> var gManifestName = "manifest.webapp";// app=function(){ this.init=function(){ // } this.init(); }; $(document).ready(function(){ var request = navigator.mozApps.getSelf(); // request.onsuccess=function(){// if(request.result){// , alert(' '); a=new app(); }else{// $('<div>').appendTo('body').attr('id','inst_b').text('!').css({width:200,textAlign:'center',padding:5,background:'#222',color:'#ccc',borderRadius:'3px'}).click(function(){ var inst=navigator.mozApps.install(gManifestName);// inst.onsuccess=function(){alert(' ');$('#inst_b').remove();a=new app();};// inst.onerror=function(){alert(' :\n'+this.error.name)}// }); } }; request.onerror=function(){alert(':\n'+this.error.message)}// }); </script> </html>
<html lang="ru"> <head> <title>Count systems</title> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="/app.css"> <script src="jquery.js"></script> </head> <body> <h1 class="center">Count systems</h1> <div class="feilds"> <p> </p><input type="text"/> <p> </p><input type="text"/> <p> </p><input type="text"/> <div class="error"></div> <div class="result"></div> <button class="submit">!</button> </div> </body> <script> var gManifestName = "manifest.webapp"; app=function(){ this.alp="abcdefghijklmnopqrstuvwxyz"; //this.e='1'; this.p={ ten_to:function(c,d){ var i=0,r=''; do{ v=c%d; c=(c-(c%d))/d; if(v>9){ r+=this.alp[v-10]; }else{ r+=v; } }while(c!=0); var r2=''; for(i=(r.length-1);i>-1;i--){ r2+=r[i]; } return r2; }, to_ten:function(c,d){ c=c.toString(); var v,r=''; for(var i=0;i<c.length;i++){ v=c[i]; if(v.match(/[0-9]/)!=v){ for(i in this.alp){ if(this.alp==v){ v=i+11; return false; } } } r+=v*d; } return r; } }; this.error=function(t){ $('.error').text(t); setTimeout(function d(){$('.error').text('').hide()},1000); }; this.wr_res=function(t){ $('.result').show().text(t); } this.init=function(){ $('body').load('/a.html'); $('.submit').click(function sub(){ $('.submit').hide(); a2=new app(); var fi=$('.feilds input'); fi.each(function(){ if($(this).val().length<1){ a2.error(' !'); return false; } }); var data={ c:fi[0].value, sis:fi[1].value, to_sis:fi[2].value }; with(data){ if(sis==10){ a2.wr_res(a2.p.ten_to(c,to_sis)); }else{ if(to_sis==10){ a2.wr_res(a2.p.to_ten(c,sis)); }else{ a2.wr_res(a2.p.ten_to(a2.p.to_ten(c,sis),to_sis)); } } } fi.change(function(){ $('.result').hide().text(''); $('.submit').show(); }); }); } this.init(); }; $(document).ready(function(){ var request = navigator.mozApps.getSelf(); request.onsuccess=function(){ if(request.result){ a=new app(); }else{ $('<div>').appendTo('body').text('!').css({width:200,textAlign:'center',padding:5,background:'#222',color:'#ccc',borderRadius:'3px'}).click(function(){ var inst=navigator.mozApps.install(gManifestName); inst.onsuccess=function(){alert(' ');a=new app();}; inst.onerror=function(){alert(' :\n'+this.error.name)} }); } }; request.onerror=function(){alert(':\n'+this.error.message)} }); </script> </html>
.center{ width:250; margin:1 auto; } .feilds{ width:250px; margin:10 auto; border-radius:5px; box-shadow:inset 0 0 10px #ddd; padding:10px; } .submit{ width:100; padding:7; background-color:#222; color:#ccc; background-image:none !important; margin-top:15px; } .error{ width:100px; margin:0 auto; color:red; } .result{ width:100px; overflow:auto; margin:5 auto; border:1px solid #aaa; border-radius:4px; padding:6px; display:none; }
<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css"> <link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css">
window.addEventListener("deviceorientation", handleOrientation, true); function handleOrientation(orientData) { var absolute = orientData.absolute; var alpha = orientData.alpha; var beta = orientData.beta; var gamma = orientData.gamma; }
navigator.vibrate(1000);// 1000
Source: https://habr.com/ru/post/272357/
All Articles