more jquery magic, less inline scripting

This commit is contained in:
Shish 2012-02-09 14:45:18 +00:00
parent 8d15ae8c0a
commit 339f2b0497
6 changed files with 8 additions and 43 deletions

View file

@ -33,7 +33,7 @@ EOD
$search_html = "
<div class='space' id='search'>
<form action='".make_link("post/list")."' method='GET'>
<input id='search_input' name='search' size='30' type='text' value='' autocomplete='off' />
<input name='search' size='30' type='text' value='' class='autocomplete_tags' />
<input type='hidden' name='q' value='/post/list'>
<input type='submit' value='Search'/>
</form>

View file

@ -80,8 +80,7 @@ and of course start organising your images :-)
$h_search_link = make_link();
$h_search = "
<p><form action='$h_search_link' method='GET'>
<input class='tag_autocomplete search_input' id='search_input' name='search' type='text'
value='$h_search_string' autocomplete='off' />
<input class='autocomplete_tags' name='search' type='text' placeholder='Search' value='$h_search_string' />
<input type='hidden' name='q' value='/post/list'>
<input type='submit' value='Find' style='display: none;' />
</form>

View file

@ -24,7 +24,7 @@ class TagEditTheme extends Themelet {
return "
<tr>
<td width='50px'>Tags</td>
<td width='300px'><input type='text' name='tag_edit__tags' value='$h_tags' class='tag_autocomplete' id='tag_editor'></td>
<td width='300px'><input type='text' name='tag_edit__tags' value='$h_tags' class='autocomplete_tags' id='tag_editor'></td>
</tr>
";
}

View file

@ -103,25 +103,10 @@ class UploadTheme extends Themelet {
$max_size = $config->get_int('upload_size');
$max_kb = to_shorthand_int($max_size);
$html = "
<script type='text/javascript'>
$(document).ready(function() {
$('#tag_box').DefaultValue('tagme');
$('#tag_box').autocomplete('".make_link("api/internal/tag_list/complete")."', {
width: 320,
max: 15,
highlight: false,
multiple: true,
multipleSeparator: ' ',
scroll: true,
scrollHeight: 300,
selectFirst: false
});
});
</script>
".make_form(make_link("upload"), "POST", $multipart=True, 'file_upload')."
<table id='large_upload_form' class='vert'>
$upload_list
<tr><td></td><td>Tags<td colspan='3'><input id='tag_box' name='tags' type='text'></td></tr>
<tr><td></td><td>Tags<td colspan='3'><input name='tags' type='text' placeholder='tagme' class='autocomplete_tags'></td></tr>
<tr><td></td><td>Source</td><td colspan='3'><input name='source' type='text'></td></tr>
<tr><td colspan='4'><input id='uploadbutton' type='submit' value='Post'></td></tr>
</table>
@ -258,24 +243,9 @@ class UploadTheme extends Themelet {
$max_kb = to_shorthand_int($max_size);
// <input type='hidden' name='max_file_size' value='$max_size' />
return "
<script type='text/javascript'>
$(document).ready(function() {
$('#tag_input').DefaultValue('tagme');
$('#tag_input').autocomplete('".make_link("api/internal/tag_list/complete")."', {
width: 320,
max: 15,
highlight: false,
multiple: true,
multipleSeparator: ' ',
scroll: true,
scrollHeight: 300,
selectFirst: false
});
});
</script>
".make_form(make_link("upload"), "POST", $multipart=True)."
$upload_list
<input id='tag_input' name='tags' type='text' autocomplete='off'>
<input name='tags' type='text' placeholder='tagme' class='autocomplete_tags'>
<input type='submit' value='Post'>
</form>
<div id='upload_completions' style='clear: both;'><small>(Max file size is $max_kb)</small></div>
@ -283,4 +253,4 @@ class UploadTheme extends Themelet {
";
}
}
?>
?>

View file

@ -29,7 +29,7 @@ $(document).ready(function() {
$("time").timeago();
$('.search_input').DefaultValue('Search');
$('.tag_autocomplete').autocomplete(base_href + '/api/internal/tag_list/complete', {
$('.autocomplete_tags').autocomplete(base_href + '/api/internal/tag_list/complete', {
width: 320,
max: 15,
highlight: false,
@ -43,9 +43,6 @@ $(document).ready(function() {
var sections=get_sections();
for(var i=0;i<sections.length;i++) toggle(sections[i]);
$("#commentBox").DefaultValue("Comment");
$("#tagBox").DefaultValue("tagme");
if(document.location.hash.length > 3) {
query = document.location.hash.substring(1);
a = document.getElementById(\"prevlink\");

View file

@ -39,8 +39,7 @@ class CustomIndexTheme extends IndexTheme {
$h_search_link = make_link();
$h_search = "
<p><form action='$h_search_link' method='GET'>
<input name='search' type='text'
value='$h_search_string' autocomplete='off' />
<input name='search' type='text' value='$h_search_string' class='autocomplete_tags' placeholder='Search' />
<input type='hidden' name='q' value='/post/list'>
<input type='submit' value='Find' style='display: none;' />
</form>