From e50456264f087815131f13135f5972a3f5f4e4eb Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 17 Sep 2015 12:48:06 -0700 Subject: [PATCH] Issue #1183 Switch all CDN sources to https to prevent browser alerts. Optimization of some javascript loading. jQuery updated to 2.1.4 --- e107_admin/header.php | 4 ++-- e107_handlers/form_handler.php | 14 +++++++++++- e107_handlers/js_manager.php | 30 +++++++++----------------- e107_plugins/featurebox/e_header.php | 7 ++++-- e107_themes/bootstrap3/admin_style.css | 2 +- e107_themes/bootstrap3/admin_theme.php | 11 ++++++++-- e107_themes/bootstrap3/theme.php | 15 ++++++++++--- e107_web/js/core/admin.jquery.js | 9 ++++---- 8 files changed, 57 insertions(+), 35 deletions(-) diff --git a/e107_admin/header.php b/e107_admin/header.php index 3a72a5311..f43bb1401 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -75,10 +75,10 @@ function loadJSAddons() //e107::css('core', 'chosen/chosen.css', 'jquery'); //e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2); - e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2); + // e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2); // loaded in form-handler. // e107::css('core', 'bootstrap-tag/bootstrap-tag.css', 'jquery'); - e107::js('core', 'bootstrap-tag/bootstrap-tag.js', 'jquery', 2); +// e107::js('core', 'bootstrap-tag/bootstrap-tag.js', 'jquery', 2); // e107::js("core", "tags/jquery.tagit.js","jquery",3); diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 0544886f1..18c92c4bd 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1197,7 +1197,19 @@ class e_form $options['pattern'] = vartrue($options['pattern'],'[\S]{4,}'); $options['required'] = varset($options['required'], 1); $options['class'] = vartrue($options['class'],'e-password'); - + + + e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2); + + e107::js('footer-inline', ' + $(".e-password").pwdMeter({ + minLength: 6, + displayGeneratePassword: true, + generatePassText: "Generate", + randomPassLength: 12 + }); + '); + if(deftrue('BOOTSTRAP') == 3) { $options['class'] .= ' form-control'; diff --git a/e107_handlers/js_manager.php b/e107_handlers/js_manager.php index 611443859..9536606b1 100644 --- a/e107_handlers/js_manager.php +++ b/e107_handlers/js_manager.php @@ -44,7 +44,8 @@ class e_jsmanager // "http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js" // "http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js", // "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" - "http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" + // "http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" + "https://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js" // , // "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js", // "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/jquery-ui.css", @@ -240,26 +241,15 @@ class e_jsmanager if($this->isInAdmin()) // Include jquery-ui in the admin-area only - Jquery-UI to eventually be removed from e107 completely if possible. { + $this->_libraries['jquery'] = array( + "https://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js", + "https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.js", + "https://cdn.jsdelivr.net/jquery.ui/1.11.4/themes/smoothness/jquery-ui.min.css" + ); - if(e107::getPref('admintheme')=='bootstrap3') // Bootstrap 3 admin area. - { - $this->_libraries['jquery'] = array( - "http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js", - "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js", - "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css", - // "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js", - // "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/jquery-ui.css", - ); - } - else // Bootstrap 2 admin area. - { - $this->_libraries['jquery'] = array( - "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js", - "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js", - "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/jquery-ui.css", - ); - } - + // "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js", + // "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css", + //https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.css } if(isset($_SERVER['E_DEV_LOCALJS']) && $_SERVER['E_DEV_LOCALJS'] === 'true') // Test with Local JS Framework files. diff --git a/e107_plugins/featurebox/e_header.php b/e107_plugins/featurebox/e_header.php index 3f8dd3921..d6d2f7453 100644 --- a/e107_plugins/featurebox/e_header.php +++ b/e107_plugins/featurebox/e_header.php @@ -1,6 +1,9 @@ \ No newline at end of file diff --git a/e107_themes/bootstrap3/admin_style.css b/e107_themes/bootstrap3/admin_style.css index 6467769ab..78810ebf6 100644 --- a/e107_themes/bootstrap3/admin_style.css +++ b/e107_themes/bootstrap3/admin_style.css @@ -160,7 +160,7 @@ td.options .btn-group { display: flex; } #admin-ui-modal { width: 90%; } - +.editable-input .form-control { width:300px } /* x-editable */ diff --git a/e107_themes/bootstrap3/admin_theme.php b/e107_themes/bootstrap3/admin_theme.php index 75c082771..45a2ccb5c 100644 --- a/e107_themes/bootstrap3/admin_theme.php +++ b/e107_themes/bootstrap3/admin_theme.php @@ -5,9 +5,16 @@ define("SEP"," "); define("BOOTSTRAP", 3); define('FONTAWESOME', 4); -e107::js("url", "http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js",'jquery', 2); + + +// e107::js("url", "https://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js",'jquery', 2); // e107::css('url', 'http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'); -e107::css('url', "http://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"); +// e107::css('url', "https://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"); + +e107::js("url", "https://cdn.jsdelivr.net/bootstrap/3.3.5/js/bootstrap.min.js", 'jquery', 2); +// e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.5/css/bootstrap.min.css'); +e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.4.0/css/font-awesome.min.css'); + // Too slow. // e107::css('url', "http://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css"); diff --git a/e107_themes/bootstrap3/theme.php b/e107_themes/bootstrap3/theme.php index 1035cb6cc..2dd1c5320 100644 --- a/e107_themes/bootstrap3/theme.php +++ b/e107_themes/bootstrap3/theme.php @@ -8,9 +8,18 @@ define("BOOTSTRAP", 3); define("FONTAWESOME", 4); define('VIEWPORT', "width=device-width, initial-scale=1.0"); -e107::js("url", "http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"); -e107::css('url', 'http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'); -e107::css('url', "http://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"); +//e107::js("url", "https://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"); +//e107::css('url', 'https://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'); +// e107::css('url', "https://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"); + +// @see https://www.cdnperf.com +// Warning: Some bootstrap CDNs are not compiled with popup.js +// use https if e107 is using https. +e107::js("url", "https://cdn.jsdelivr.net/bootstrap/3.3.5/js/bootstrap.min.js", 'jquery', 2); +e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.5/css/bootstrap.min.css'); +e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.4.0/css/font-awesome.min.css'); + + e107::js("footer-inline", "$('.e-tip').tooltip({container: 'body'})"); // activate bootstrap tooltips. diff --git a/e107_web/js/core/admin.jquery.js b/e107_web/js/core/admin.jquery.js index c8b3fcae3..535f2dad3 100644 --- a/e107_web/js/core/admin.jquery.js +++ b/e107_web/js/core/admin.jquery.js @@ -88,7 +88,7 @@ $(document).ready(function() $('div.e-container').editable({ - selector: '.e-editable', + selector: '.e-editable' }); // $('.e-editable').editable(); @@ -417,7 +417,7 @@ $(document).ready(function() }); - $(".e-tags").tag(); + // $(".e-tags").tag(); @@ -461,12 +461,13 @@ $(document).ready(function() } // backend - $(".e-password").pwdMeter({ + /* + $(".e-password").pwdMeter({ minLength: 6, displayGeneratePassword: true, generatePassText: "Generate", randomPassLength: 12 - }); + });*/