";
}
return $upload_list;
}
protected function h_bookmarklets(): string
{
global $config;
$link = make_http(make_link("upload"));
$main_page = make_http(make_link());
$title = $config->get_string('title');
$max_size = $config->get_int('upload_size');
$max_kb = to_shorthand_int($max_size);
$delimiter = $config->get_bool('nice_urls') ? '?' : '&';
$html = '';
$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.'';
$html .= ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)';
// Bookmarklet checks if shimmie supports ext. If not, won't upload to site/shows alert saying not supported.
$supported_ext = "jpg jpeg gif png webp";
if (class_exists("FlashFileHandler")) {
$supported_ext .= " swf";
}
if (class_exists("ICOFileHandler")) {
$supported_ext .= " ico ani cur";
}
if (class_exists("MP3FileHandler")) {
$supported_ext .= " mp3";
}
if (class_exists("SVGFileHandler")) {
$supported_ext .= " svg";
}
if (class_exists("VideoFileHandler")) {
$supported_ext .= " flv mp4 ogv webm m4v";
}
$title = "Booru to " . $config->get_string('title');
// CA=0: Ask to use current or new tags | CA=1: Always use current tags | CA=2: Always use new tags
$html .= '
'. $title . ' (Click when looking at an image page. Works on sites running Shimmie / Danbooru / Gelbooru. (This also grabs the tags / rating / source!))';
return $html;
}
/**
* Only allows 1 file to be uploaded - for replacing another image file.
*/
public function display_replace_page(Page $page, int $image_id)
{
global $config, $page;
$tl_enabled = ($config->get_string("transload_engine", "none") != "none");
$upload_list = "