Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script that works in Tampermonkey doesn't in Violentmonkey. #172

Closed
Betsy25 opened this issue Aug 11, 2017 · 1 comment
Closed

Script that works in Tampermonkey doesn't in Violentmonkey. #172

Betsy25 opened this issue Aug 11, 2017 · 1 comment

Comments

@Betsy25
Copy link

Betsy25 commented Aug 11, 2017

What is the problem?

Some scripts that do work in Tampermonkey, don't in Violentmonkey. (One of them posted below)

How to reproduce it?

  • 1: Have this script installed :
// ==UserScript==
// @name         Github - Color issues title blue & scroll to last message on title click.
// @namespace    rtasegase54tw54zwe54t
// @version      0.2
// @description  Color issues title blue and scroll to last comment on title click.
// @author       Me
// @match        https://github.com/*/*/issues*
// @require      https://code.jquery.com/jquery-3.2.1.min.js
// @grant        none
// ==/UserScript==
(function(){
    var s=document.createElement("style");
    s.innerHTML=".js-issue-title{color:blue;cursor:pointer}";
    document.querySelector("head").appendChild(s);
    //Define timer variable
    var timer=false;
    //Registers events
    var addClickEvent=function(){
        //Register our event again
        $('.js-issue-title').off("click");
        $('.js-issue-title').on("click",function(){
            $("html, body").animate({
                scrollTop: $('.timeline-comment-header').last().offset().top
            }, 200);
        });
    };
    //Schedule a timer event
    var scheduleUpdater=function(){
        //Only if we have not already scheduled
        if(!timer)
        {
            //run function in timer that registers click events and resets the timer
            timer=window.setTimeout(function(){addClickEvent();timer=false;},100);
        }
    };
    //Watch over document changes
    document.body.addEventListener('DOMSubtreeModified', function (){
        //Do not update immediately, otherwise we can run into an infinite loop.
        scheduleUpdater();
    }, false);
    //Register event for all existing elements
    addClickEvent();
})();
  • 2: Open an issue on a Github issues page, for example some issue from this issue forum here
  • 3: With Tampermonkey, the script works as it should, that is, the issue title would be colored blue, and when clicked the page would scroll to the last comment on the page. With Violentmonkey, the script doesn't work.

What is the expected result?

Script should do as explained in step 3 above.

What is the actual result?

Nothing at all.

Environment

  • Browser: Firefox
  • Browser version: v55.0.1 (32bit) (same in current FF nightly)
  • Violentmonkey version: 2.6.4
  • OS: Win7 64bit
@gera2ld
Copy link
Member

gera2ld commented Aug 12, 2017

Known issue, duplicate of #107
closed in favor of #173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants