one entry per page for firefox |
one entry per page for firefox |
![]()
Post
#1
|
|
Member ![]() ![]() Group: Member Posts: 29 Joined: Dec 2004 Member No: 76,633 ![]() |
does anyone know a script for showing only one entry per page that will work in firefox?
thanks =] |
|
|
![]() |
![]()
Post
#2
|
|
![]() & my dreams fall down ![]() ![]() ![]() ![]() ![]() ![]() Group: Member Posts: 1,173 Joined: Nov 2005 Member No: 291,336 ![]() |
i don't think you can have it for every page...hmm
|
|
|
![]()
Post
#3
|
|
![]() You'll find me in your dreams. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Member Posts: 8,536 Joined: Mar 2005 Member No: 114,010 ![]() |
Nay, because you'd have to use Javascript and Firefox/Mozilla interprets it differently.
|
|
|
![]()
Post
#4
|
|
Member ![]() ![]() Group: Member Posts: 29 Joined: Dec 2004 Member No: 76,633 ![]() |
ohh ic ic, that sucks. but thanks a lot guys =]
|
|
|
![]()
Post
#5
|
|
![]() Senior Member ![]() ![]() ![]() ![]() Group: Member Posts: 122 Joined: Feb 2005 Member No: 106,057 ![]() |
****** EDIT AGAIN: because of a rather retarted bit of xanga security that was added, this script no longer works as-is. I'm not going to fix something that no one uses--if someone really likes this script, please e-mail me and I'll take a bit of time to bypass the new modification or change the script to use a different function. My e-mail is below, inside the script comments. Thanks!
i know it's possible, and i'm kinda bored right now, so i'm cooking one up atm =) just one thing: it won't work right if you post two posts in the same minute, but i'm sure that won't be a problem. this should work on most standard xanga layouts/configurations. just follow the instructions in the "EXTENRAL REQUIREMENTS + INSTALLATION" section. have fun =) *** EDIT: for everyone who got here by search, make sure you follow the instructions for the area starting with '<p id="cloneLinksP" style="display:none; text-align:right;">'. That HTML goes RIGHT ABOVE the <script language. . . below. If you're still having problems, you can reply to this thread; I've subscribed to it. In the future, after I work out all the kinks, I might be submitting this as one of those "official" createblog scripts and clarify all the instructions. also, if it didn't work before, try it again with this script. I accidentally left something out, so it shouldn't have worked when you tried putting it in. stupid me =( CODE <script language="JavaScript" type="text/javascript">
<!-- /* xanga: single post script v1.15 copyright (c) 2006 threepointone (e-mail:spam@servesam.com) http://www.servesam.com/xanga/ * you may modify, redistribute, and use this script, as long as if this header remains intact. * you must contact me before reusing any original portions of this script without prior permission. * you may not use any portion of this script for commercial use or to gain profit. all rights not hereby granted are reserved. script first posted at createblog.com, kudos to them for... erm, well, having a forum */ /* External Requirements + Installation * This entire script belongs in the footer, or "website stats" section * Copy the following RIGHT ABOVE this script. Modify it to change the style of the links; just make sure that the basic structure, ids, display:none, and onClick attributes are still there <p id="cloneLinksP" style="display:none; text-align:right;"> <a href="#" onClick = "prevEntry(); return false;" id="prevLink" class="prevLink">previous entry</a> <span id="midline" class="midline">|</span> <a href="#" onClick = "nextEntry(); return false;" id="nextLink" class="nextLink">next entry</a> </p> <form onSubmit = "return false"> <input type = "hidden" value = "nothing" name = "PositionSaver" id = "PositionSaver" /> </form> * The following belongs in the Header module. It is recommended, but optional--it reduces the flicker when the page is still loading while allowing browsers without JavaScript to still view the page properly. You may also use this to customize the forward and back links. <style type="text/css"> .blogBody {display:none;} .blogHeader {display:none;} a.nextLink{cursor:pointer;} a.prevLink{cursor:pointer;} a.disabledPrevLink { color:#999999; cursor:default; text-decoration:none; } a.disabledPrevLink:link { color:#999999; cursor:default; text-decoration:none; } a.disabledPrevLink:visited{ color:#999999; cursor:default; text-decoration:none; } a.disabledPrevLink:hover{ color:#999999; cursor:default; text-decoration:none; } a.disabledPrevLink:active{ color:#999999; cursor:default; text-decoration:none; } a.disabledNextLink { color:#999999; cursor:default; text-decoration:none; } a.disabledNextLink:link { color:#999999; cursor:default; text-decoration:none; } a.disabledNextLink:visited { color:#999999; cursor:default; text-decoration:none; } a.disabledNextLink:active { color:#999999; cursor:default; text-decoration:none; } a.disabledNextLink:hover { color:#999999; cursor:default; text-decoration:none; } </style> <noscript> <style type="text/css"> .blogBody {display:block !important} .blogHeader {display:block !important} </style> </noscript> */ /* Remove this as you feel necessary. -----DOCUMENTATION------------------------------------------ ** PURPOSE ** This script provides the means for you to browse a Xanga Weblog one post at a time, rather than five at a time. ** REQUIREMENTS AND CONDITIONS FOR OPERATION** * Must not be in Xanga Private * Must be in main Xanga weblog page (i.e. not comments, etc. . .) * Only tested on Firefox 1.5 and IE 6.0. Most likely will work on most modern browsers (Firefox, IE5+ [non-mac], Opera 7+, Netscape, etc. . .) * There must be posts in the weblog * Weblog will function normally if JavaScript is disabled ** QUIRKS ** * If you navigate out of the page (i.e. click on add comment, etc. . .) and you're not on the first/last of the set of five posts, it'll *in some cases* return to the first post when you click back on your browser. A state-saving system based on forms has been used, but has not been tested for reliability. * Page identification system has not been rigorously tested. * As always, changes in the Xanga site may cause the script to function incorrectly. * Like many dynamic content pages, the back/forward buttons functions don't function properly. This, along with quirk #1, will be fixed in a later release. ** THEORY OF OPERATION ** This script works mainly by showing/hiding posts to simulate browsing one post at a time. Posts are shown and hidden merely by setting .style.display. When a Xanga weblog page is first displayed, the "direction" of the page as specified in the URL is processed. If direction is not p, the first post is initially displayed; otherwise, the last post is initially displayed. The next/previous functions simply hide the current post and show the next/previous post on the page, unless the current post is already at the beginning or end of the set. In this case, the next/previous URLs are extracted from the Xanga page and are used for redirection. Note: with the state-saving mechanism in version 1.1, the direction variable and processing presumably is no longer necessary SAVING STATE Many modern browsers automatically save the values of form fields when a user browses out of a page; this script exploits this ability to save the last displayed weblog. However, the back/forward buttons on the browser currently will not function properly. FORWARD/NEXT BUTTONS The cloneLinksP element is cloned and copied with the appropriate changes into the proper location in the Xanga DOM. */ /* COMMON FUNCTIONS If your xanga already has these functions available, feel free to remove these and modify as necessary to save space */ function $() { var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; elements.push(element); } return elements; } function $$() { var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; if (typeof element == 'string') element = document.getElementById(element); if (arguments.length == 1) return element; elements.push(element); } return elements; } function getDOMByElement(element) { var y = new Array(); var z = 0; var tempobj; tempobj = element; var level = -1; DOMLoop: while (true) { if (tempobj.firstChild){ y[z]=tempobj.firstChild; tempobj=tempobj.firstChild; level++ z++; } else { if (tempobj.nextSibling){ y[z]=tempobj.nextSibling; tempobj=tempobj.nextSibling; z++; } else { if (tempobj.parentNode){ level-- while (!tempobj.parentNode.nextSibling) { tempobj=tempobj.parentNode level-- if (!tempobj.parentNode) break DOMLoop; if (level <= -1) break DOMLoop; } y[z]=tempobj.parentNode.nextSibling; z++; tempobj=tempobj.parentNode.nextSibling } else { break DOMLoop; } } } if (z>4096) {return;} } return y; } function getElementsByClass(DOM, className) { var t = new Array(); var tc = 0; var q = DOM for (var x = 0;x < q.length; x++) { if (typeof q[x].className != "undefined" && q[x].className.toLowerCase() == className) { t[tc] = q[x] tc++; } } return t; } function getElementsByFunction(DOM, customFunction) { var t = new Array(); var tc = 0; var q = DOM if (typeof customFunction != "function") {return;} for (var x = 0;x < q.length; x++) { if (customFunction(q[x])) { t[tc] = q[x]; tc++; } } return t; } function queryString(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } //alert('Query Variable ' + variable + ' not found'); } Function.prototype.closure = function(obj) { // Init object storage. if (!window.__objs) { window.__objs = []; window.__funs = []; } // For symmetry and clarity. var fun = this; // Make sure the object has an id and is stored in the object store. var objId = obj.__objId; if (!objId) __objs[objId = obj.__objId = __objs.length] = obj; // Make sure the function has an id and is stored in the function store. var funId = fun.__funId; if (!funId) __funs[funId = fun.__funId = __funs.length] = fun; // Init closure storage. if (!obj.__closures) obj.__closures = []; // See if we previously created a closure for this object/function pair. var closure = obj.__closures[funId]; if (closure) return closure; // Clear references to keep them out of the closure scope. obj = null; fun = null; // Create the closure, store in cache and return result. return __objs[objId].__closures[funId] = function () { return __funs[funId].apply(__objs[objId], arguments); }; }; function addEvent(obj, evType, fn, useCapture){ if (obj.addEventListener){ obj.addEventListener(evType, fn, useCapture); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn.closure(obj)); return r; } else { //alert("Handler could not be attached"); } } // MANY THANKS to // Dean Edwards/Matthias Miller/John Resig // for figuring all this out!!!! // http://dean.edwards.name/weblog/2006/06/again/ // Modified to bypass Xanga security nonsense var _DOMLoadEventFn = new Array(); var _timer function _DOMLoad() { if (arguments.callee.done) return; arguments.callee.done = true; if (_timer) clearInterval(_timer); for (var x=0;x<_DOMLoadEventFn.length;x++) { _DOMLoadEventFn[x](); } }; if (document.addEventListener) { document.addEventListener("DOMContentLoaded", _DOMLoad, false); } /*@cc_on @*/ /*@if (@_win32) // thanks a lot, xanga, for all the bs document.write("<") document.write("s"); document.write("c" + "ript ") document.write("id=__ie_onload ") document.write("d") document.write("e" + "f") var asdf = "hello" document.write("e" + "" + "r=\"def") asdf = "heyyyy" document.write("er\" ") document.write("sr") asdf = "wassup" document.write("c=jav") document.write("ascript:void(0)") document.write("><\/script>") var script = document.getElementById("__ie_onload"); script.onreadystatechange = function() { if (this.readyState == "complete") { _DOMLoad(); // call the onload handler } }; /*@end @*/ // the following WOULD work in safari quite well if xanga // wasn't so retarted /* if (/WebKit/i.test(navigator.userAgent)) { // sniff _timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { _DOMLoad(); // call the onload handler } }, 10); } */ addEvent(window, "load", _DOMLoad) // end cross-browser DOMLoad Event function addDOMLoadEvent(fn) { _DOMLoadEventFn.push(fn) } /* END COMMON FUNCTIONS */ /* BEGIN CODE */ if ((location.pathname.substring(1).indexOf("/") == -1 && location.pathname.indexOf(".") == -1) || location.pathname.indexOf("home.aspx") == 1) { var docDOM = getDOMByElement(document.body) var entries = getElementsByClass(docDOM, "blogbody") if (entries.length > 0) { // see if there are any posts var viewFirstPost = (queryString("direction")!="p")?true:false function isFwdLink(element) { if (element.firstChild != null) { if (element.firstChild.nodeValue=="Next 5 >>") { return true; } } return false; } function isPrevLink(element) { if (element.firstChild != null) { if (element.firstChild.nodeValue=="<< Previous 5") { return true; } } return false; } var fwdLinkArray = getElementsByFunction(docDOM, isFwdLink) var prevLinkArray = getElementsByFunction(docDOM, isPrevLink) var fwdLink, prevLink if (fwdLinkArray.length > 0) { fwdLink = fwdLinkArray[0] var tmpNode = fwdLink.parentNode while (tmpNode.tagName != "TABLE") { tmpNode = tmpNode.parentNode } tmpNode.style.display = "none" // hide nav buttons } if (prevLinkArray.length > 0) { prevLink = prevLinkArray[0] var tmpNode = prevLink.parentNode while (tmpNode.tagName != "TABLE") { tmpNode = tmpNode.parentNode } tmpNode.style.display = "none" // hide nav buttons } var currentEntry var maincenter = getElementsByClass(docDOM, "maincenter")[0] //remove all breaks from blog area var searchElement = maincenter.firstChild while (searchElement != null) { if (searchElement.tagName == "BR") { var delElement = searchElement searchElement = searchElement.nextSibling maincenter.removeChild(delElement) } else { searchElement = searchElement.nextSibling } } var newLinksP = $$("cloneLinksP").cloneNode(true) $$("nextLink").id = "" $$("prevLink").id = "" $$("midline").id = "" newLinksP.id = "linksP" maincenter.appendChild(newLinksP) function preLoad() { for (var x=0;x<entries.length;x++) { entries[x].style.display = "none" // hide all entries entries[x]._header = entries[x].previousSibling // this finds + stores the date header node; while (entries[x]._header.className != "blogheader") { entries[x]._header = entries[x]._header.previousSibling } entries[x]._header.style.display = "none" } currentEntry = $$("PositionSaver") if (currentEntry.value != "nothing") { entries[currentEntry.value].style.display = "block" entries[currentEntry.value]._header.style.display = "block" } else { if (viewFirstPost) { entries[0].style.display = "block" entries[0]._header.style.display = "block" currentEntry.value = 0 } else { entries[entries.length - 1].style.display = "block" entries[entries.length - 1]._header.style.display = "block" currentEntry.value = entries.length - 1 } } $$("linksP").style.display="" //enable the fwd/back buttons $$("prevLink").className = "prevLink" $$("midline").className = "midline" $$("nextLink").className = "nextLink" if (currentEntry.value >= entries.length - 1 && fwdLink == null) { $$("nextLink").className = "disabledNextLink" $$("midline").className = "disabledMidline" } if (currentEntry.value <= 0 && prevLink == null) { $$("prevLink").className = "disabledPrevLink" $$("midline").className = "disabledMidline" } } addDOMLoadEvent(preLoad) //this will re-run every time the back button is pressed! function nextEntry() { if (currentEntry.value >= entries.length - 1) { if (fwdLink != null) { window.location = fwdLink.href } else { return; } } else { entries[currentEntry.value].style.display = "none" entries[currentEntry.value]._header.style.display = "none" entries[currentEntry.value * 1 + 1].style.display = "block" entries[currentEntry.value * 1 + 1]._header.style.display = "block" currentEntry.value++; $$("prevLink").className = "prevLink" $$("midline").className = "midline" if (currentEntry.value >= entries.length - 1 && fwdLink == null) { $$("nextLink").className = "disabledNextLink" $$("midline").className = "disabledMidline" } } } function prevEntry() { if (currentEntry.value <= 0) { if (prevLink != null) { window.location = prevLink.href } else { return; } } else { entries[currentEntry.value].style.display = "none" entries[currentEntry.value]._header.style.display = "none" entries[currentEntry.value * 1 - 1].style.display = "block" entries[currentEntry.value * 1 - 1]._header.style.display = "block" currentEntry.value--; $$("nextLink").className = "nextLink" $$("midline").className = "midline" if (currentEntry.value <= 0 && prevLink == null) { $$("prevLink").className = "disabledPrevLink" $$("midline").className = "disabledMidline" } } } } // end no posts conditional } else { var docDOM = getDOMByElement(document.body) var entries = getElementsByClass(docDOM, "blogbody") for (var x=0;x<entries.length;x++) { entries[x].style.display = "block" // show all entries entries[x]._header = entries[x].previousSibling // this finds + stores the date header node; while (entries[x]._header.className != "blogheader") { entries[x]._header = entries[x]._header.previousSibling } entries[x]._header.style.display = "block" } } // End weblog-page only conditional --> </script> |
|
|
![]()
Post
#6
|
|
Newbie ![]() Group: Member Posts: 1 Joined: Jul 2006 Member No: 437,336 ![]() |
Life is cruel. I've spent the past two hours combing through the dark space that is the WWW and finally found this amazing looking code when alas, it does not work for me. Having one entry per page is pretty necessary for my xanga because I post a million pictures and since it takes forever to load, visitors are discouraged to wait till the end. I registered for CB just so I could commiserate about this particular problem.
Life is cruel. I am not emo, I promise. |
|
|
![]() ![]() |