Panel Toggle to Address Bar



  • This mod moves the panel toggle from the status- to the address-bar, for easy access. The toggle has 2 states (on/off), and is being displayed directly above the panel. It works for panel on left or right side. If you change the panel position, opening a new window, or a browser restart, is needed for the panel toggle to switch sides.

    0_1512394607865_paneltoggle.png

    // Panel Toggle
    
    setTimeout(function wait() {
    	var adr = document.querySelector(".toolbar-addressbar.toolbar");
    	if (adr != null) {
    
    		var panel = document.getElementById('panels-container');
    		var paneltog = document.querySelector(".paneltogglefooter");
    		var panelsvg = document.querySelector(".paneltogglefooter svg");
    		var panelpath = document.querySelector(".paneltogglefooter svg path");
    		var sright = "d: path('M20 8v10h-14v-10h14zm-2 8v-6h-4v6h4z')";
    		var sleft = "d: path('M20 8v10h-14v-10h14zm-8 8v-6h-4v6h4z')";
    		paneltog.classList.add('button-toolbar');
    		paneltog.classList.remove('button-toolbar-small');
    		paneltog.style.order = "unset";
    		panelsvg.style.transform = "none";
    		panelsvg.setAttributeNS(null, "viewBox", "0 0 26 26");
    		
    		if (panel.classList.contains('right')) {
    			adr.appendChild(paneltog);
    			var pof = sright;
    			var pon = sleft;
    		}
    		else {
    			adr.insertBefore(paneltog,adr.firstChild);
    			var pof = sleft;
    			var pon = sright;
    		}
    		if (panel.classList.contains('switcher')) {
    			panelpath.style = pof;
    		}
    		else {
    			panelpath.style = pon;
    		}
    		
    		paneltog.addEventListener('click', function() {
    			if (panel.classList.contains('switcher')) {
    				panelpath.style = pon;
    			}
    			else {
    				panelpath.style = pof;
    			}
    		});
    
            }
    	else {
    		setTimeout(wait, 300);
    	}
    }, 300);
    

Log in to reply
 

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