From 0b03f91f1c37d87b68049b5d94cf889d6c745ca7 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Mon, 9 Jan 2012 20:45:30 -0500 Subject: [PATCH] Fixed the new upload form. Changed it over to use jQuery since shimmie has that already. Works with FF, Chrome, and IE 7 now. --- ext/upload/theme.php | 110 +++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 41 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 4d701eea..1b13bf9e 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -15,59 +15,87 @@ class UploadTheme extends Themelet { // Uploader 2.0! $upload_list = ""; - for($i=0; $i<$config->get_int('upload_count'); $i++) { + for($i=0; $i<$config->get_int('upload_count'); $i++) + { $a=$i+1; $s=$i-1; + if(!$i==0){ $upload_list .=""; }else{ $upload_list .= ""; - } - $upload_list .= ""; - - if($i==0){ - $upload_list .= "
" . - "". - "
"; - }else{ - $upload_list .="
- ". - ""; - if($a==$config->get_int('upload_count')){ - $upload_list .=""; - }else{ - $upload_list .= - "". - ""; - } - $upload_list .= "
"; - } + } + + $upload_list .= ""; + if($i==0){ + $js = 'javascript:$(function() { + $("#row'.$a.'").show(); + $("#hide'.$i.'").hide(); + $("#hide'.$a.'").show();});'; + + $upload_list .= "
" . + "". + "
"; + } else { + $js = 'javascript:$(function() { + $("#row'.$i.'").hide(); + $("#hide'.$i.'").hide(); + $("#hide'.$s.'").show(); + $("#data'.$i.'").val(""); + $("#url'.$i.'").val(""); + });'; + + $upload_list .="
+ ". + ""; + + if($a==$config->get_int('upload_count')){ + $upload_list .=""; + }else{ + $js1 = 'javascript:$(function() { + $("#row'.$a.'").show(); + $("#hide'.$i.'").hide(); + $("#hide'.$a.'").show(); });'; + $upload_list .= - "
File
"; - if($tl_enabled) { - $upload_list .= - " URL
+ "". + ""; + } + $upload_list .= "
"; + } - - "; - } - else { - $upload_list .= " - - "; - } + $js2 = 'javascript:$(function() { + $("#url'.$i.'").show(); + $("#url'.$i.'").val(""); + $("#data'.$i.'").show(); });'; + + $upload_list .= + " File
"; + + if($tl_enabled) { + $js = 'javascript:$(function() { + $("#data'.$i.'").hide(); + $("#data'.$i.'").val(""); + $("#url'.$i.'").show(); });'; + + $upload_list .= + " URL + + + + "; + } else { + $upload_list .= " + + "; + } $upload_list .= " "; } + $max_size = $config->get_int('upload_size'); $max_kb = to_shorthand_int($max_size); $html = " @@ -86,7 +114,7 @@ class UploadTheme extends Themelet { }); }); - ".make_form(make_link("upload"), "POST", $multipart=True)." + ".make_form(make_link("upload"), "POST", $multipart=True, 'file_upload')." $upload_list @@ -109,7 +137,7 @@ class UploadTheme extends Themelet { } { $js='javascript:(function(){if(typeof window=="undefined"||!window.location||window.location.href=="about:blank"){window.location="'. $main_page .'";}else if(typeof document=="undefined"||!document.body){window.location="'. $main_page .'?url="+encodeURIComponent(window.location.href);} else if(window.location.href.match("\/\/'. $_SERVER["HTTP_HOST"] .'.*")){alert("You are already at '. $title .'!");} else{var tags=prompt("Please enter tags","tagme");if(tags!=""&&tags!=null){var link="'. $link . $delimiter .'url="+location.href+"&tags="+tags;var w=window.open(link,"_blank");}}})();'; - $html .= '

Upload to '.$title.' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; + $html .= '

Upload to '.$title.' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; } { /* Danbooru > Shimmie Bookmarklet.

Tags