• Community
    • Community
    • Vivaldi Social
    • Blogs
  • Forum
    • Vivaldi Forum
    • Categories
    • Recent
    • Popular
  • Themes
    • Vivaldi Themes
    • My Themes
    • FAQ
  • Contribute
    • Contribute
    • Volunteer
    • Donate
  • Browser
    • Vivaldi Browser
    • Latest News
    • Snapshots
    • Help
Register Login

Vivaldi

  • Community
  • Themes
  • Contribute
  • Browser

Navigation

    • Home
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. Desktop
    3. Customizations & Extensions
    4. Modifications
    5. Move Vivaldi Button on Main Toolbar [Left|Right]

    Move Vivaldi Button on Main Toolbar [Left|Right]

    Scheduled Pinned Locked Moved Modifications
    cssbuttonjavascripttoolbarmodding
    36 Posts 12 Posters 6.0k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      skribb @luetage
      last edited by

      @luetage that is soooooooooooooo good 😍 😍 😍

      thanks a million

      1 Reply Last reply Reply Quote 1
    • luetage
      L
      luetage Supporters Soprano
      last edited by

      @Hadden89 I edited the initial code too, there is no need to make the button a child of the main toolbar. It even seems detrimental, at least on Gnome the new version triggers the menu with shortcut (alt), while the original version doesn't. Something I came to realise just now.

      github β—Š vfm

      Hadden89
      H
      1 Reply Last reply
      Reply Quote 2
    • Hadden89
      H
      Hadden89 @luetage
      last edited by

      @luetage Windows trigger the menu anyway, but I'll update the code πŸ‘

      Vivaldi Stable+Snap | Patience Is The Key To Get The Vivaldi Spree | Unsupported Extensions | Github | windows 11 | Manjaro KDE | Q4OS Trinity | Android 13

      1 Reply Last reply Reply Quote 0
    • ChimeraLove
      C
      ChimeraLove
      last edited by

      Hello,

      I would love your help in moving the Vivaldi button to the vertical panel above the bookmarks button.

      I don't know js, and was trying to play with panelbtn and .switch with no luck

      Thanks!

      luetage
      L
      1 Reply Last reply
      Reply Quote 0
    • luetage
      L
      luetage Supporters Soprano @ChimeraLove
      last edited by

      @ChimeraLove

      Here:

      (function () {
      
          function style() {
              const style = document.createElement('style');
              style.type = 'text/css';
              style.id = 'mvVivbtn';
              style.innerHTML = `.vivaldi {position: relative;}`;
              document.getElementsByTagName('head')[0].appendChild(style);
          };
      
          function mvVivbtn() {
              style();
              var btn = document.querySelector('.vivaldi');
              btn.setAttribute('tabindex', '-1');
              var panel = document.getElementById('switch');
              panel.insertBefore(btn, panel.firstChild);
          }
      
          setTimeout(function wait() {
              const browser = document.getElementById('browser');
              if (browser) {
                    mvVivbtn();
              }
              else {
                   setTimeout(wait, 300);
              }
          });
      
          })();
      
      

      github β—Š vfm

      ChimeraLove
      C
      1 Reply Last reply
      Reply Quote 2
    • ChimeraLove
      C
      ChimeraLove @luetage
      last edited by

      @luetage Thank you! perfect πŸ™‚

      1 Reply Last reply Reply Quote 0
    • EvilSpark
      E
      EvilSpark
      last edited by

      Thanks a lot for this great Mod luetage.

      1 Reply Last reply Reply Quote 0
    • oudstand
      O
      oudstand Supporters
      last edited by

      Did you adapt the mod for the latest update?

      1 Reply Last reply Reply Quote 0
    • Hadden89
      H
      Hadden89
      last edited by Hadden89

      Don't seem to work anymore with latest snaps.

      Vivaldi Stable+Snap | Patience Is The Key To Get The Vivaldi Spree | Unsupported Extensions | Github | windows 11 | Manjaro KDE | Q4OS Trinity | Android 13

      sjudenim
      S
      1 Reply Last reply
      Reply Quote 0
    • sjudenim
      S
      sjudenim Supporters @Hadden89
      last edited by

      @Hadden89

      That's because they've changed the .addressbar and .addressfield to .URLBar and .URLField

      Just replace this line

             var bar = document.querySelector(".toolbar-addressbar");
      

      with this

             var bar = document.querySelector(".UrlBar");
      

      https://github.com/sjudenim

      1 Reply Last reply Reply Quote 3
    • M
      midoni @luetage
      last edited by midoni

      @luetage said in (Solved) Move Vivaldi Button on Main Toolbar [Left|Right]:

      @skribb Should work:

      …
      
      

      Thanks a lot! But now the saved space is unused. How can the tabs use this space?

      1 Reply Last reply Reply Quote 1
    • Ivanwah
      I
      Ivanwah
      last edited by

      Sorry for necroing. I found that this works until you go into full-screen mode (double clicking on a video or by pressing F11). After that the button returns to its original position. A button still stays in the toolbar but nothing happens when you click on it. Restarting Vivaldi fixes it and launching a new window fixes it only for that new window.

      1 Reply Last reply Reply Quote 0
    • J
      jstlk4smth
      last edited by

      @sbernecchia, @Ivanwah
      Next is tested on win10 viv5.1. Not fix, but it recreate viv button(delay 1-2sec) after returning to maximized or normal window mode and deleting one that not working. Rarely it stop working for me, but dunno what the reason.

      on the right of urlbar:

      (function () {
      
          function style() {
              const style = document.createElement('style');
              style.type = 'text/css';
              style.id = 'mvVivbtn';
              style.innerHTML = `.vivaldi {position: relative;}`;
              document.getElementsByTagName('head')[0].appendChild(style);
          };
      
          function mvVivbtn() {
              var btn = document.querySelector(".vivaldi");
              btn.setAttribute('tabindex', '-1');
              var bar = document.querySelector(".UrlBar");
              bar.appendChild(btn);
          }
      
          setTimeout(function wait() {
              const browser = document.getElementById('browser');
              if (browser) {
      			style();
                  mvVivbtn();
              }
              else {
                   setTimeout(wait, 300);
              }
          });
      
      
      	//bypass wrong main button movement after fullscreen
      	var mutationObserver = new MutationObserver(function(mutations) {
      	mutations.forEach(function(mutation) {
      		setTimeout(function iwillcheck() {
      			if(document.getElementById('browser').getAttribute('Class').includes("normal") || document.getElementById('browser').getAttribute('Class').includes("maximized")) {	
      				mvVivbtn();
      				let element = document.querySelectorAll(".vivaldi");
      				if(element.length > 1){
      					element[0].parentNode.removeChild(element[0]);
      					};
      			};
      		}, 1000);
      		});
      	});
      
      	setTimeout(function waitAndGo() {
      		// Starts listening for changes.
      		mutationObserver.observe(document.getElementById('browser'), {
      		  attributes: true,//***
      		  attributeOldValue: true,//***
      		  attributeFilter: [ "class" ]
      		});
      	}, 1000);
          })();
      

      on the left, with new tab and trash buttons on the same line:

      (function () {
      
          function style() {
              const style = document.createElement('style');
              style.type = 'text/css';
              style.id = 'mvVivbtn';
              style.innerHTML = `.vivaldi {position: relative;}`;
              document.getElementsByTagName('head')[0].appendChild(style);
      		//next is for .button-toolbar(newtab btn and trash btn), w/o static it moves somewhere right
      		const style2 = document.createElement('style');
              style2.type = 'text/css';
              style2.id = 'mvTbBBtns';
              style2.innerHTML = `.button-toolbar {position: static;}`;
              document.getElementsByTagName('head')[0].appendChild(style2);
          };
      
          function mvVivbtn() {
              var btn = document.querySelector(".vivaldi");
              btn.setAttribute('tabindex', '-1');
              var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		bar.insertBefore(btn, bar.firstChild); //uuu
          }
      	
      	function mvPlusBtn() {
              var btn = document.querySelector(".newtab");
              btn.setAttribute('tabindex', '-1');
              var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		bar.appendChild(btn);
          }
      
      	function mvTrashBtn() {
              var btn = document.querySelector(".toggle-trash");
              btn.setAttribute('tabindex', '-1');
              var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		bar.appendChild(btn);
          }
      
      
          setTimeout(function wait() {
              const browser = document.getElementById('browser');
              if (browser) {
      			  style();
                    mvVivbtn();
      			  mvPlusBtn();
      			  mvTrashBtn();
              } 
              else {
                   setTimeout(wait, 300);
              }
          });
      	
      	//bypass wrong main button movement after fullscreen
      	var mutationObserver = new MutationObserver(function(mutations) {
      	mutations.forEach(function(mutation) {
      		setTimeout(function iwillcheck() {
      			if(document.getElementById('browser').getAttribute('Class').includes("normal") || document.getElementById('browser').getAttribute('Class').includes("maximized")) {	
      				mvVivbtn();
      				let element = document.querySelectorAll(".vivaldi");
      				if(element.length > 1){
      					element[1].parentNode.removeChild(element[1]);
      					};
      			};
      		}, 1000);
      		});
      	});
      
      	setTimeout(function waitAndGo() {
      		// Starts listening for changes.
      		mutationObserver.observe(document.getElementById('browser'), {
      		  attributes: true,//***
      		  attributeOldValue: true,//***
      		  attributeFilter: [ "class" ]
      		});
      	}, 1000);
      
      })();
      

      based on previous code from this thread

      1 Reply Last reply Reply Quote 1
    • casc5962
      C
      casc5962 Supporters
      last edited by

      Is it possible to make the move for people who don't know how to code?

      J
      1 Reply Last reply
      Reply Quote 0
    • J
      jstlk4smth @casc5962
      last edited by

      @casc5962 said in Move Vivaldi Button on Main Toolbar [Left|Right]:

      Is it possible to make the move for people who don't know how to code?

      Here version with settings. Change values at the top of script even before function, of vivButtonMode(1-3) and vivPosition(0,1,2,3,...etc).
      Examples:

      const vivButtonMode = 1;
      const vivPosition = 3;

      const vivButtonMode = 2;
      const vivPosition = 3;

      (if more than 4 extensions installed next example also can show how it works)
      const vivButtonMode = 3;
      const vivPosition = 2;

      //tested on vivaldi 5.1.2567.39
      //vivButtonMode = 1 - move button between global childNodes(blocks) of urlbar(casual separate blocks inside urlbar: "next\prev\home\reload" buttons| addressfield| userbutton| extensions)
      //there was NO TESTS with blocks that added by other JS mods, so position results may be unexpected for "1" mode
      //vivButtonMode = 2 - place viv button inside next\prev\home\reload buttons block and move it between only that block buttons
      //vivButtonMode = 3 - place viv button inside extensions block and move it between only that block buttons
      const vivButtonMode = 2;
      //set the number of element(count starts from 0) before which you want to place the viv button inside the block which was chosen by vivButtonMode setting
      //try different numbers: 0,1,2,3,...|  0 will place viv button at the beginning of the block
      //IMPORTANT. if set value more than number of native elements in the block, then bypass for resetting viv button position after returning from fullscreen stop working. example: in "next\prev\home\etc" - block : 6 buttons. if set vivPosition = 7, then bypass stop working. for urlbar max number possibly is 4, for extensions depend on number of extensions, that are shown. Just test and find the edge values by yourself.
      const vivPosition = 4;
      //moveNewTabBut and moveTrashBut, enable(set 1) or disable(set 0) the move of New TAb and Trash buttons to the end of next\prev\home\reload - block and before addressfield block
      //no settings for position of this 2 buttons added
      (function () {
      
          function style() {
              const style = document.createElement('style');
              style.type = 'text/css';
              style.id = 'mvVivbtn';
              style.innerHTML = `.vivaldi {position: relative;}`;
              document.getElementsByTagName('head')[0].appendChild(style);
          };
      
          function mvVivbtn() {
              var btn = document.querySelector(".vivaldi");
              btn.setAttribute('tabindex', '-1');
              if(vivButtonMode == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(vivButtonMode == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(vivButtonMode == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		}
      		bar.insertBefore(btn, bar.childNodes[vivPosition]); //uuu
          }
      
          setTimeout(function wait() {
              const browser = document.getElementById('browser');
              if (browser) {
      			style();
                  mvVivbtn();
              }
              else {
                   setTimeout(wait, 300);
              }
          });
      
      
      	//bypass wrong main button movement after fullscreen
      	var mutationObserver = new MutationObserver(function(mutations) {
      	mutations.forEach(function(mutation) {
      		setTimeout(function iwillcheck() {
      			if(document.getElementById('browser').getAttribute('Class').includes("normal") || document.getElementById('browser').getAttribute('Class').includes("maximized")) {	
      				mvVivbtn();
      				let element = document.querySelectorAll(".vivaldi");
      				if(element.length > 1){
      					element[1].parentNode.removeChild(element[1]);
      					};
      			};
      		}, 1000);
      		});
      	});
      
      	setTimeout(function waitAndGo() {
      		// Starts listening for changes.
      		mutationObserver.observe(document.getElementById('browser'), {
      		  attributes: true,//***
      		  attributeOldValue: true,//***
      		  attributeFilter: [ "class" ]
      		});
      	}, 1000);
          })();
      

      I have also found bug in my past version with new tab and trash buttons, that mess extension notifications to one point. Here it fixed + similar position settings also added.

      //tested on vivaldi 5.1.2567.39
      //vivButtonMode = 1 - move button between global childNodes(blocks) of urlbar(casual separate blocks inside urlbar: "next\prev\home\reload" buttons| addressfield| userbutton| extensions)
      //there was NO TESTS with blocks that added by other JS mods, so position results may be unexpected for "1" mode
      //vivButtonMode = 2 - place viv button inside next\prev\home\reload buttons block and move it between only that block buttons
      //vivButtonMode = 3 - place viv button inside extensions block and move it between only that block buttons
      const vivButtonMode = 1;
      //set the number of element(count starts from 0) before which you want to place the viv button inside the block which was chosen by vivButtonMode setting
      //try different numbers: 0,1,2,3,...|  0 will place viv button at the beginning of the block
      //IMPORTANT. if set value more than number of native elements in the block, then bypass for resetting viv button position after returning from fullscreen stop working. example: in "next\prev\home\etc" - block : 6 buttons. if set vivPosition = 7, then bypass stop working. for urlbar max number possibly is 4, for extensions depend on number of extensions, that are shown. Just test and find the edge values by yourself.
      const vivPosition = 0;
      //moveNewTabBut and moveTrashBut, enable(set 1) or disable(set 0) the move of New TAb and Trash buttons
      //other settings similar to vivButton
      const moveNewTabBut = 1;
      const modeNewTab = 2;
      const positionNewTabBut = 6;
      
      const moveTrashBut = 1;
      const modeTrashBut = 2;
      const positionTrashBut = 6;
      
      (function () {
      
          function style() {
              const style = document.createElement('style');
              style.type = 'text/css';
              style.id = 'mvVivbtn';
              style.innerHTML = `.vivaldi {position: relative;}`;
              document.getElementsByTagName('head')[0].appendChild(style);
      		//next is for .button-toolbar(newtab btn and trash btn), w/o static it moves somewhere right
      		const style2 = document.createElement('style');
              style2.type = 'text/css';
              style2.id = 'mvTbBBtns';
              style2.innerHTML = `.newtab {position: static;}`;
              document.getElementsByTagName('head')[0].appendChild(style2);
          };
      
          function mvVivbtn() {
              var btn = document.querySelector(".vivaldi");
              btn.setAttribute('tabindex', '-1');
      		if(vivButtonMode == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(vivButtonMode == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(vivButtonMode == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		}
      		bar.insertBefore(btn, bar.childNodes[vivPosition]); //uuu
          }
      	
      	function mvPlusBtn() {
              var btn = document.querySelector(".newtab");
              btn.setAttribute('tabindex', '-1');
      		if(modeNewTab == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(modeNewTab == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(modeNewTab == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		};
      		bar.insertBefore(btn, bar.childNodes[positionNewTabBut]);
          }
      
      	function mvTrashBtn() {
              var btn = document.querySelector(".toggle-trash");
              btn.setAttribute('tabindex', '-1');
      		if(modeTrashBut == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(modeTrashBut == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(modeTrashBut == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		};
      		bar.insertBefore(btn, bar.childNodes[positionTrashBut]);
          }
      
      
          setTimeout(function wait() {
              const browser = document.getElementById('browser');
              if (browser) {
      			style();
      			if(moveNewTabBut){
      			mvPlusBtn();
      			};
      			if(moveTrashBut){
      			mvTrashBtn();
      			};
      			mvVivbtn();
              } 
              else {
                  setTimeout(wait, 1000);
              }
          });
      	
      	//bypass wrong main button movement after fullscreen
      	var mutationObserver = new MutationObserver(function(mutations) {
      	mutations.forEach(function(mutation) {
      		setTimeout(function iwillcheck() {
      			if(document.getElementById('browser').getAttribute('Class').includes("normal") || document.getElementById('browser').getAttribute('Class').includes("maximized")) {	
      				mvVivbtn();
      				let element = document.querySelectorAll(".vivaldi");
      				if(element.length > 1){
      					element[1].parentNode.removeChild(element[1]);
      					};
      			};
      		}, 1000);
      		});
      	});
      
      	setTimeout(function waitAndGo() {
      		// Starts listening for changes.
      		mutationObserver.observe(document.getElementById('browser'), {
      		  attributes: true,//***
      		  attributeOldValue: true,//***
      		  attributeFilter: [ "class" ]
      		});
      	}, 1000);
      
      })();
      
      
      casc5962
      C
      D
      2 Replies Last reply
      Reply Quote 2
    • casc5962
      C
      casc5962 Supporters @jstlk4smth
      last edited by

      @jstlk4smth Thank you!

      1 Reply Last reply Reply Quote 0
    • D
      drkh @jstlk4smth
      last edited by

      @jstlk4smth

      Hi,

      I ran your mod on 32-bit Vivaldi v5.1.2567.39 (same version as you used) under Windows 7 Home Pre x64 SP2, The mod codes are those shown below "I have also found bug in my past version..." in your last post.

      There is one issue. When the moving of the New Tab button is disabled (const moveNewTabBut = 0), the New Tab button flashes into sight and then disappears.

      When I ran the mod, Vivaldi v5.1.2567.39 had just been newly installed on my PC as standalone and everything of it was kept default.

      Please take a look. Thank you.

      J
      1 Reply Last reply
      Reply Quote 0
    • J
      jstlk4smth @drkh
      last edited by

      @drkh Thank you for clear description. I have reproduced it on clear profile. The reason was the css multiline-tabs mod that was set in my main profile and somehow solved the problem with js. The following version works on a clean profile in my case.

      //tested on vivaldi 5.1.2567.39
      //vivButtonMode = 1 - move button between global childNodes(blocks) of urlbar(casual separate blocks inside urlbar: "next\prev\home\reload" buttons| addressfield| userbutton| extensions)
      //there was NO TESTS with blocks that added by other JS mods, so position results may be unexpected for "1" mode
      //vivButtonMode = 2 - place viv button inside next\prev\home\reload buttons block and move it between only that block buttons
      //vivButtonMode = 3 - place viv button inside extensions block and move it between only that block buttons
      const vivButtonMode = 1;
      //set the number of element(count starts from 0) before which you want to place the viv button inside the block which was chosen by vivButtonMode setting
      //try different numbers: 0,1,2,3,...|  0 will place viv button at the beginning of the block
      //IMPORTANT. if set value more than number of native elements in the block, then bypass for resetting viv button position after returning from fullscreen stop working. example: in "next\prev\home\etc" - block : 6 buttons. if set vivPosition = 7, then bypass stop working. for urlbar max number possibly is 4, for extensions depend on number of extensions, that are shown. Just test and find the edge values by yourself.
      const vivPosition = 0;
      //moveNewTabBut and moveTrashBut, enable(set 1) or disable(set 0) the move of New TAb and Trash buttons
      //other settings similar to vivButton
      const moveNewTabBut = 0;
      const modeNewTab = 2;
      const positionNewTabBut = 6;
      
      const moveTrashBut = 1;
      const modeTrashBut = 2;
      const positionTrashBut = 6;
      
      (function () {
      
          function style() {
              const style = document.createElement('style');
              style.type = 'text/css';
              style.id = 'mvVivbtn';
              style.innerHTML = `.vivaldi {position: relative;}`;
              document.getElementsByTagName('head')[0].appendChild(style);
          };
      
      	function style2() {
      		//next is for .newtab btn, w/o static it moves somewhere right
      		const style2 = document.createElement('style');
              style2.type = 'text/css';
              style2.id = 'mvTbBBtns';
              style2.innerHTML = `.newtab {position: static;}`;
              document.getElementsByTagName('head')[0].appendChild(style2);
          };
      
          function mvVivbtn() {
              var btn = document.querySelector(".vivaldi");
              btn.setAttribute('tabindex', '-1');
      		if(vivButtonMode == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(vivButtonMode == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(vivButtonMode == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		}
      		bar.insertBefore(btn, bar.childNodes[vivPosition]); //uuu
          }
      	
      	function mvPlusBtn() {
              var btn = document.querySelector(".newtab");
              btn.setAttribute('tabindex', '-1');
      		if(modeNewTab == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(modeNewTab == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(modeNewTab == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		};
      		bar.insertBefore(btn, bar.childNodes[positionNewTabBut]);
          }
      
      	function mvTrashBtn() {
              var btn = document.querySelector(".toggle-trash");
              btn.setAttribute('tabindex', '-1');
      		if(modeTrashBut == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(modeTrashBut == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(modeTrashBut == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		};
      		bar.insertBefore(btn, bar.childNodes[positionTrashBut]);
          }
      
      
          setTimeout(function wait() {
              const browser = document.getElementById('browser');
              if (browser) {
      			style();
      			if(moveNewTabBut){
      			style2();
      			mvPlusBtn();
      			};
      			if(moveTrashBut){
      			mvTrashBtn();
      			};
      			mvVivbtn();
              } 
              else {
                  setTimeout(wait, 1000);
              }
          });
      	
      	//bypass wrong main button movement after fullscreen
      	var mutationObserver = new MutationObserver(function(mutations) {
      	mutations.forEach(function(mutation) {
      		setTimeout(function iwillcheck() {
      			if(document.getElementById('browser').getAttribute('Class').includes("normal") || document.getElementById('browser').getAttribute('Class').includes("maximized")) {	
      				mvVivbtn();
      				let element = document.querySelectorAll(".vivaldi");
      				if(element.length > 1){
      					element[1].parentNode.removeChild(element[1]);
      					};
      			};
      		}, 1000);
      		});
      	});
      
      	setTimeout(function waitAndGo() {
      		// Starts listening for changes.
      		mutationObserver.observe(document.getElementById('browser'), {
      		  attributes: true,//***
      		  attributeOldValue: true,//***
      		  attributeFilter: [ "class" ]
      		});
      	}, 1000);
      
      })();
      
      

      I have also noticed little aesthetic bug - if go(f11) in full screen from clear start page - vivaldi button appears before address field, but not respond. Not critical imho, since by default there is no vivaldi button without mods.

      D
      1 Reply Last reply
      Reply Quote 0
    • D
      drkh @jstlk4smth
      last edited by drkh

      @jstlk4smth

      Thank you for so quick a reply.

      The New Tab button now appears, as can be seen in this picture of my UI:
      window_buttons_to_be_removed.jpg

      But... can the "window control buttons" also be moved down to the right of the "hide extension" button, and then the header get removed?

      (Long story. It's something about moving Tab bar below Address bar, which I've done, as also can be seen in the above picture.)

      J
      1 Reply Last reply
      Reply Quote 0
    • J
      jstlk4smth @drkh
      last edited by

      My post is a bit off topic and should be tagged "spoiler", but I didn't find the tag on this forum (

      @drkh
      Next version also allow move "minimize/maximize/close" buttons in the same way as others:

      //tested on vivaldi 5.1.2567.39
      //vivButtonMode = 1 - move button between global childNodes(blocks) of urlbar(casual separate blocks inside urlbar: "next\prev\home\reload" buttons| addressfield| userbutton| extensions)
      //there was NO TESTS with blocks that added by other JS mods, so position results may be unexpected for "1" mode
      //vivButtonMode = 2 - place viv button inside next\prev\home\reload buttons block and move it between only that block buttons
      //vivButtonMode = 3 - place viv button inside extensions block and move it between only that block buttons
      const vivButtonMode = 1;
      //set the number of element(count starts from 0) before which you want to place the viv button inside the block which was chosen by vivButtonMode setting
      //try different numbers: 0,1,2,3,...|  0 will place viv button at the beginning of the block
      //IMPORTANT. if set value more than number of native elements in the block, then bypass for resetting viv button position after returning from fullscreen stop working. example: in "next\prev\home\etc" - block : 6 buttons. if set vivPosition = 7, then bypass stop working. for urlbar max number possibly is 4, for extensions depend on number of extensions, that are shown. Just test and find the edge values by yourself.
      const vivPosition = 0;
      //moveNewTabBut and moveTrashBut, enable(set 1) or disable(set 0) the move of New TAb and Trash buttons
      //other settings similar to vivButton
      const moveNewTabBut = 0;
      const modeNewTab = 1;
      const positionNewTabBut = 3;
      
      const moveTrashBut = 0;
      const modeTrashBut = 3;
      const positionTrashBut = 8;
      
      const moveWindowCloseBut = 1;
      const modeWindowCloseBut = 3;
      const positionWindowClose = 7;
      
      const moveWindowMaximizeBut = 1;
      const modeWindowMaximizeBut = 3;
      const positionWindowMaximize = 7;
      
      const moveWindowMinimizeBut = 1;
      const modeWindowMinimizeBut = 3;
      const positionWindowMinimize = 7;
      
      (function () {
      
          function style() {
              const style = document.createElement('style');
              style.type = 'text/css';
              style.id = 'mvVivbtn';
              style.innerHTML = `.vivaldi {position: relative;}`;
              document.getElementsByTagName('head')[0].appendChild(style);
          };
      
      	function style2() {
      		//next is for .newtab btn, w/o static it moves somewhere right
      		const style2 = document.createElement('style');
              style2.type = 'text/css';
              style2.id = 'mvTbBBtns';
              style2.innerHTML = `.newtab {position: static;}`;
              document.getElementsByTagName('head')[0].appendChild(style2);
          };
      
          function mvVivbtn() {
              var btn = document.querySelector(".vivaldi");
              btn.setAttribute('tabindex', '-1');
      		if(vivButtonMode == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(vivButtonMode == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(vivButtonMode == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		}
      		bar.insertBefore(btn, bar.childNodes[vivPosition]); //uuu
          };
      	
      	function mvPlusBtn() {
              var btn = document.querySelector(".newtab");
              btn.setAttribute('tabindex', '-1');
      		if(modeNewTab == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(modeNewTab == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(modeNewTab == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		};
      		bar.insertBefore(btn, bar.childNodes[positionNewTabBut]);
          };
      
      	function mvTrashBtn() {
              var btn = document.querySelector(".toggle-trash");
              btn.setAttribute('tabindex', '-1');
      		if(modeTrashBut == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(modeTrashBut == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(modeTrashBut == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		};
      		bar.insertBefore(btn, bar.childNodes[positionTrashBut]);
          };
      	
      	function mvWindowMinimizeBtn() {
              var btn = document.querySelector(".window-minimize");
              btn.setAttribute('tabindex', '-1');
      		if(modeWindowMinimizeBut == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(modeWindowMinimizeBut == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(modeWindowMinimizeBut == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		};
      		bar.insertBefore(btn, bar.childNodes[positionWindowMinimize]);
          };
      
      	function mvWindowMaximizeBtn() {
              var btn = document.querySelector(".window-maximize");
              btn.setAttribute('tabindex', '-1');
      		if(modeWindowMaximizeBut == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(modeWindowMaximizeBut == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(modeWindowMaximizeBut == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		};
      		bar.insertBefore(btn, bar.childNodes[positionWindowMaximize]);
          };
      	
      	function mvWindowCloseBtn() {
              var btn = document.querySelector(".window-close");
              btn.setAttribute('tabindex', '-1');
      		if(modeWindowCloseBut == 1){
      			var bar = document.querySelector(".UrlBar");
      		}
      		else if(modeWindowCloseBut == 2){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-droptarget");
      		}
      		else if(modeWindowCloseBut == 3){
      			var bar = document.querySelector(".toolbar-mainbar.toolbar-extensions");
      		};
      		bar.insertBefore(btn, bar.childNodes[positionWindowClose]);
          };
      
      
          setTimeout(function wait() {
              const browser = document.getElementById('browser');
              if (browser) {
      			style();
      			if(moveNewTabBut){
      			style2();
      				mvPlusBtn();
      			};
      			if(moveTrashBut){
      				mvTrashBtn();
      			};
      			if(moveWindowCloseBut){
      				mvWindowCloseBtn();
      			};
      			if(moveWindowMaximizeBut){
      				mvWindowMaximizeBtn();
      			};
      			if(moveWindowMinimizeBut){
      				mvWindowMinimizeBtn();
      			};
      			mvVivbtn();
              } 
              else {
                  setTimeout(wait, 1000);
              }
          });
      	
      	//bypass wrong main button movement after fullscreen
      	var mutationObserver = new MutationObserver(function(mutations) {
      	mutations.forEach(function(mutation) {
      		setTimeout(function iwillcheck() {
      			if(document.getElementById('browser').getAttribute('Class').includes("normal") || document.getElementById('browser').getAttribute('Class').includes("maximized")) {	
      				mvVivbtn();
      				let element = document.querySelectorAll(".vivaldi");
      				if(element.length > 1){
      					element[1].parentNode.removeChild(element[1]);
      					};
      			};
      		}, 1000);
      		});
      	});
      
      	setTimeout(function waitAndGo() {
      		// Starts listening for changes.
      		mutationObserver.observe(document.getElementById('browser'), {
      		  attributes: true,//***
      		  attributeOldValue: true,//***
      		  attributeFilter: [ "class" ]
      		});
      	}, 1000);
      
      })();
      
      
      

      System windows themed UI should be disabled in settings(don't know how exactly it called in english) - otherwise it just duplicate the buttons.
      The next important thing for buttons, after being moved, is that they lose their animation and all hover/action reactions. And also they do not match the style of the address bar.
      It can be fixed with css mods. Just example of modding for minimize button:

      .window-minimize {
          color: red;
          background: black;
          border: solid 3px green;
          border-radius: 50% 50%;
          transform: scale(0.7, 0.7);
      }
      
      .window-minimize:hover {
          color: green;
          background: red;
          border: solid 3px cyan;
          transform: scale(1.3, 1.3);
      }
      
      .window-minimize:active {
          color: #00800054;
          background: #ff000061;
          border: solid 3px #00ffff4f;
          transform: scale(1.9, 1.9);
      }
      

      For removing top line you can try following css mod:

      #browser.tabs-top #header {
          min-height: 0px !important;
      }
      

      instead of min-height, "display: none" could be used, but i guess 1st variant better

      Important: after hiding header - ability to move window with mouse will be lost in 99%(until you don't have special "tricks" for doing this action)

      D
      1 Reply Last reply
      Reply Quote 0
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    • 1
    • 2
    • 2 / 2
    • First post
      Last post

    Copyright © Vivaldi Technologies™ β€” All rights reserved. Privacy Policy | Code of conduct | Terms of use | Vivaldi Status