dcsimg
www.webdeveloper.com
Results 1 to 10 of 10

Thread: Help with Javascript running on Firefox

  1. #1
    Join Date
    Sep 2017
    Posts
    5

    Help with Javascript running on Firefox

    I am new to Javascript and so I am starting with running scripts un Firefox. I installed Seamonkey and I did get one script to run. It was touchy, but in the morning it finally ran, but I am trying to get this script to run. Apparently others had no trouble. I was hoping someopne could look it over and tell me if they see any reason why it is not working. I am using seamopnkey 3.11 on Firefox 55.0 32 bit.

    Well the script is supposed to Auto Endorse all of the LinkedIn connections. It is a real chore to have to manually go through each connection and endorse each skill they have. Many of them have over 50 skills to be endorsed. The script does not do that, but I do not know why. Could someone look it over and tell me what may be the reason it is not doing that? Thank You
    Here it is:

    (function () {
    var csrfToken = $('[name="csrfToken"]').val();

    $.getJSON('https://www.linkedin.com/hp/modules/ozfeed/promo/endorsements/fetch?offset=0&count=500', function (response) {
    var endorsements = response.endorsements;

    console.log('found ' + endorsements.length + ' endorsements');

    function endorse (callback) {
    var endorsement = endorsements.shift();

    if (!endorsement) {
    return console.log('done');
    }

    console.log('endorsing "' + endorsement.endorsee.fullName + '" for "' + endorsement.skillName + '"');

    $.post('https://www.linkedin.com/hp/modules/ozfeed/promo/endorsements/accept', {
    csrfToken: csrfToken,
    signature: endorsement.signature
    }, function (response) {
    setTimeout(function () {
    endorse();
    }, 4000 + Math.random() * 2000)
    });
    }

    endorse();
    });
    })();

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    4,973
    Thats not JavaScript, its a JQuery type framework and belong in the JavaScript frameworks forum.

    Moved.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  3. #3
    Join Date
    Sep 2017
    Posts
    5
    I am new to coding and I had no idea that was jQuery. I do know that I was told before that it was Javascript. Nevertheless; I would like to know how to get that code to run in firefox.

  4. #4
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    4,973
    Unless you include the JQuery library in the web page, you won't have a working code.

    JQuery is written in JavaScript, it is not JavaScript, there are different libraries for development, most people I know call them frameworks because you build a website functionality out of the framework (library) with a script written in mostly the frameworks own structure and some JavaScript.

    You only need look up adding JQuery to your site to get about 1.9 million results.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  5. #5
    Join Date
    Sep 2017
    Posts
    5
    Because it is LinkedIn; I cannot add jQuery to their site. It would have to be something I could add to my own browser. Is it possible to run this jQuery on just my own browser?

    Maybe that is what you meant? So are you saying I need to add jQuery libraries to my browser and then the code will work?

  6. #6
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    4,973
    All browsers have to include JQuery, like JavaScript, it is client side code meaning it only runs in the browser.

    You only need search for how to add JQuery library / framework to your page then JQuery scripts will run... However... It is sounding more like you need to be building a browser tool (like extensions and add ons) to do the job you want doing.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  7. #7
    Join Date
    Sep 2017
    Posts
    5
    Well, I just want to find a way to make the code I posted above work as applied to my LinkedIn page. I did see jQuery extensions/addons to be added to websites. The Firefox ones are outdated and will not work on Firefox 55.0 I may have to use Chrome and use an extension designed for Chrome. But what I would then need to know is; How do I apply this jQuery code above? When I was applying Javascript codes I pasted the code into a .txt file and renamed it with a random prefix like Sammy for example; sammy.user.js Then I opened the file using firefox.

    What would the file extension be if it is jQuery? Would I use the same file extension?

  8. #8
    Join Date
    Oct 2013
    Location
    Sheboygan, Wisconsin
    Posts
    1,485
    Example:
    sammyjquery.js

    Makes for easier troubleshooting.

  9. #9
    Join Date
    Sep 2017
    Posts
    5
    Just to be sure; in your example, does the word jquery have to be in that name? So would it have to be sammyjquery.js? if sammy is connected to jquery; would the system know to distinguish between sammy and jquery? Or would there have to be a period in between sammy and jquery like sammy.jquery.js?

  10. #10
    Join Date
    Oct 2013
    Location
    Sheboygan, Wisconsin
    Posts
    1,485
    Believe me, you will want to be able to ID the jquery quickly, as 90+% of the time I had to make changes in it. And only there.

    If both work, use what you like. Just use the same convention through out you site.

    sammyjquery.js is my preference.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles