Commit 2a2e250a authored by Dušan Horváth's avatar Dušan Horváth
Browse files

Initial commit

parents
var currentHost = window.location.origin + window.location.pathname;
if(isImage(currentHost)) {
document.body.innerHTML='';
let url= document.createElement('p');
let img = document.createElement('img');
let divnav = document.createElement('div');
let div = document.createElement('div');
var patt = /\d+/g;
var result = currentHost.match(patt);
url.innerHTML = currentHost + " { " + result + " } " ;
url.style="color:red;z-index:20;paddingBottom:100px;";
img.src = currentHost;
img.style="max-width:90%;max-height:90%;z-index:-5";
div.appendChild(img);
div.style = "paddingTop:150px";
divnav.style = "background-color:black;z-index:50;position:fixed; right:5px; top:5px;";
divnav.innerHTML = "test";
document.body.appendChild(url);
document.body.appendChild(div);
document.body.appendChild(divnav);
}
function isImage(url) {
var ext = getExtension(url);
document.title = ext;
if(ext == "jpg") return true;
if(ext == "jpeg") return true;
if(ext == "svg") return true;
if(ext == "png") return true;
if(ext == "bmp") return true;
if(ext == "tif") return true;
return false;
}
function getExtension(path) {
let baseName = path.split(/[\\/]/).pop(), // extracts file name from full path
// (supports separators `\\` and `/`)
pos = baseName.lastIndexOf("."); // gets the last position of `.`
if (baseName === "" || pos < 1) // if the file name is empty or ...
return ""; // the dot not found (-1) or comes first (0)
return baseName.slice(pos + 1); // extracts extension ignoring "."
}
\ No newline at end of file
{
"manifest_version": 2,
"name": "Easy navigator",
"version":"1.0.0",
"content_scripts": [
{
"matches":["<all_urls>"],
"js":["/content_script.js"]
}
],
"browser_action": {
"browser_style": true,
"default_icon":{
"48":"/icon.svg"
},
"browser_title":"Easy-navigator",
"default_popup":"/popup.html"
},
"permissions":[
""
]
}
\ No newline at end of file
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<script src="/popup.js"></script>
</body>
</html>
// https://i1.wp.com/descubremonterrey.com/wp-content/uploads/2019/07/7.jpg
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment