mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 10:23:17 +00:00
refactor code
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input id="label_off" onkeyup="inputChanged(this);return(false);" name="label_off"
|
<input id="label_off" onkeyup="inputChanged(this);return(false);" name="label_off"
|
||||||
class="input-xlarge invalid" type="text" value="{{ status['labeloff'] }}">
|
class="input-xlarge" type="text" value="{{ status['labeloff'] }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input id="label_on" onkeyup="inputChanged(this);return(false);" name="label_on"
|
<input id="label_on" onkeyup="inputChanged(this);return(false);" name="label_on"
|
||||||
class="input-xlarge invalid" type="text" value="{{ status['labelon'] }}">
|
class="input-xlarge" type="text" value="{{ status['labelon'] }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
@@ -168,22 +168,23 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function inputChanged(elem) {
|
function inputChanged(elem) {
|
||||||
var validText = new RegExp(/[!@#$%^&*()]+/);
|
|
||||||
if ($(elem).val().length > 0) {
|
if ($(elem).val().length > 0) {
|
||||||
//check if contains special characters
|
//check if contains special characters
|
||||||
if (validText.test($(elem).val())) {
|
if (isInvalid($(elem).val())) {
|
||||||
$(elem).css('border-color', '#F00');
|
$(elem).css('border-color', '#F00');
|
||||||
$(elem).addClass('invalid');
|
|
||||||
} else {
|
} else {
|
||||||
$(elem).css('border-color', '');
|
$(elem).css('border-color', '');
|
||||||
$(elem).removeClass('invalid')
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$(elem).css('border-color', '#F00');
|
$(elem).css('border-color', '#F00');
|
||||||
$(elem).addClass('invalid');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isInvalid(string) {
|
||||||
|
var validText = new RegExp(/[!@#$%^&*()]+/);
|
||||||
|
return validText.test(string);
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
var selected_files = [];
|
var selected_files = [];
|
||||||
|
|
||||||
@@ -238,7 +239,7 @@ $(document).ready(function(){
|
|||||||
$("[name=label_on]").css('border-color', '#F00');
|
$("[name=label_on]").css('border-color', '#F00');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($("[name=label_off]").hasClass('invalid') || $("[name=label_on]").hasClass('invalid')) {
|
if (isInvalid($("[name=label_off]").val()) || isInvalid($("[name=label_on]").val())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( selected_files.length > 0 ) {
|
if( selected_files.length > 0 ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user