mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 22:13:23 -07:00
As the title got to large, it's now providing every field single and changing the title quickly.
This commit is contained in:
parent
1aedebd57c
commit
5b2062daeb
1 changed files with 47 additions and 28 deletions
|
@ -1,6 +1,6 @@
|
||||||
<script language="JavaScript">
|
<script language="JavaScript">
|
||||||
|
var oldTitle = window.document.title;
|
||||||
var searchQuery = window.location.search.substring(1);
|
var searchQuery = window.location.href.split('?')[1].replace("#", "&");
|
||||||
var vars = searchQuery.split('&');
|
var vars = searchQuery.split('&');
|
||||||
|
|
||||||
function getQueryVariable(variable) {
|
function getQueryVariable(variable) {
|
||||||
|
@ -13,14 +13,33 @@ function getQueryVariable(variable) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var index = 0;
|
||||||
|
var titles = [];
|
||||||
|
var nrOfTitles = 0;
|
||||||
|
function updateTitle() {
|
||||||
|
if (index >= nrOfTitles) {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
window.document.title = titles[index];
|
||||||
|
index = index+1;
|
||||||
|
}
|
||||||
|
|
||||||
if (searchQuery && searchQuery.length >= 1) {
|
if (searchQuery && searchQuery.length >= 1) {
|
||||||
var oldTitle = (window.document.title === undefined) ? "" : window.document.title;
|
|
||||||
var state = getQueryVariable("state");
|
var state = getQueryVariable("state");
|
||||||
var code=getQueryVariable("code");
|
var error = getQueryVariable("error");
|
||||||
var error=getQueryVariable("error") || "unknown";
|
|
||||||
|
|
||||||
if (error == null && (state || code)) {
|
if (error == null && (state || code)) {
|
||||||
window.document.title=oldTitle + "?state=" + state + "&code=" + code;
|
var numberOfArguments = vars.length;
|
||||||
|
nrOfTitles = numberOfArguments -1;
|
||||||
|
for (var i = 0; i < numberOfArguments; i++) {
|
||||||
|
var pair = vars[i].split('=');
|
||||||
|
if (decodeURIComponent(pair[0]) == "state") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
titles.push(oldTitle + "?nr=" + numberOfArguments + "&state=" + state + "&" + decodeURIComponent(pair[0]) + "=" + decodeURIComponent(pair[1]));
|
||||||
|
}
|
||||||
|
// Update the title in a loop
|
||||||
|
setInterval(updateTitle, 100);
|
||||||
} else {
|
} else {
|
||||||
window.document.title = oldTitle + "?error=" + error;
|
window.document.title = oldTitle + "?error=" + error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue