Go Back Free Porn & Adult Videos Forum > Help Section > Computer and Tech Help

Follow Planet Suzy Forum on Twitter
Best Porn Sites FAQ Mark Forums Read
Notices

Computer and Tech Help Discuss hardware, software, applications, malware removal, etc.

Thread Tools
Old 16th July 2011, 01:51
GreatDesire

Virgin

Join Date: Jul 2008
Posts: 13
Thanks: 33
Thanked 19 Times in 10 Posts
GreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud of
Default

If you're using jquery, you simply add a .js file and insert your code between the braces:
Quote:
$(document).ready(function(){
//your code goes here
});
GreatDesire is offline
The Following 2 Users Say Thank You to GreatDesire For This Useful Post:
Old 16th July 2011, 01:56
GreatDesire

Virgin

Join Date: Jul 2008
Posts: 13
Thanks: 33
Thanked 19 Times in 10 Posts
GreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud of
Default

Apparently, the url that you provided uses plain javascript. Is there a special id or class for that list of tags? I will assume that the list has an id of "tags_list", the jquery code will look something like that:

$(document).ready(function(){
var mylist = $('#tags_list');
var listitems = mylist.children('li').get();
listitems.sort(function(a, b) {
var compA = $(a).text().toUpperCase();
var compB = $(b).text().toUpperCase();
return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
})
$.each(listitems, function(idx, itm) { mylist.append(itm); });
});

The original code comes from here: http://stackoverflow.com/questions/1...y-using-jquery
GreatDesire is offline
The Following User Says Thank You to GreatDesire For This Useful Post:
Old 16th July 2011, 02:01
GreatDesire

Virgin

Join Date: Jul 2008
Posts: 13
Thanks: 33
Thanked 19 Times in 10 Posts
GreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud of
Default

Also, on a somewhat unrelated note, can't you just find the SQL statement that fetches the tags from the database and changing the order by clause?
GreatDesire is offline
Old 16th July 2011, 03:16
Dustbunny
Dirth the First

Clinically Insane

Dustbunny's Avatar

Join Date: Feb 2010
Posts: 2,767
Thanks: 2,979
Thanked 59,086 Times in 2,643 Posts
Dustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a God
Default

jQuery is a no-go because the js is external linked. So I'm perfectly aware it's plain JavaScript. And the question raised was about plain JavaScript. And clicking your link brings you to my link. To plain a JavaScript solution.

