Git Product home page Git Product logo

Comments (9)

timotif avatar timotif commented on August 26, 2024 1

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.

pcodesdev avatar pcodesdev commented on August 26, 2024

from django-3-by-example.

hackeraks avatar hackeraks commented on August 26, 2024

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">&times;</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.

Faizan-e-Muhammad97 avatar Faizan-e-Muhammad97 commented on August 26, 2024

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.

alfonsovgs avatar alfonsovgs commented on August 26, 2024

Are you sure if your file was loaded? You should check in console explorer if you have an error.

from django-3-by-example.

jrdjango avatar jrdjango commented on August 26, 2024

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.

vlasove avatar vlasove commented on August 26, 2024

Check that css fonts served over HTTPS

from django-3-by-example.

devMunyi avatar devMunyi commented on August 26, 2024

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.

devMunyi avatar devMunyi commented on August 26, 2024

image

from django-3-by-example.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.