Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add add to home script from cubiq.org

  • Loading branch information...
commit 9722e4bad5ed5cebc817acfaec7c1005152489d4 1 parent 5d39b51
@a-fung authored
View
8 NOTICE
@@ -73,3 +73,11 @@ pdfviewer-win32
Website: http://code.google.com/p/pdfviewer-win32/
License: The GPL License
http://dev.perl.org/licenses/gpl1.html
+
+
+Add to Homescreen v2.0.4
+--------------
+Website: http://cubiq.org
+Copyright: Copyright (c) 2012 Matteo Spinelli
+License: The MIT license
+ http://cubiq.org/license
View
1  gather_aspnet.ps1
@@ -48,6 +48,7 @@ copy source\aspnetserver\js\bootstrap.min.js $path\js
copy source\aspnetserver\js\jquery-1.8.2.min.js $path\js
copy source\aspnetserver\js\jquery.touch.js $path\js
copy source\aspnetserver\js\json2.js $path\js
+copy source\aspnetserver\js\add2home.js $path\js
copy source\aspnetserver\js\servertype.js $path\js
View
1  gather_php.ps1
@@ -49,6 +49,7 @@ copy source\aspnetserver\js\bootstrap.min.js $path\js
copy source\aspnetserver\js\jquery-1.8.2.min.js $path\js
copy source\aspnetserver\js\jquery.touch.js $path\js
copy source\aspnetserver\js\json2.js $path\js
+copy source\aspnetserver\js\add2home.js $path\js
copy source\php\js\servertype.js $path\js
View
2  source/aspnetserver/admin.html
@@ -7,11 +7,13 @@
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>MangaWeb - Admin</title>
+ <link href="css/add2home.css" rel="stylesheet" />
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="css/bootstrap-responsive.min.css" rel="stylesheet" />
<link href="css/mangaweb.css" rel="stylesheet" />
<link rel="apple-touch-icon-precomposed" href="img/icon.png" />
<link rel="shortcut icon" href="favicon.ico" />
+ <script type="text/javascript" src="js/add2home.js"></script>
<script type="text/javascript" src="js/json2.js"></script>
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
View
1  source/aspnetserver/css/add2home.css
@@ -0,0 +1 @@
+#addToHomeScreen{z-index:9999;-webkit-user-select:none;-webkit-box-sizing:border-box;width:240px;font-size:15px;padding:12px 14px;text-align:left;font-family:helvetica;background-image:-webkit-gradient(linear,0 0,0 100%,color-stop(0,#fff),color-stop(0.02,#eee),color-stop(0.98,#ccc),color-stop(1,#a3a3a3));border:1px solid #505050;-webkit-border-radius:8px;-webkit-background-clip:padding-box;color:#333;text-shadow:0 1px 0 rgba(255,255,255,0.75);line-height:130%;-webkit-box-shadow:0 0 4px rgba(0,0,0,0.5)}#addToHomeScreen.addToHomeIpad{width:268px;font-size:18px;padding:14px}#addToHomeScreen.addToHomeWide{width:296px}#addToHomeScreen.addToHomeIpad.addToHomeWide{width:320px;font-size:18px;padding:14px}#addToHomeScreen .addToHomeArrow{position:absolute;background-image:-webkit-gradient(linear,0 0,100% 100%,color-stop(0,rgba(204,204,204,0)),color-stop(0.4,rgba(204,204,204,0)),color-stop(0.4,#ccc));border-width:0 1px 1px 0;border-style:solid;border-color:#505050;width:16px;height:16px;-webkit-transform:rotateZ(45deg);bottom:-9px;left:50%;margin-left:-8px;-webkit-box-shadow:inset -1px -1px 0 #a9a9a9;-webkit-border-bottom-right-radius:2px}#addToHomeScreen.addToHomeIpad .addToHomeArrow{-webkit-transform:rotateZ(-135deg);background-image:-webkit-gradient(linear,0 0,100% 100%,color-stop(0,rgba(238,238,238,0)),color-stop(0.4,rgba(238,238,238,0)),color-stop(0.4,#eee));-webkit-box-shadow:inset -1px -1px 0 #fff;top:-9px;bottom:auto;left:50%}#addToHomeScreen .addToHomeClose{-webkit-box-sizing:border-box;position:absolute;right:4px;top:4px;width:18px;height:18px;line-height:14px;text-align:center;text-indent:1px;-webkit-border-radius:9px;background:rgba(0,0,0,0.12);color:#707070;-webkit-box-shadow:0 1px 0 #fff;font-size:16px}#addToHomeScreen .addToHomePlus{font-weight:bold;font-size:1.3em}#addToHomeScreen .addToHomeShare{display:inline-block;width:18px;height:15px;background-repeat:no-repeat;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPCAQAAABDj1eZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAUdJREFUKFNtkLtLw1AYxS/qJLhXVKr2ZRulUNtiqgSb3CziICI6ucTFVYcOnaQOFRwUnNTRwUWXgpP/QdHNUEQUHGxofYBTlRs83iZNjKTncOGe7/vx3QchXUWn6FL3jhfKUdCCr5zuifV5oDiHQM+c+CIhiiCSWNu08iq9oHXKLAiqrgR4UXqlOEYZt++ExEL0wW7+OW0G10muLv9gmqfe5FAWKmTMYQYiFL7PYwyLOD8lSjNh2gdnPzMII4QUBxc4OothbAF7GCBKQ0YbSWyPQsIhqvetS+y0ygGMo/KFZfviDvR4AhwgZU9dGYnA0J/6ndc15i3ouYIMcVVUcEXIoOxCeRCfwP8sXBSdjtpUv/1QW+K16kCCIUC4id9Fa0JtkluwVkSfqPL6RwfSDA0aNlx7k/bWgViB7bMS2/1vk5sdsZLN/ALSuL3tylO4RAAAAABJRU5ErkJggg==);background-size:18px 15px;text-indent:-9999em;overflow:hidden}#addToHomeScreen .addToHomeTouchIcon{display:block;float:left;-webkit-border-radius:6px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.5),inset 0 0 2px rgba(255,255,255,0.9);background-repeat:no-repeat;width:57px;height:57px;-webkit-background-size:57px 57px;margin:0 12px 0 0;border:1px solid #333;-webkit-background-clip:padding-box}@media all and (-webkit-min-device-pixel-ratio:2){#addToHomeScreen .addToHomeShare{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAeCAQAAADu6HTYAAADPElEQVR4Xq3TX2gcRRzA8e/M7mVv2+TSNpc/TZtrY6jUGqgaSAmEChKLrYK0YH0RFC2CSCkEfCghiKU04J8qNigq6os+iQV98MHWFwVBrQQRWs21lBw5cw3NNb1/udu72RGG5Y77IzXW77D7sAwf5sc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ple-mobile-web-app-status-bar-style" content="black" />
<title>MangaWeb</title>
+ <link href="css/add2home.css" rel="stylesheet" />
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="css/bootstrap-responsive.min.css" rel="stylesheet" />
<link href="css/mangaweb.css" rel="stylesheet" />
<link rel="apple-touch-icon-precomposed" href="img/icon.png" />
<link rel="shortcut icon" href="favicon.ico" />
+ <script type="text/javascript" src="js/add2home.js"></script>
<script type="text/javascript" src="js/json2.js"></script>
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/jquery.touch.js"></script>
View
5 source/aspnetserver/js/add2home.js
@@ -0,0 +1,5 @@
+/*!
+ * Add to Homescreen v2.0.4 ~ Copyright (c) 2012 Matteo Spinelli, http://cubiq.org
+ * Released under MIT license, http://cubiq.org/license
+ */
+var addToHome=(function(w){var b=w.navigator,isIDevice='platform'in b&&(/iphone|ipod|ipad/gi).test(b.platform),isIPad,isRetina,isSafari,isStandalone,OSVersion,startX=0,startY=0,lastVisit=0,isExpired,isSessionActive,isReturningVisitor,balloon,overrideChecks,positionInterval,closeTimeout,options={autostart:true,returningVisitor:false,animationIn:'drop',animationOut:'fade',startDelay:2000,lifespan:15000,bottomOffset:14,expire:0,message:'',touchIcon:false,arrow:true,hookOnLoad:true,iterations:100},intl={ca_es:'Per instal·lar aquesta aplicació al vostre %device premeu %icon i llavors <strong>Afegir a pantalla d\'inici</strong>.',cs_cz:'Pro instalaci aplikace na Váš %device, stiskněte %icon a v nabídce <strong>Přidat na plochu</strong>.',da_dk:'Tilføj denne side til din %device: tryk på %icon og derefter <strong>Føj til hjemmeskærm</strong>.',de_de:'Installieren Sie diese App auf Ihrem %device: %icon antippen und dann <strong>Zum Home-Bildschirm</strong>.',el_gr:'Εγκαταστήσετε αυτήν την Εφαρμογή στήν συσκευή σας %device: %icon μετά πατάτε <strong>Προσθήκη σε Αφετηρία</strong>.',en_us:'Install this web app on your %device: tap %icon and then <strong>Add to Home Screen</strong>.',es_es:'Para instalar esta app en su %device, pulse %icon y seleccione <strong>Añadir a pantalla de inicio</strong>.',fi_fi:'Asenna tämä web-sovellus laitteeseesi %device: paina %icon ja sen jälkeen valitse <strong>Lisää Koti-valikkoon</strong>.',fr_fr:'Ajoutez cette application sur votre %device en cliquant sur %icon, puis <strong>Ajouter à l\'écran d\'accueil</strong>.',he_il:'<span dir="rtl">התקן אפליקציה זו על ה-%device שלך: הקש %icon ואז <strong>הוסף למסך הבית</strong>.</span>',hr_hr:'Instaliraj ovu aplikaciju na svoj %device: klikni na %icon i odaberi <strong>Dodaj u početni zaslon</strong>.',hu_hu:'Telepítse ezt a web-alkalmazást az Ön %device-jára: nyomjon a %icon-ra majd a <strong>Főképernyőhöz adás</strong> gombra.',it_it:'Installa questa applicazione sul tuo %device: premi su %icon e poi <strong>Aggiungi a Home</strong>.',ja_jp:'このウェブアプリをあなたの%deviceにインストールするには%iconをタップして<strong>ホーム画面に追加</strong>を選んでください。',ko_kr:'%device에 웹앱을 설치하려면 %icon을 터치 후 "홈화면에 추가"를 선택하세요',nb_no:'Installer denne appen på din %device: trykk på %icon og deretter <strong>Legg til på Hjem-skjerm</strong>',nl_nl:'Installeer deze webapp op uw %device: tik %icon en dan <strong>Zet in beginscherm</strong>.',pl_pl:'Aby zainstalować tę aplikacje na %device: naciśnij %icon a następnie <strong>Dodaj jako ikonę</strong>.',pt_br:'Instale este web app em seu %device: aperte %icon e selecione <strong>Adicionar à Tela Inicio</strong>.',pt_pt:'Para instalar esta aplicação no seu %device, prima o %icon e depois o <strong>Adicionar ao ecrã principal</strong>.',ru_ru:'Установите это веб-приложение на ваш %device: нажмите %icon, затем <strong>Добавить в «Домой»</strong>.',sv_se:'Lägg till denna webbapplikation på din %device: tryck på %icon och därefter <strong>Lägg till på hemskärmen</strong>.',th_th:'ติดตั้งเว็บแอพฯ นี้บน %device ของคุณ: แตะ %icon และ <strong>เพิ่มที่หน้าจอโฮม</strong>',tr_tr:'%device için bu uygulamayı kurduktan sonra %icon simgesine dokunarak <strong>Ana Ekrana Ekle</strong>yin.',zh_cn:'您可以将此应用程式安装到您的 %device 上。请按 %icon 然后点选<strong>添加至主屏幕</strong>。',zh_tw:'您可以將此應用程式安裝到您的 %device 上。請按 %icon 然後點選<strong>加入主畫面螢幕</strong>。'};function init(){if(!isIDevice)return;var a=Date.now(),i;if(w.addToHomeConfig){for(i in w.addToHomeConfig){options[i]=w.addToHomeConfig[i]}}if(!options.autostart)options.hookOnLoad=false;isIPad=(/ipad/gi).test(b.platform);isRetina=w.devicePixelRatio&&w.devicePixelRatio>1;isSafari=(/Safari/i).test(b.appVersion)&&!(/CriOS/i).test(b.appVersion);isStandalone=b.standalone;OSVersion=b.appVersion.match(/OS (\d+_\d+)/i);OSVersion=OSVersion[1]?+OSVersion[1].replace('_','.'):0;lastVisit=+w.localStorage.getItem('addToHome');isSessionActive=w.sessionStorage.getItem('addToHomeSession');isReturningVisitor=options.returningVisitor?lastVisit&&lastVisit+28*24*60*60*1000>a:true;if(!lastVisit)lastVisit=a;isExpired=isReturningVisitor&&lastVisit<=a;if(options.hookOnLoad)w.addEventListener('load',loaded,false);else if(!options.hookOnLoad&&options.autostart)loaded()}function loaded(){w.removeEventListener('load',loaded,false);if(!isReturningVisitor)w.localStorage.setItem('addToHome',Date.now());else if(options.expire&&isExpired)w.localStorage.setItem('addToHome',Date.now()+options.expire*60000);if(!overrideChecks&&(!isSafari||!isExpired||isSessionActive||isStandalone||!isReturningVisitor))return;var a=options.touchIcon?document.querySelectorAll('head link[rel=apple-touch-icon],head link[rel=apple-touch-icon-precomposed]'):[],sizes,touchIcon='',closeButton,platform=b.platform.split(' ')[0],language=b.language.replace('-','_'),i,l;balloon=document.createElement('div');balloon.id='addToHomeScreen';balloon.style.cssText+='left:-9999px;-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0;-webkit-transform:translate3d(0,0,0);position:'+(OSVersion<5?'absolute':'fixed');if(options.message in intl){language=options.message;options.message=''}if(options.message===''){options.message=language in intl?intl[language]:intl['en_us']}if(a.length){for(i=0,l=a.length;i<l;i++){sizes=a[i].getAttribute('sizes');if(sizes){if(isRetina&&sizes=='114x114'){touchIcon=a[i].href;break}}else{touchIcon=a[i].href}}touchIcon='<span style="background-image:url('+touchIcon+')" class="addToHomeTouchIcon"></span>'}balloon.className=(isIPad?'addToHomeIpad':'addToHomeIphone')+(touchIcon?' addToHomeWide':'');balloon.innerHTML=touchIcon+options.message.replace('%device',platform).replace('%icon',OSVersion>=4.2?'<span class="addToHomeShare"></span>':'<span class="addToHomePlus">+</span>')+(options.arrow?'<span class="addToHomeArrow"></span>':'')+'<span class="addToHomeClose">\u00D7</span>';document.body.appendChild(balloon);closeButton=balloon.querySelector('.addToHomeClose');if(closeButton)closeButton.addEventListener('click',clicked,false);if(!isIPad&&OSVersion>5)window.addEventListener('orientationchange',orientationCheck,false);setTimeout(show,options.startDelay)}function show(){var a,iPadXShift=208;if(isIPad){if(OSVersion<5){startY=w.scrollY;startX=w.scrollX}else if(OSVersion<6){iPadXShift=160}balloon.style.top=startY+options.bottomOffset+'px';balloon.style.left=startX+iPadXShift-Math.round(balloon.offsetWidth/2)+'px';switch(options.animationIn){case'drop':a='0.6s';balloon.style.webkitTransform='translate3d(0,'+ -(w.scrollY+options.bottomOffset+balloon.offsetHeight)+'px,0)';break;case'bubble':a='0.6s';balloon.style.opacity='0';balloon.style.webkitTransform='translate3d(0,'+(startY+50)+'px,0)';break;default:a='1s';balloon.style.opacity='0'}}else{startY=w.innerHeight+w.scrollY;if(OSVersion<5){startX=Math.round((w.innerWidth-balloon.offsetWidth)/2)+w.scrollX;balloon.style.left=startX+'px';balloon.style.top=startY-balloon.offsetHeight-options.bottomOffset+'px'}else{balloon.style.left='50%';balloon.style.marginLeft=-Math.round(balloon.offsetWidth/2)-(w.orientation%180&&OSVersion>5?40:0)+'px';balloon.style.bottom=options.bottomOffset+'px'}switch(options.animationIn){case'drop':a='1s';balloon.style.webkitTransform='translate3d(0,'+ -(startY+options.bottomOffset)+'px,0)';break;case'bubble':a='0.6s';balloon.style.webkitTransform='translate3d(0,'+(balloon.offsetHeight+options.bottomOffset+50)+'px,0)';break;default:a='1s';balloon.style.opacity='0'}}balloon.offsetHeight;balloon.style.webkitTransitionDuration=a;balloon.style.opacity='1';balloon.style.webkitTransform='translate3d(0,0,0)';balloon.addEventListener('webkitTransitionEnd',transitionEnd,false);closeTimeout=setTimeout(close,options.lifespan)}function manualShow(a){if(!isIDevice||balloon)return;overrideChecks=a;loaded()}function close(){clearInterval(positionInterval);clearTimeout(closeTimeout);closeTimeout=null;var a=0,posX=0,opacity='1',duration='0',closeButton=balloon.querySelector('.addToHomeClose');if(closeButton)closeButton.removeEventListener('click',close,false);if(!isIPad&&OSVersion>5)window.removeEventListener('orientationchange',orientationCheck,false);if(OSVersion<5){a=isIPad?w.scrollY-startY:w.scrollY+w.innerHeight-startY;posX=isIPad?w.scrollX-startX:w.scrollX+Math.round((w.innerWidth-balloon.offsetWidth)/2)-startX}balloon.style.webkitTransitionProperty='-webkit-transform,opacity';switch(options.animationOut){case'drop':if(isIPad){duration='0.4s';opacity='0';a=a+50}else{duration='0.6s';a=a+balloon.offsetHeight+options.bottomOffset+50}break;case'bubble':if(isIPad){duration='0.8s';a=a-balloon.offsetHeight-options.bottomOffset-50}else{duration='0.4s';opacity='0';a=a-50}break;default:duration='0.8s';opacity='0'}balloon.addEventListener('webkitTransitionEnd',transitionEnd,false);balloon.style.opacity=opacity;balloon.style.webkitTransitionDuration=duration;balloon.style.webkitTransform='translate3d('+posX+'px,'+a+'px,0)'}function clicked(){w.sessionStorage.setItem('addToHomeSession','1');isSessionActive=true;close()}function transitionEnd(){balloon.removeEventListener('webkitTransitionEnd',transitionEnd,false);balloon.style.webkitTransitionProperty='-webkit-transform';balloon.style.webkitTransitionDuration='0.2s';if(!closeTimeout){balloon.parentNode.removeChild(balloon);balloon=null;return}if(OSVersion<5&&closeTimeout)positionInterval=setInterval(setPosition,options.iterations)}function setPosition(){var a=new WebKitCSSMatrix(w.getComputedStyle(balloon,null).webkitTransform),posY=isIPad?w.scrollY-startY:w.scrollY+w.innerHeight-startY,posX=isIPad?w.scrollX-startX:w.scrollX+Math.round((w.innerWidth-balloon.offsetWidth)/2)-startX;if(posY==a.m42&&posX==a.m41)return;balloon.style.webkitTransform='translate3d('+posX+'px,'+posY+'px,0)'}function reset(){w.localStorage.removeItem('addToHome');w.sessionStorage.removeItem('addToHomeSession')}function orientationCheck(){balloon.style.marginLeft=-Math.round(balloon.offsetWidth/2)-(w.orientation%180&&OSVersion>5?40:0)+'px'}init();return{show:manualShow,close:close,reset:reset}})(window);
Please sign in to comment.
Something went wrong with that request. Please try again.