Comments (9)
Also this: #40 (comment)
To get the certificate to be accepted and the script to work I had to change 127.0.0.1 to mycode.com in all .js
Hope it helps...
from django-3-by-example.
from django-3-by-example.
Tried nothing happens.
here is my bookmarklet.js
(function(){
var jquery_version = '3.4.1';
var site_url = 'https://127.0.0.1:8000/';
var static_url = site_url + 'static/';
var min_width = 100;
var min_height = 100;
function bookmarklet(msg) {
// load CSS
var css = jQuery('<link>');
css.attr({
rel: 'stylesheet',
type: 'text/css',
href: static_url + 'css/bookmarklet.css?r=' + Math.floor(Math.random()*99999999999999999999)
});
jQuery('head').append(css);
// load HTML
box_html = '<div id="bookmarklet"><a href="#" id="close">×</a><h1>Select an image to bookmark:</h1><div class="images"></div></div>';
jQuery('body').append(box_html);
// close event
jQuery('#bookmarklet #close').click(function(){
jQuery('#bookmarklet').remove();
});
// find images and display them
jQuery.each(jQuery('img[src$="jpg"]'), function(index, image) {
if (jQuery(image).width() >= min_width && jQuery(image).height()
>= min_height)
{
image_url = jQuery(image).attr('src');
jQuery('#bookmarklet .images').append('<a href="#"><img src="'+
image_url +'" /></a>');
}
});
// when an image is selected open URL with it
jQuery('#bookmarklet .images a').click(function(e){
selected_image = jQuery(this).children('img').attr('src');
// hide bookmarklet
jQuery('#bookmarklet').hide();
// open new window to submit the image
window.open(site_url +'images/create/?url='
+ encodeURIComponent(selected_image)
+ '&title='
+ encodeURIComponent(jQuery('title').text()),
'_blank');
});
};
// Check if jQuery is loaded
if(typeof window.jQuery != 'undefined') {
bookmarklet();
} else {
// Check for conflicts
var conflict = typeof window.$ != 'undefined';
// Create the script and point to Google API
var script = document.createElement('script');
script.src = '//ajax.googleapis.com/ajax/libs/jquery/' +
jquery_version + '/jquery.min.js';
// Add the script to the 'head' for processing
document.head.appendChild(script);
// Create a way to wait until script loading
var attempts = 15;
(function(){
// Check again if jQuery is undefined
if(typeof window.jQuery == 'undefined') {
if(--attempts > 0) {
// Calls himself in a few milliseconds
window.setTimeout(arguments.callee, 250)
} else {
// Too much attempts to load, send error
alert('An error occurred while loading jQuery')
}
} else {
bookmarklet();
}
})();
}
})()
from django-3-by-example.
I had the same issue.
In my case I had split a template tag into multiple lines and Django doesn't support multiple line tags.
Check in account/dashboard.html template and make sure you haven't split {% include "bookmarklet_launcher.js" %} tag into multiple lines.
from django-3-by-example.
Are you sure if your file was loaded? You should check in console explorer if you have an error.
from django-3-by-example.
I had the same issue as well, and it turned out that I had forgotten a single '. How to find such a bug? Open the browser console and clear if possible. Then click on the "Bookmark it!" link in the bookmarks toolbar. Then look at the console again. The output might help you to locate your error, in case there is one.
from django-3-by-example.
Check that css fonts served over HTTPS
from django-3-by-example.
For me bookmark toolbar doesn't appear. Please could someone help. I have gone through all added files but can't trace where is the problem.
from django-3-by-example.
from django-3-by-example.
Related Issues (20)
- No Order matches the given query. Chapter 8 HOT 1
- Chapter 5 bookmarklet_launcher.js
- Chapter 8: Importing weasyprint HOT 2
- chapter 5 - automatic paginator not working HOT 1
- Chapter 5 Bookmarks problem with <li {% if section == 'dashboard' %} class="selected"> HOT 2
- chapter myshop
- Chapter 6 migrations Contact
- Chapter 4 Unable to Run 'runserver_plus' HOT 1
- Valid OAuth Redirect URIs (URL Blocked)
- Chapter 13 Django Chat
- the celerys task is deprecated.
- Chapter 1: AttributeError: Manager isnβt accessible via <<models>> instances
- Chapter 1 Ommissions
- Chapter 7: context processor doesn't work
- chapter 2 errors: "no such colum: blog_post.tags" and "cannot query "jazz": Must be "Post" instance". HOT 5
- Chapter 8 - Braintree Token Generation
- Chapter 7: Product Detail page does not dynamically link product data (stays static) HOT 1
- Chapter 6 - signals not working HOT 1
- Chapter 4: unable to send e-mail address to reset password
- Chapter 2 - Problem with URL NotFound due to timezone mismatch HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-3-by-example.