diff --git a/cookbook/static/js/bookmarklet.js b/cookbook/static/js/bookmarklet.js new file mode 100644 index 000000000..8558f5845 --- /dev/null +++ b/cookbook/static/js/bookmarklet.js @@ -0,0 +1,37 @@ +(function(){ + + var v = "1.3.2"; + + if (window.jQuery === undefined || window.jQuery.fn.jquery < v) { + var done = false; + var script = document.createElement("script"); + script.src = "https://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js"; + script.onload = script.onreadystatechange = function(){ + if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) { + done = true; + initBookmarklet(); + } + }; + document.getElementsByTagName("head")[0].appendChild(script); + } else { + initBookmarklet(); + } + function initBookmarklet() { + (window.bookmarkletTandoor = function() { + r = confirm('Click OK to import recipe automatically, click Cancel to import the recipe manually.'); + if (r) { + auto=true + } else { + auto=false + } + + var newIframe = document.createElement('iframe'); + newIframe.width = '200';newIframe.height = '200'; + newIframe.src = localStorage.getItem('importURL'); + document.body.appendChild(newIframe); + + + } + )(); + } +})(); diff --git a/cookbook/templates/url_import.html b/cookbook/templates/url_import.html index e51c8cd09..dbc5c25ab 100644 --- a/cookbook/templates/url_import.html +++ b/cookbook/templates/url_import.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load i18n %} {% load static %} +{% load custom_tags %} {% block title %}{% trans 'URL Import' %}{% endblock %} @@ -20,9 +21,15 @@ {% endblock %} {% block content %} -
-

{% trans 'Import' %}

+
+

{% trans 'Import' %}

+ + {% trans 'Bookmark Me!' %} +