added bookmarklet

This commit is contained in:
albert
2011-09-29 16:23:27 -04:00
parent 895ae18160
commit 8235cee8a9
4 changed files with 14 additions and 4 deletions

View File

@@ -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() {

View File

@@ -0,0 +1,9 @@
<div id="c-static">
<div id="a-boomkarklet">
<h1>Bookmarklet</h1>
<p><%= link_to "Post to Danbooru", "javascript:location.href='http://#{Danbooru.config.hostname}/uploads/new?url='+encodeURIComponent(location.href)+'&ref='+encodeURIComponent(document.referrer)" %></p>
<p>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.</p>
</div>
</div>

View File

@@ -11,7 +11,7 @@
</ul>
<ul>
<li><h1>Tools</h1></li>
<li><%= link_to("Bookmarklet", wiki_pages_path(:title => "help:bookmarklet")) %></li>
<li><%= link_to("Bookmarklet", bookmarklet_path %></li>
<li><%= link_to("API Documentation", wiki_pages_path(:title => "help:api")) %></li>
</ul>
<ul>

View File

@@ -150,8 +150,9 @@ Danbooru::Application.routes.draw do
resources :ftopics, :controller => "forum_topics"
resources :fposts, :controller => "forum_posts"
match "/site_map" => "static#site_map", :as => "site_map"
match "/terms_of_service" => "static#terms_of_service", :as => "terms_of_service"
match "/static/bookmarklet" => "static#bookmarklet", :as => "bookmarklet"
match "/static/site_map" => "static#site_map", :as => "site_map"
match "/static/terms_of_service" => "static#terms_of_service", :as => "terms_of_service"
root :to => "posts#index"
end