From f93b86261eac078599d7773ea913f388d80f9d26 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Sun, 8 Jan 2012 13:23:39 -0500 Subject: [PATCH] Small feature for uploading using a bookmark. --- ext/upload/theme.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index a86d6f58..0c5b0686 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -63,7 +63,8 @@ class UploadTheme extends Themelet { if($tl_enabled) { $link = make_http(make_link("upload")); - $title = "Upload to " . $config->get_string('title'); + $home = make_http(make_link()); + $title = $config->get_string('title'); if($config->get_bool('nice_urls')){ $delimiter = '?'; @@ -71,9 +72,9 @@ class UploadTheme extends Themelet { $delimiter = '&'; } - $html .= '

' . - $title . ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; + $js='javascript:(function(){if(typeof window=="undefined"||!window.location||window.location.href=="about:blank"){window.location="'. $home .'";}else if(typeof document=="undefined"||!document.body){window.location="'. $home .'?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)'; } $page->set_title("Upload");