load showpassord.js conditionally in the template only if needed

This commit is contained in:
Thomas Müller 2014-12-10 16:59:03 +01:00 committed by Morris Jobke
parent 3cc33a98a8
commit 51a22431ee
6 changed files with 13 additions and 31 deletions

5
core/js/installation.js Normal file
View File

@ -0,0 +1,5 @@
$(document).ready(function() {
$('#adminpass').showPassword().keyup();
$('#dbpass').showPassword().keyup();
});

View File

@ -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
$('#settings #expand').keydown(function(event) {
if (event.which === 13 || event.which === 32) {

View File

@ -1,3 +1,9 @@
<?php
script('core', [
'jquery-showpassword',
'installation'
]);
?>
<input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>
<input type='hidden' id='hasSQLite' value='<?php p($_['hasSQLite']) ?>'>
<input type='hidden' id='hasPostgreSQL' value='<?php p($_['hasPostgreSQL']) ?>'>

View File

@ -336,7 +336,6 @@ class OC {
public static function initTemplateEngine() {
// Add the stuff we need always
// following logic will import all vendor libraries that are
// specified in 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');
}
OC_Util::addScript("jquery-showpassword");
OC_Util::addScript("placeholders");
OC_Util::addScript("jquery-tipsy");
OC_Util::addScript("compatibility");

View File

@ -157,6 +157,7 @@ function avatarResponseHandler (data) {
}
$(document).ready(function () {
$('#pass2').showPassword().keyup();
$("#passwordbutton").click(function () {
if ($('#pass1').val() !== '' && $('#pass2').val() !== '') {
// Serialize the data

View File

@ -63,6 +63,7 @@
<?php
if($_['passwordChangeSupported']) {
script('jquery-showpassword');
?>
<form id="passwordform" class="section">
<h2><?php p($l->t('Password'));?></h2>