From 8235cee8a95dbb15903423a02e8f8e86409c7fa4 Mon Sep 17 00:00:00 2001 From: albert Date: Thu, 29 Sep 2011 16:23:27 -0400 Subject: [PATCH] added bookmarklet --- app/assets/javascripts/common.js | 2 +- app/views/static/bookmarklet.html.erb | 9 +++++++++ app/views/static/site_map.html.erb | 2 +- config/routes.rb | 5 +++-- 4 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 app/views/static/bookmarklet.html.erb diff --git a/app/assets/javascripts/common.js b/app/assets/javascripts/common.js index 3b808e410..a978d9431 100644 --- a/app/assets/javascripts/common.js +++ b/app/assets/javascripts/common.js @@ -46,7 +46,7 @@ $(document).ready(function() { if (!location.href.match(/terms_of_service/) && Danbooru.Cookie.get("tos") !== "1") { // Setting location.pathname in Safari doesn't work, so manually extract the domain. var domain = location.href.match(/^(http:\/\/[^\/]+)/)[0]; - location.href = domain + "/terms_of_service?url=" + location.href; + location.href = domain + "/static/terms_of_service?url=" + location.href; } $("#tos-agree-link").click(function() { diff --git a/app/views/static/bookmarklet.html.erb b/app/views/static/bookmarklet.html.erb new file mode 100644 index 000000000..ce3ef64e5 --- /dev/null +++ b/app/views/static/bookmarklet.html.erb @@ -0,0 +1,9 @@ +
+
+

Bookmarklet

+ +

<%= link_to "Post to Danbooru", "javascript:location.href='http://#{Danbooru.config.hostname}/uploads/new?url='+encodeURIComponent(location.href)+'&ref='+encodeURIComponent(document.referrer)" %>

+ +

Bookmark this link. Next time you are directly viewing an image (that is, the JPG/PNG/GIF file is in the URL bar) you can open this bookmarklet and you will be taken to the upload page. Depending on the site you are uploading from you may also see some options for fetching metadata.

+
+
diff --git a/app/views/static/site_map.html.erb b/app/views/static/site_map.html.erb index d997ae910..9f99610d9 100644 --- a/app/views/static/site_map.html.erb +++ b/app/views/static/site_map.html.erb @@ -11,7 +11,7 @@