Separate scripts from html & New rendering function

This commit is contained in:
Flat 2016-07-02 19:51:56 +09:00
commit e16e92278b
84 changed files with 848 additions and 1280 deletions

View file

@ -32,18 +32,7 @@
<form id="vstobjects" method="post" name="v_edit_user" class="<?=$v_status?>">
<input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
<input type="hidden" name="save" value="save" />
<script type="text/javascript">
function randomString() {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 10;
var randomstring = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
document.v_edit_user.v_password.value = randomstring;
}
</script>
<table class='data'>
<tr class="data-add">
<td class="data-dotted">
@ -106,7 +95,7 @@
}
echo ">".htmlentities($key)."</option>\n";
}
?>
?>
</select>
</td>
</tr>
@ -130,7 +119,7 @@
}
echo ">".htmlentities($value)."</option>\n";
}
?>
?>
</select>
</td>
</tr>
@ -171,7 +160,7 @@
}
echo ">".htmlentities($value)."</option>\n";
}
?>
?>
</select>
</td>
</tr>
@ -264,33 +253,3 @@
</table>
</form>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('.add-ns-button').click(function(){
var n = $("input[name^=v_ns]").length;
if(n < 8){
var t = $($('input[name=v_ns1]').parents('tr')[0]).clone(true, true);
t.find('input').attr({value:'', name:'v_ns'+(n+1)});
t.find('span').show();
$('tr.add-ns').before(t);
}
if( n == 7 ) {
$('.add-ns').hide();
}
});
$('.remove-ns').click(function(){
$(this).parents('tr')[0].remove();
$('input[name^=v_ns]').each(function(i, ns){
$(ns).attr({name: 'v_ns'+(i+1)});
i < 2 ? $(ns).parent().find('span').hide() : $(ns).parent().find('span').show();
})
$('.add-ns').show()
})
$('input[name^=v_ns]').each(function(i, ns){
i < 2 ? $(ns).parent().find('span').hide() : $(ns).parent().find('span').show();
})
});
</script>