So again, how to call on that function without using body onload and without clicking, mouseover or any other user interaction. (page loads -> presto it's there)
__________________
Dustbunny is offline
Old 16th July 2011, 03:18
Dustbunny
Dirth the First

Clinically Insane

Dustbunny's Avatar

Join Date: Feb 2010
Posts: 2,767
Thanks: 2,979
Thanked 59,086 Times in 2,643 Posts
Dustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a God
Default

Is there a JavaScript equivalent for this?
HTML Code:
$(document).ready(function(){
 //your code goes here
 })
__________________
Dustbunny is offline
Old 16th July 2011, 04:41
Dustbunny
Dirth the First

Clinically Insane

Dustbunny's Avatar

Join Date: Feb 2010
Posts: 2,767
Thanks: 2,979
Thanked 59,086 Times in 2,643 Posts
Dustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a God
Default

Fixed. Hooray!

HTML Code:
window.onload = function() {
 var desc = false;
 document.getElementById("test").onclick = function() {
 sortUnorderedList("list", desc);
 desc = !desc;
 return false;
 }
 }
Just got rid of the nested statement or whatever that tells the button to call on that fuction. With that gone, it's just up to the window.onload which is basically like <body onload>.

So you could say $(document).ready(function() is the jQuery way of saying window.onload = function()

[...]

I overlooked another thing though. The output (the listing I want to sort) uses a numeral incremental prefix before the post title (host.net/012345/title) so I'm still stuck in chronology. This many cosmetic alterations (I've already replaced the table structure with floating divs, styled it mighty nice and now applied sorting) and still the CMS manages to prove how dumb and unflexible it really is. Geez.

BTW, this isn't a request. So no mod rewrite remarks.
__________________
Dustbunny is offline
The Following User Says Thank You to Dustbunny For This Useful Post:
Old 16th July 2011, 10:27
GreatDesire

Virgin

Join Date: Jul 2008
Posts: 13
Thanks: 33
Thanked 19 Times in 10 Posts
GreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud of
Default

Can't you just replace that incremental prefix using a regular expression?

Try replacing all the text before sorting, like this:

Quote:
var listParent = document.getElementById('tags_list');
var listElements = listParent.children;
var listLength = listElements.length;
for (var i=0;i<listLength;i++) {
var liElement = listElements[i];
if(liElement.tagName == 'li'){
var oldText = liElement.innerHtml;
var newText = oldText.replace(/[0-9]+\.\s/i, '');
liElement.innterHtml = newText;
}
}
This replaces the numbers in a list that looks like this '1. Tag 2. Tag 3. Tag'

I haven't tested this code, but it should work(at least after some debugging), remember to insert the id of that tags list in there. I definitely prefer jQuery for a task like this.
Last edited by GreatDesire; 16th July 2011 at 16:04.
GreatDesire is offline
The Following User Says Thank You to GreatDesire For This Useful Post:
Old 16th July 2011, 18:37
Dustbunny
Dirth the First

Clinically Insane

Dustbunny's Avatar

Join Date: Feb 2010
Posts: 2,767
Thanks: 2,979
Thanked 59,086 Times in 2,643 Posts
Dustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a God
Default

Thanks, but I've already given up.
Replacing the prefix would mean altering the URL, so it won't point to the page anymore.
HTML Code:
<li><a href='http://host.net/123456/title.html'>Title</a></li>
<li><a href='http://host.net/changed/title.html'>Title</a></li>
The only thing possible is for the script to ignore the <a> tag and simply look at the string 'Title' and uses that for sorting. With the <a>, the oldest post will always have the lower numeral value making it useless for further sorting.

HTML Code:
<li><a href='http://host.net/00001/cherry.html'>Cherry</a></li>
<li><a href='http://host.net/00002/apple.html'>Apple</a></li>
<li><a href='http://host.net/00003/banana.html'>Banana</a></li>
This way, Apple will always stay in middle.

In summary, the value to sort ideally should be:
<li><a href='http://host.net/00001/cherry.html'>Cherry</a>

instead of this:

<li><a href='http://host.net/00001/cherry.html'>Cherry</a>

HTML Code:
<li><a href='http://host.net/00002/apple.html'>Apple</a></li>
<li><a href='http://host.net/00003/banana.html'>Banana</a></li>
<li><a href='http://host.net/00001/cherry.html'>Cherry</a></li>
__________________
Dustbunny is offline
Old 17th July 2011, 00:15
GreatDesire

Virgin

Join Date: Jul 2008
Posts: 13
Thanks: 33
Thanked 19 Times in 10 Posts
GreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud ofGreatDesire has much to be proud of
Default

Quote:
Originally Posted by Dustbunny View Post
Thanks, but I've already given up.
Replacing the prefix would mean altering the URL, so it won't point to the page anymore.
HTML Code:
<li><a href='http://host.net/123456/title.html'>Title</a></li>
<li><a href='http://host.net/changed/title.html'>Title</a></li>
The only thing possible is for the script to ignore the <a> tag and simply look at the string 'Title' and uses that for sorting. With the <a>, the oldest post will always have the lower numeral value making it useless for further sorting.

HTML Code:
<li><a href='http://host.net/00001/cherry.html'>Cherry</a></li>
<li><a href='http://host.net/00002/apple.html'>Apple</a></li>
<li><a href='http://host.net/00003/banana.html'>Banana</a></li>
This way, Apple will always stay in middle.

In summary, the value to sort ideally should be:
<li><a href='http://host.net/00001/cherry.html'>Cherry</a>

instead of this:

<li><a href='http://host.net/00001/cherry.html'>Cherry</a>

HTML Code:
<li><a href='http://host.net/00002/apple.html'>Apple</a></li>
<li><a href='http://host.net/00003/banana.html'>Banana</a></li>
<li><a href='http://host.net/00001/cherry.html'>Cherry</a></li>
Of course you can use that, that's what innerHtml is for, what's your complete javascript code for this?
GreatDesire is offline
The Following 2 Users Say Thank You to GreatDesire For This Useful Post:
Old 17th July 2011, 01:04
Dustbunny
Dirth the First

Clinically Insane

Dustbunny's Avatar

Join Date: Feb 2010
Posts: 2,767
Thanks: 2,979
Thanked 59,086 Times in 2,643 Posts
Dustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a GodDustbunny Is a God
Default

It's the altered version of the one I linked to:
Code:
 
 function sortUnorderedList(ul, sortDescending) {
 if(typeof ul == "string")
 ul = document.getElementById(ul);

 var lis = ul.getElementsByTagName("LI");
 var vals = [];

 for(var i = 0, l = lis.length; i < l; i++)
 vals.push(lis[i].innerHTML);

 vals.sort();

 if(sortDescending)
 vals.reverse();

 for(var i = 0, l = lis.length; i < l; i++)
 lis[i].innerHTML = vals[i];
 }
 
 window.onload = function() {
 var desc = false;
 sortUnorderedList("list", desc);
 desc = !desc;
 return false;
 
 }
I've got this working now actually as I'm typing this post.
I've shifting the order so that it's the li that gets declared in the function, so that the <a> takes the place of the <li>
Code:
function sortUnorderedList(li, sortDescending) {
 if(typeof li == "string")
 li = document.getElementById(li);

 var lis = li.getElementsByTagName("a");
But to my suprise, the next problem arises ....
(I'm going to type it in a new post, so you can actually read this one)
__________________
Dustbunny is offline
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:41.




vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
(c) Free Porn

Online free porn at mobile phone


artnou.ru only new scenes videos top studiospoca jones mobile adult videos free downloadglassfish hentaiAlexa Weix gifshea summercherry poppensComic hentai 3D Comic hentai 3Dria sunn pornstar forumsex gexsom.comandi valentinomisa campo pornjayden jaymes planetsuzyorgie vids download on 306 phonecache:L_anTCSUMlEJ:artnou.ru/t353892-nicole-aniston.html amia miley feetleilani leeane analamber lynn bach creampiechristina milian forums june 2016"veronica avluv" seth "30:41"g0nz0 p0rnvicca nudebritney rearsforum "desert rose" kody katie