by North Mack » Sat Oct 02, 2010 11:03 am
by North Mack » Sat Oct 02, 2010 8:48 pm
by Ballotonia » Sun Oct 03, 2010 12:53 pm
by North Mack » Sun Oct 03, 2010 1:06 pm
by Glen-Rhodes » Sun Oct 03, 2010 2:37 pm
// ==UserScript==
// @name Get Posts Button
// @description Adds a 'get posts' button
// @author Glen-Rhodes
// @include http://www.nationstates.net/nation=*
// @version 1.0
// ==/UserScript==
function getNation() {
var uri = window.location.pathname.toString();
var dirty = uri.substring(8);
var clean = dirty.replace(/_/g, '+');
return clean;
}
function getElementByClass(searchClass,node,tag) {
var classElements = new Array();
if ( node == null )
node = document;
if ( tag == null )
tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements[0];
}
function insertAfter(newElement,targetElement) {
var parent = targetElement.parentNode;
if(parent.lastchild == targetElement) {
parent.appendChild(newElement);
}
else {
parent.insertBefore(newElement, targetElement.nextSibling);
}
}
function gotoposts() {
window.location.href = 'http://forum.nationstates.net/search.php?author=' + getNation();
}
var gp_insert = document.getElementsByTagName('form')[0];
var gp_button = document.createElement('button');
gp_button.style.backgroundColor = '#474';
gp_button.style.color = 'white';
gp_button.style.fontSize = '11px';
gp_button.style.marginTop = '-10px';
gp_button.style.marginLeft = '2px';
var gp_text = document.createTextNode('Get Posts');
gp_button.appendChild(gp_text);
gp_button.addEventListener('click', gotoposts, false);
insertAfter(gp_button, gp_insert);
by North Mack » Sun Oct 03, 2010 2:47 pm
by Glen-Rhodes » Sun Oct 03, 2010 2:56 pm
North Mack wrote:1) It would be much easier (and accessible) as something built into the game rather than a third party script
North Mack wrote:2) your script has multiple failings, namely it won't handle special characters like hyphens (such as your name) or names with multiple spaces, that I found in the first 5 seconds of using it. Granted this can be overcome with modifications, but just saying.
by Reploid Productions » Sun Oct 03, 2010 4:13 pm
[violet] wrote:Maybe we could power our new search engine from the sexual tension between you two.
by North Mack » Sun Oct 03, 2010 8:44 pm
Glen-Rhodes wrote:North Mack wrote:1) It would be much easier (and accessible) as something built into the game rather than a third party script
It would be pretty easy for admins to add it into the game. It's also pretty easy, for those of us who know anything about the internet, to use a userscript for minor website alterations, in the mean time.
Glen-Rhodes wrote:North Mack wrote:2) your script has multiple failings, namely it won't handle special characters like hyphens (such as your name) or names with multiple spaces, that I found in the first 5 seconds of using it. Granted this can be overcome with modifications, but just saying.
Hyphens should work just fine. Multiple spaces works with the modified code above.
Reploid Productions wrote:I like the idea, I think its mainly a matter of dragging a codemonkey over to actually implement it.
by Glen-Rhodes » Mon Oct 04, 2010 7:24 am
North Mack wrote:Well something in your name is screwing it up, as clicking the "View Posts" from your nation pages, it attempts to search for "odes"
by Unibot » Mon Oct 04, 2010 7:41 pm
Vocenae wrote:Unibot, you have won NS.
by North Mack » Mon Oct 04, 2010 9:39 pm
[violet] wrote:Not a bad idea!
Unibot wrote:I'll add it to the list.
by Ballotonia » Mon Dec 13, 2010 4:32 pm
[violet] wrote:Implemented in Century.
by North Mack » Mon Dec 13, 2010 5:02 pm
by Polar Nation » Mon Dec 13, 2010 5:08 pm
[violet] wrote:Implemented in Century.
by Wopruthien » Mon Dec 13, 2010 6:27 pm
by [violet] » Mon Dec 13, 2010 8:15 pm
Wopruthien wrote:What happens if we don't use the Century theme? Can we still have this feature?
Advertisement
Users browsing this forum: Tiami
Advertisement