Skip to content

Commit

Permalink
add: setting for subdomain rewriting [GH-3]
Browse files Browse the repository at this point in the history
Signed-off-by: Martok <martok@martoks-place.de>
  • Loading branch information
martok committed May 14, 2010
1 parent 4a74ca8 commit 331fe6f
Showing 1 changed file with 51 additions and 14 deletions.
65 changes: 51 additions & 14 deletions edgemonkey.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,13 @@ function SettingsStore() {
]);
this.AddCategory('Entwickler', [
this.AddSetting( 'Zus&auml;tzliche Funktionen f&uuml;r Beta-Tester', 'ui.betaFeatures', 'bool', false),
this.AddSetting( 'Deaktivieren des Absenden von Shouts', 'ui.disableShouting', 'bool', false)
this.AddSetting( 'Deaktivieren des Absenden von Shouts', 'ui.disableShouting', 'bool', false),
this.AddSetting( 'Bei ge&auml;nderten Links auf gleicher Subdomain bleiben', 'ui.addsidSubdomain', [
['Deaktiviert', 0],
['Nur aktuelle', 1],
['Aktuelle [Original]', 2],
['Original [Aktuelle]', 3],
], 2)
]);

this.AddCategory('Such-Ansicht', [
Expand Down Expand Up @@ -3078,23 +3084,54 @@ Pagehacks.prototype = {
prms.push('sid='+EM.User.loggedOnSessionId);
hr.search='?'+prms.join('&');
hr.title='EE-Interner Link (Session wird übernommen)';
if(EM.Settings.GetValue('ui','betaFeatures')) {
if(EM.Settings.GetValue('ui','betaFeatures') && EM.Settings.GetValue('ui','addsidSubdomain')) {
function makeLinkBtn(after, href) {
var ax = document.createElement('a');
ax.className='gensmall';
ax.innerHTML='<img border="0" style="margin-left:2px" src="/templates/subSilver/images/icon_latest_reply.gif" />';
after.parentNode.insertBefore(ax,after.nextSibling);
ax.href = href;
return ax;
}

var here = window.location.host.match(/^(.*?)\./);
here = here?here[1]:'www';
var there = hr.host.replace(/^(.*?)\./,here+'.');
var ax = document.createElement('a');
hr.parentNode.insertBefore(ax,hr.nextSibling);
ax.href = hr.href;
ax.host = there;
ax.title = 'Auf gleicher Subdomain bleiben';
if (window.location.host==there) {
// only subdomain would change, but this link doesnt-> no change needed
ax.search = oldsearch;
} else {
ax.title+= ' (Session wird übernommen)';
switch (EM.Settings.GetValue('ui','addsidSubdomain')) {
case '1': {
hr.host = there;
hr.title = 'Auf gleicher Subdomain bleiben';
if (window.location.host==there) {
// only subdomain would change, but this link doesnt-> no change needed
hr.search = oldsearch;
} else {
hr.title+= ' (Session wird übernommen)';
}
}; break;
case '2': {
var ax = makeLinkBtn(hr, hr.href);
ax.title = hr.title;
hr.host = there;
hr.title = 'Auf gleicher Subdomain bleiben';
if (window.location.host==there) {
// only subdomain would change, but this link doesnt-> no change needed
hr.search = oldsearch;
} else {
hr.title+= ' (Session wird übernommen)';
}
}; break;
case '3': {
var ax = makeLinkBtn(hr, hr.href);
ax.host = there;
ax.title = 'Auf gleicher Subdomain bleiben';
if (window.location.host==there) {
// only subdomain would change, but this link doesnt-> no change needed
ax.search = oldsearch;
} else {
ax.title+= ' (Session wird übernommen)';
}
} ; break;
}
ax.className='gensmall';
ax.innerHTML='<img border="0" style="margin-left:2px" src="/templates/subSilver/images/icon_latest_reply.gif" />';
}
}
}
Expand Down

0 comments on commit 331fe6f

Please sign in to comment.