TheMechanist / MWT Galerie Beta

// ==UserScript==
// @name         MWT Galerie Beta
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Ersetzt den nervigen Link zur Galerie
// @author       The Mechanist
// @include        *://*.mietwagen-talk.*/*
// @grant        GM_addStyle


// @run-at  document-idle
// ==/UserScript==

(function() {

allGalPics = document.getElementsByClassName("resizeImage");
// loop over all gallery pictures
for ( iGalPic = 0; iGalPic < allGalPics.length; iGalPic++ ) {
	// add the enlargable attributes
 //   alert(allGalPics[iGalPic].parentElement.tagName);
    if (allGalPics[iGalPic].parentElement.tagName.toUpperCase() == 'A') {		
        allGalPics[iGalPic].parentElement.setAttribute('class','enlargable');
		// Update the href to the large picture
		url = allGalPics[iGalPic].getAttribute('src');
		url = url.replace('small', 'large');
		url = url.replace('medium', 'large');
		url = url.replace('thumbnails/large/', '');
		allGalPics[iGalPic].parentElement.setAttribute('href', url);
	}
}
setTimeout(function(){
  
    turnNode = document.createElement("span");
    turnNode.innerText = 'Links drehen';
  
    turnNode.setAttribute('style', "margin: 0 10px; cursor: pointer; color: white; font-size: 1em;");
    turnNode.setAttribute('onclick', "currentImage = document.getElementsByClassName('imageViewerCurrentImage');rotAng = parseInt(this.parentElement.getAttribute('rotang')) + 270; currentImage[0].style.transform = 'rotate(' + rotAng.toString() + 'deg)';this.parentElement.setAttribute('rotang', rotAng.toString());");
   
        menu = document.getElementsByClassName("imageViewerMenu");    
    menu = menu[0]; 
    menu.setAttribute('rotAng', '0');
    
    menu.appendChild(turnNode);
    
    turnNode = document.createElement("span");
    turnNode.innerText = 'Rechts drehen';
    
    turnNode.setAttribute('style', "margin: 0 10px; cursor: pointer; color: white; font-size: 1em;");
    turnNode.setAttribute('onclick', "currentImage = document.getElementsByClassName('imageViewerCurrentImage');rotAng = parseInt(this.parentElement.getAttribute('rotang')) + 90; currentImage[0].style.transform = 'rotate(' + rotAng.toString() + 'deg)';this.parentElement.setAttribute('rotang', rotAng.toString());");   
    
    menu.appendChild(turnNode);
    

         }, 3000);



   
    
//GM_addStyle('.imageViewerCurrentImage {border: none !important;} .imageViewerMenu{display: none !important; } .imageViewerCaption {display:none !important;} ');



})();