Last active
April 19, 2023 19:08
-
-
Save borissov/f488d2ae51648e66cdf4169ef53edf78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(window.location.host === 'www.imot.bg'){ | |
document.querySelector('a.next').style.width = '30%'; | |
document.querySelector('a.prev').style.width = '30%'; | |
console.log('cjs working'); | |
} | |
//Remove transperent wrapper in instagram and force to HQ images. | |
if(window.location.host === 'www.instagram.com'){ | |
document.addEventListener('click', function(element){ | |
if(element.srcElement.nodeName === 'DIV') | |
{ | |
element.srcElement.parentElement.querySelectorAll('div img[src]').forEach(function(image){ | |
let parentElementDivs = image.parentElement.parentElement; | |
if(parentElementDivs.querySelectorAll('div').length == 2) | |
{ | |
parentElementDivs.querySelector('div:last-child').remove(); | |
} | |
if(image.getAttribute('sizes') !== '10000px') | |
{ | |
image.setAttribute('sizes','10000px'); | |
} | |
}); | |
} | |
}) | |
console.log('cjs working'); | |
} | |
//Bitbucket VIM button | |
if(window.location.host.includes('bitbucket.projects')){ | |
let testUrl = window.location.href; | |
let buttons = document.getElementsByClassName('secondary'); | |
let vim_button = document.getElementsByClassName('vim-button'); | |
if( | |
testUrl.indexOf('/browse/') > -1 && | |
buttons.length && | |
!vim_button.length | |
) | |
{ | |
let div = document.createElement("div"); | |
let button_new = document.createElement("button"); | |
button_new.classList.add('aui-button'); | |
button_new.classList.add('vim-button'); | |
button_new.innerHTML = 'VIM'; | |
button_new.addEventListener("click", function(){ | |
let line = 1; | |
let url = window.location.href; | |
//get line number | |
if(url.indexOf('#') > -1) | |
{ | |
[url, line] = url.split('#'); | |
} | |
//clear url params | |
if(url.indexOf('?') > -1) | |
{ | |
url = url.split('?')[0]; | |
} | |
let file_path = url.replace(/.*repos/,'/Users/radoslavborisov/www').replace('/browse',''); | |
window.open('mvim://open?url=file://'+file_path+'&line='+line,'_blank'); | |
}); | |
div.classList.add('aui-buttons'); | |
div.appendChild(button_new); | |
buttons[0].prepend(div); | |
} | |
console.log('cjs working'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment