Merge pull request #12759 from owncloud/core-reduce-js-and-css
make sure styles and scripts are only loaded once
This commit is contained in:
commit
891474b0d6
|
@ -76,7 +76,7 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if (isset($_['backends'][$mount['class']]['custom']) && !in_array('files_external/js/'.$_['backends'][$mount['class']]['custom'], \OC_Util::$scripts)): ?>
|
<?php if (isset($_['backends'][$mount['class']]['custom'])): ?>
|
||||||
<?php OCP\Util::addScript('files_external', $_['backends'][$mount['class']]['custom']); ?>
|
<?php OCP\Util::addScript('files_external', $_['backends'][$mount['class']]['custom']); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#adminpass').showPassword().keyup();
|
||||||
|
$('#dbpass').showPassword().keyup();
|
||||||
|
});
|
|
@ -1081,35 +1081,6 @@ function initCore() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var setShowPassword = function(input, label) {
|
|
||||||
input.showPassword().keyup();
|
|
||||||
};
|
|
||||||
setShowPassword($('#adminpass'), $('label[for=show]'));
|
|
||||||
setShowPassword($('#pass2'), $('label[for=personal-show]'));
|
|
||||||
setShowPassword($('#dbpass'), $('label[for=dbpassword]'));
|
|
||||||
|
|
||||||
var checkShowCredentials = function() {
|
|
||||||
var empty = false;
|
|
||||||
$('input#user, input#password').each(function() {
|
|
||||||
if ($(this).val() === '') {
|
|
||||||
empty = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if(empty) {
|
|
||||||
$('#submit').fadeOut();
|
|
||||||
$('#remember_login').hide();
|
|
||||||
$('#remember_login+label').fadeOut();
|
|
||||||
} else {
|
|
||||||
$('#submit').fadeIn();
|
|
||||||
$('#remember_login').show();
|
|
||||||
$('#remember_login+label').fadeIn();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// hide log in button etc. when form fields not filled
|
|
||||||
// commented out due to some browsers having issues with it
|
|
||||||
// checkShowCredentials();
|
|
||||||
// $('input#user, input#password').keyup(checkShowCredentials);
|
|
||||||
|
|
||||||
// user menu
|
// user menu
|
||||||
$('#settings #expand').keydown(function(event) {
|
$('#settings #expand').keydown(function(event) {
|
||||||
if (event.which === 13 || event.which === 32) {
|
if (event.which === 13 || event.which === 32) {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
<?php
|
||||||
|
script('core', [
|
||||||
|
'jquery-showpassword',
|
||||||
|
'installation'
|
||||||
|
]);
|
||||||
|
?>
|
||||||
<input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>
|
<input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>
|
||||||
<input type='hidden' id='hasSQLite' value='<?php p($_['hasSQLite']) ?>'>
|
<input type='hidden' id='hasSQLite' value='<?php p($_['hasSQLite']) ?>'>
|
||||||
<input type='hidden' id='hasPostgreSQL' value='<?php p($_['hasPostgreSQL']) ?>'>
|
<input type='hidden' id='hasPostgreSQL' value='<?php p($_['hasPostgreSQL']) ?>'>
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
<?php /** @var $l OC_L10N */ ?>
|
<?php /** @var $l OC_L10N */ ?>
|
||||||
<?php vendor_script('jsTimezoneDetect/jstz') ?>
|
<?php
|
||||||
|
vendor_script('jsTimezoneDetect/jstz');
|
||||||
|
script('core', [
|
||||||
|
'visitortimezone',
|
||||||
|
'lostpassword'
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
|
||||||
<!--[if IE 8]><style>input[type="checkbox"]{padding:0;}</style><![endif]-->
|
<!--[if IE 8]><style>input[type="checkbox"]{padding:0;}</style><![endif]-->
|
||||||
<form method="post" name="login">
|
<form method="post" name="login">
|
||||||
|
@ -65,8 +71,5 @@
|
||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
<?php } ?>
|
<?php }
|
||||||
|
|
||||||
<?php
|
|
||||||
OCP\Util::addscript('core', 'visitortimezone');
|
|
||||||
OCP\Util::addScript('core', 'lostpassword');
|
|
||||||
|
|
|
@ -336,7 +336,6 @@ class OC {
|
||||||
|
|
||||||
public static function initTemplateEngine() {
|
public static function initTemplateEngine() {
|
||||||
// Add the stuff we need always
|
// Add the stuff we need always
|
||||||
|
|
||||||
// following logic will import all vendor libraries that are
|
// following logic will import all vendor libraries that are
|
||||||
// specified in core/js/core.json
|
// specified in core/js/core.json
|
||||||
$fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json');
|
$fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json');
|
||||||
|
@ -351,7 +350,6 @@ class OC {
|
||||||
throw new \Exception('Cannot read core/js/core.json');
|
throw new \Exception('Cannot read core/js/core.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
OC_Util::addScript("jquery-showpassword");
|
|
||||||
OC_Util::addScript("placeholders");
|
OC_Util::addScript("placeholders");
|
||||||
OC_Util::addScript("jquery-tipsy");
|
OC_Util::addScript("jquery-tipsy");
|
||||||
OC_Util::addScript("compatibility");
|
OC_Util::addScript("compatibility");
|
||||||
|
|
|
@ -333,9 +333,9 @@ class OC_Util {
|
||||||
/**
|
/**
|
||||||
* generates a path for JS/CSS files. If no application is provided it will create the path for core.
|
* generates a path for JS/CSS files. If no application is provided it will create the path for core.
|
||||||
*
|
*
|
||||||
* @param $application application to get the files from
|
* @param string $application application to get the files from
|
||||||
* @param $directory directory withing this application (css, js, vendor, etc)
|
* @param string $directory directory withing this application (css, js, vendor, etc)
|
||||||
* @param $file the file inside of the above folder
|
* @param string $file the file inside of the above folder
|
||||||
* @return string the path
|
* @return string the path
|
||||||
*/
|
*/
|
||||||
private static function generatePath($application, $directory, $file) {
|
private static function generatePath($application, $directory, $file) {
|
||||||
|
@ -358,7 +358,10 @@ class OC_Util {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function addScript($application, $file = null) {
|
public static function addScript($application, $file = null) {
|
||||||
self::$scripts[] = OC_Util::generatePath($application, 'js', $file);
|
$path = OC_Util::generatePath($application, 'js', $file);
|
||||||
|
if (!in_array($path, self::$scripts)) {
|
||||||
|
self::$scripts[] = $path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -369,7 +372,10 @@ class OC_Util {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function addVendorScript($application, $file = null) {
|
public static function addVendorScript($application, $file = null) {
|
||||||
self::$scripts[] = OC_Util::generatePath($application, 'vendor', $file);
|
$path = OC_Util::generatePath($application, 'vendor', $file);
|
||||||
|
if (!in_array($path, self::$scripts)) {
|
||||||
|
self::$scripts[] = $path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -384,9 +390,12 @@ class OC_Util {
|
||||||
$languageCode = $l->getLanguageCode($application);
|
$languageCode = $l->getLanguageCode($application);
|
||||||
}
|
}
|
||||||
if (!empty($application)) {
|
if (!empty($application)) {
|
||||||
self::$scripts[] = "$application/l10n/$languageCode";
|
$path = "$application/l10n/$languageCode";
|
||||||
} else {
|
} else {
|
||||||
self::$scripts[] = "l10n/$languageCode";
|
$path = "l10n/$languageCode";
|
||||||
|
}
|
||||||
|
if (!in_array($path, self::$scripts)) {
|
||||||
|
self::$scripts[] = $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +407,10 @@ class OC_Util {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function addStyle($application, $file = null) {
|
public static function addStyle($application, $file = null) {
|
||||||
self::$styles[] = OC_Util::generatePath($application, 'css', $file);
|
$path = OC_Util::generatePath($application, 'css', $file);
|
||||||
|
if (!in_array($path, self::$styles)) {
|
||||||
|
self::$styles[] = $path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -409,7 +421,10 @@ class OC_Util {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function addVendorStyle($application, $file = null) {
|
public static function addVendorStyle($application, $file = null) {
|
||||||
self::$styles[] = OC_Util::generatePath($application, 'vendor', $file);
|
$path = OC_Util::generatePath($application, 'vendor', $file);
|
||||||
|
if (!in_array($path, self::$styles)) {
|
||||||
|
self::$styles[] = $path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1344,4 +1359,5 @@ class OC_Util {
|
||||||
public static function isPhpCharSetUtf8() {
|
public static function isPhpCharSetUtf8() {
|
||||||
return ini_get('default_charset') === 'UTF-8';
|
return ini_get('default_charset') === 'UTF-8';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,7 @@ function avatarResponseHandler (data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
$('#pass2').showPassword().keyup();
|
||||||
$("#passwordbutton").click(function () {
|
$("#passwordbutton").click(function () {
|
||||||
if ($('#pass1').val() !== '' && $('#pass2').val() !== '') {
|
if ($('#pass1').val() !== '' && $('#pass2').val() !== '') {
|
||||||
// Serialize the data
|
// Serialize the data
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if($_['passwordChangeSupported']) {
|
if($_['passwordChangeSupported']) {
|
||||||
|
script('jquery-showpassword');
|
||||||
?>
|
?>
|
||||||
<form id="passwordform" class="section">
|
<form id="passwordform" class="section">
|
||||||
<h2><?php p($l->t('Password'));?></h2>
|
<h2><?php p($l->t('Password'));?></h2>
|
||||||
|
|
Loading…
Reference in New Issue