mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
docs(demos): update config to move config JS in index
This commit is contained in:
@ -1 +0,0 @@
|
||||
<ion-nav id="nav" [root]="rootPage" #content></ion-nav>
|
@ -1,66 +0,0 @@
|
||||
if (!window.localStorage) {
|
||||
Object.defineProperty(window, "localStorage", new (function () {
|
||||
var aKeys = [], oStorage = {};
|
||||
Object.defineProperty(oStorage, "getItem", {
|
||||
value: function (sKey) { return sKey ? this[sKey] : null; },
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(oStorage, "key", {
|
||||
value: function (nKeyId) { return aKeys[nKeyId]; },
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(oStorage, "setItem", {
|
||||
value: function (sKey, sValue) {
|
||||
if(!sKey) { return; }
|
||||
document.cookie = escape(sKey) + "=" + escape(sValue) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";
|
||||
},
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(oStorage, "length", {
|
||||
get: function () { return aKeys.length; },
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(oStorage, "removeItem", {
|
||||
value: function (sKey) {
|
||||
if(!sKey) { return; }
|
||||
document.cookie = escape(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
|
||||
},
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
this.get = function () {
|
||||
var iThisIndx;
|
||||
for (var sKey in oStorage) {
|
||||
iThisIndx = aKeys.indexOf(sKey);
|
||||
if (iThisIndx === -1) { oStorage.setItem(sKey, oStorage[sKey]); }
|
||||
else { aKeys.splice(iThisIndx, 1); }
|
||||
delete oStorage[sKey];
|
||||
}
|
||||
for (aKeys; aKeys.length > 0; aKeys.splice(0, 1)) { oStorage.removeItem(aKeys[0]); }
|
||||
for (var aCouple, iKey, nIdx = 0, aCouples = document.cookie.split(/\s*;\s*/); nIdx < aCouples.length; nIdx++) {
|
||||
aCouple = aCouples[nIdx].split(/\s*=\s*/);
|
||||
if (aCouple.length > 1) {
|
||||
oStorage[iKey = unescape(aCouple[0])] = unescape(aCouple[1]);
|
||||
aKeys.push(iKey);
|
||||
}
|
||||
}
|
||||
return oStorage;
|
||||
};
|
||||
this.configurable = false;
|
||||
this.enumerable = true;
|
||||
})());
|
||||
}
|
||||
|
||||
if (window.localStorage.getItem('configDemo')) {
|
||||
CONFIG_DEMO = JSON.parse(window.localStorage.getItem('configDemo'));
|
||||
} else {
|
||||
CONFIG_DEMO = null;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<!-- https://www.chromium.org/developers/design-documents/chromium-graphics/how-to-get-gpu-rasterization -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/dist/demos/scrollbar-fix.css">
|
||||
<link ios-href="/dist/bundles/ionic.ios.css" rel="stylesheet">
|
||||
<link md-href="/dist/bundles/ionic.md.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="app.css">
|
||||
<script type="text/javascript" src="/dist/demos/scrollbar-fix.js"></script>
|
||||
<script type="text/javascript" src="config-demo.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<ion-app>
|
||||
<ion-loading-icon></ion-loading-icon>
|
||||
</ion-app>
|
||||
|
||||
<script src="bundle.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,7 +1,74 @@
|
||||
if (!window.localStorage) {
|
||||
Object.defineProperty(window, "localStorage", new (function () {
|
||||
var aKeys = [], oStorage = {};
|
||||
Object.defineProperty(oStorage, "getItem", {
|
||||
value: function (sKey) { return sKey ? this[sKey] : null; },
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(oStorage, "key", {
|
||||
value: function (nKeyId) { return aKeys[nKeyId]; },
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(oStorage, "setItem", {
|
||||
value: function (sKey, sValue) {
|
||||
if(!sKey) { return; }
|
||||
document.cookie = escape(sKey) + "=" + escape(sValue) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";
|
||||
},
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(oStorage, "length", {
|
||||
get: function () { return aKeys.length; },
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(oStorage, "removeItem", {
|
||||
value: function (sKey) {
|
||||
if(!sKey) { return; }
|
||||
document.cookie = escape(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
|
||||
},
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
});
|
||||
this.get = function () {
|
||||
var iThisIndx;
|
||||
for (var sKey in oStorage) {
|
||||
iThisIndx = aKeys.indexOf(sKey);
|
||||
if (iThisIndx === -1) { oStorage.setItem(sKey, oStorage[sKey]); }
|
||||
else { aKeys.splice(iThisIndx, 1); }
|
||||
delete oStorage[sKey];
|
||||
}
|
||||
for (aKeys; aKeys.length > 0; aKeys.splice(0, 1)) { oStorage.removeItem(aKeys[0]); }
|
||||
for (var aCouple, iKey, nIdx = 0, aCouples = document.cookie.split(/\s*;\s*/); nIdx < aCouples.length; nIdx++) {
|
||||
aCouple = aCouples[nIdx].split(/\s*=\s*/);
|
||||
if (aCouple.length > 1) {
|
||||
oStorage[iKey = unescape(aCouple[0])] = unescape(aCouple[1]);
|
||||
aKeys.push(iKey);
|
||||
}
|
||||
}
|
||||
return oStorage;
|
||||
};
|
||||
this.configurable = false;
|
||||
this.enumerable = true;
|
||||
})());
|
||||
}
|
||||
|
||||
var CONFIG_DEMO = null;
|
||||
|
||||
if (window.localStorage.getItem('configDemo')) {
|
||||
CONFIG_DEMO = JSON.parse(window.localStorage.getItem('configDemo'));
|
||||
}
|
||||
|
||||
import {App, Page, IonicApp, Platform, NavController} from 'ionic-angular';
|
||||
|
||||
@App({
|
||||
templateUrl: 'app.html',
|
||||
template: '<ion-nav id="nav" [root]="rootPage" #content></ion-nav>',
|
||||
config: CONFIG_DEMO || {}
|
||||
})
|
||||
class ApiDemoApp {
|
||||
|
Reference in New Issue
Block a user