Tab Lock



  • This is a mod for a feature request ––––> https://forum.vivaldi.net/topic/25070/locking-pinned-tabs

    Tab Lock will either open all the links on a page in a new tab, or disable them altogether – decide for yourself. First I wanted to redirect all webrequests, but this specific chrome api sadly doesn't work. Then I tested it as a user-file and kept that approach. It would be possible to make a button in the UI for this, but accessing it from status bar as page action is fine as well.

    document.body.addEventListener('click', function(event) {
        var target = event.target;
        do {
            if (target.nodeName.toUpperCase() === 'A' && target.href) {
                target.href = 'javascript:'; //disables all links
                //target.target = '_blank'; //opens links in new tab
                break;
            }
        } while (target = target.parentElement);
    }, true);
    

    Create a new file with a text editor, paste the code, edit it if you want to open links in new tabs instead of disabling them (default) and save the file to the application's user_files folder. Of course the file will disappear on update (just like custom.css and custom.js), but you can add it to your batch script if you're running one of those. Directions how to set up a batch script for patching Vivaldi are available on this forum board (pinned topics).

    You can also download the file directly from github, if you don't want to create it yourself.


    0_1538856531979_Screenshot 2018-10-06 22.08.34.png



  • Cool, this is the 1st of this kind of mods I see.
    I've added both versions, also a New_Tab_Always.js, and they work nice.
    Interesting that Vivaldi adds the file name of the script in the actions menu so there's no need to set how it should appear in the menu inside the script itself.



  • @ian-coog Page actions are handy, I've been running all sorts of weird scripts in there. And yeah, not only is the entry creation automatic, the script execution is as well.



  • Locking tab script looks promising, but how do you set up page actions? I have them on in Settings.



  • @bolling1969 the icon "<>" in the status bar



  • @bolling1969 That's a good point I have overlooked. An alternative way of activating a page action is quick commands vivaldi://settings/qc/



  • You had it in your screenshot, I was just looking in the wrong place for page actions. I created LockFileMod.js and saved it in C:\Users<User>\AppData\Local\Vivaldi\User Data (Windows 10) but no luck. I'll do more research on page actions.



  • @bolling1969 it's in
    "C:\Program Files\Vivaldi\Application\2.1.1322.4\resources\vivaldi\user_files"
    look in help/about your Executable Path and then go in "Application\2.1.1322.4\resources\vivaldi\user_files" from there.
    2.1.1322.4 of course is the version I'm using, you might have a different one.



  • Thanks. I found it. It works as expected. Expect it can't do what I hoped. I have a work page that has to be in IE for security purposes. I use IE Tab within Vivaldi as I can't stand IE. Unfortunately, Page Actions can't apply to the IE Tab page.



  • @bolling1969 said in Tab Lock:

    I have a work page that has to be in IE for security purposes.

    what does that mean, "IE" and "security purposes" sounds like a joke to me =)
    the page detects the browser, or simply doesn't work outside IE because it uses something other browsers can't do, like, Microsoft specific html? =)
    Try with a User Agent Switcher and see if it works anyway inside Vivaldi



  • @bolling1969 Yeah, I tried it out. I'm sorry, but I don't know how to work around it, literally nothing works on this kind of simulated browser tab.



  • I often reload one tab what I'd like to open all links in new tab, but after reloading it your extansion doesn't "reload". Any idea?



  • @potmeklecbohdan Hmm, I have no idea what you have in mind. But I can tell you following:

    • A page action is being injected when it is selected in the dropdown, or when it is triggered with quick commands
    • A reload of the tab won't remove the page action, it is simply being injected again, because the option is still selected.
    • To remove a page action you have to either deselect it in the dropdown, disable it with quick commands, or close the tab. On removal of the page action the tab will reload, if it's still there.


  • @luetage Hmm, I

    • select "New Tab" in page actions (that's your new tab version)
    • (click any link)
    • reload the page

    The "New Tab" action is still selected, but links open in current tab. The same with your "default" mod for disabling links.



  • Oh, now I get it. This shouldn't happen of course. But I can't reproduce it. I just enabled tab lock on the forum, which disabled all links. After reloading links are still disabled when I click them. Could you take a look at your status bar and check if tab lock is still selected after you reload?



  • @luetage Yes, it is.



  • @ian-coog said in Tab Lock:

    @bolling1969 said in Tab Lock:

    I have a work page that has to be in IE for security purposes.

    what does that mean, "IE" and "security purposes" sounds like a joke to me =)
    the page detects the browser, or simply doesn't work outside IE because it uses something other browsers can't do, like, Microsoft specific html? =)
    Try with a User Agent Switcher and see if it works anyway inside Vivaldi

    What I probably should have said was that I have pages I use at work that are poorly coded and don't display properly outside of IE. Anyway, enough on that here, I don't want to steer the topic down a side course.



  • @luetage Found the problem. All JS actions don't work after reloading the page.



  • @potmeklecbohdan I tested both Tab Lock and Skewed Images now. Both work after reload for me. The issue lies elsewhere. What operating system do you use? And more importantly, do you have some kind of adblocker blocking javascript? This would explain why the code is gone from the page after reload…

    In any case, more people should test this, then we will find out what's going on.

    Just for the record, I'm on macOS using latest snapshot (2.1.1322.4)



  • @luetage said:

    What operating system do you use?

    The same as on Friday :-). Win7 + latest snapshot.

    And more importantly, do you have some kind of adblocker blocking javascript?

    I don't know about anything.



Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.