Make script tags work when inside pages
This commit is contained in:
parent
2c3092ecb4
commit
44a0da1f2b
@ -2,6 +2,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var $$ = Dom7;
|
||||
|
||||
var shown_notifications = [];
|
||||
|
||||
var app = new Framework7({
|
||||
@ -85,16 +87,13 @@ document.addEventListener("backbutton", function (event) {
|
||||
|
||||
document.addEventListener("deviceready", function () {
|
||||
|
||||
loadingProgressDialog = app.dialog.progress('Loading...', 0);
|
||||
loadingProgressDialog.setText('');
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.backgroundColorByHexString("#1976d2");
|
||||
}
|
||||
|
||||
// Enable/disable jQuery animations depending on user preference
|
||||
$.fx.off = !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true");
|
||||
|
||||
if (isconfigvalid()) {
|
||||
loadingProgressDialog = app.dialog.progress('Loading...', 0);
|
||||
loadingProgressDialog.setText('');
|
||||
loadingProgressDialog.setProgress(20);
|
||||
loadingProgressDialog.setText('Account');
|
||||
getuserinfo(function () {
|
||||
@ -106,7 +105,7 @@ document.addEventListener("deviceready", function () {
|
||||
loadingProgressDialog.setProgress(60);
|
||||
// Load homepage/dashboard
|
||||
loadingProgressDialog.setText('Apps');
|
||||
loadHomePage();
|
||||
loadHomePage(false);
|
||||
});
|
||||
} else {
|
||||
// Try to recover data from NativeStorage back to localStorage
|
||||
@ -130,6 +129,15 @@ router.on("pageBeforeIn", function (pagedata) {
|
||||
});
|
||||
|
||||
router.on("pageInit", function (pagedata) {
|
||||
pagedata.$el.find('script').each(function (el) {
|
||||
if ($$(this).attr('src')) {
|
||||
var s = document.createElement('script');
|
||||
s.src = $$(this).attr('src');
|
||||
$$('head').append(s);
|
||||
} else {
|
||||
eval($$(this).text());
|
||||
}
|
||||
});
|
||||
app.progressbar.hide();
|
||||
switch (pagedata.name) {
|
||||
case "settings":
|
||||
|
Loading…
x
Reference in New Issue
Block a user