JavaScript - Looping Javascript In Facebook.
First time poster. so be kind
Hi All, I have found a bit of shared code on the net that can be used on Facebook. The way it is used is on profiles, or groups, that extend beyond an original page. You load the page and then paste the script into the address bar (in FF and chrome) and hit enter. This then goes down and looks for the 'older post' tag and expands it every 4 seconds. When it gets to the end of the group, it does not stop, it just goes into a loop and restarts from the beginning. I am wanting help to get it to stop at the end of the first pass. This is the code: Code: javascript:function clrt(){alert('Stopped Post Load');if(f_sM){clearTimeout(f_sM);}};function showMore(){ProfileStream.getInstance().showMore();f_sM = setTimeout(showMore, 4000); xsm=document.getElementById('profile_pager_container');xsm.addEventListener('click',clrt,false)}; showMore(); I have also seen it done, with the same looping results, with this code: Code: javascript:function showMore() {ProfileStream.getInstance().showMore(); setTimeout(showMore, 4000)} showMore(); Can anyone help please? Thanks Similar TutorialsSo my mom owns a business and has a facebook page (for her business.) I want to know how to create a javascript that will make anyone who views her facebook page automatically like it. Is this illegal? Can anyone help? x em-jay x Ok so this is probably a simple question but i have hit a wall he So I have 20 arrays with incremental names (course1, course2, course3 ...) What i want to make is a selection box with 20 options. for each option the value would be course1[0] and the text shown would be course1[1]. if i write this code: <code> for (var i=1; i<=20; i++){ var select = document.getElementById("selectiontest") select.options[select.options.length] = new Option (course1[1], course1[0]) } </code> The code works and the correct array values are put as the option text and value. I am having trouble getting the loop to move from course1 to course2, i used the loop counter in the array name like this: <code> for (var i=1; i<=20; i++){ var select = document.getElementById("selectiontest") select.options[select.options.length] = new Option (('course'+i)[1], ('course'+i)[0]) } </code> this is where it stops working. I get 20 values of o. which i assume is the second character of course. How do i tell javascript to incrementally change the array name during the loop? Hi everyone. I'm trying to figure out how to make it so that when someone enters a number in the first textbox to start counting from and then they enter a second number where to stop counting. then the user must enter a number to step up/down by when counting.. there are 3 textboxes, one for start, one for end and one for the step up/down. When the user pushes the button the page clears and then the numbers will show.. If they use the same starting and ending number they have to be alerted that it is not valid. The user can enter a starting number bigger than the ending number. Take into account that a user might enter a positive or negative step value any tips or guidance for this is very appreciated Hi All, Im looking for someone that is great with java script and facebook i have a java app right now i want to add the feature to post to friends walls and so i can change that number as well so if someone clicks on the app the script all ready post to there wall but i want it to post to 15 - 25 of there friends walls over even all friends walls as well. Need these added asap i do have some java that does this all ready just need it added to the script Thanks Hey guys, I have this site http://free-documentaries-online.com . If you go to any documentary page and look under the documentary you will see 'Share this documentary:' like the picture below. I was wondering if you could make all the pictures have a similar size image? facebook.jpg, twitter.jpg, linkedin.jpg, digg.jpg, stumbleupon.jpg, delicious.jpg Here is the code: Code: <a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="freedocosonline">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <script src="http://www.stumbleupon.com/hostedbadge.php?s=4"></script> <a href="http://www.delicious.com/save" onclick="window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;"> <img src="http://free-documentaries-online.com/images/delicious.jpg" width="20" height="20" alt="Delicious" title="Add to Delicious!" /></a> <script type="text/javascript"> (function() { var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; s.type = 'text/javascript'; s.async = true; s.src = 'http://widgets.digg.com/buttons.js'; s1.parentNode.insertBefore(s, s1); })(); </script> <a class="DiggThisButton DiggIcon"></a> <a rel="nofollow" target="_blank" href='http://www.facebook.com/sharer.php?u=http://free-documentaries-online.com/watch/index?watch=<? echo "$foldername"; ?>'> <img border="0" src="../images/facebook.jpg" width="20" height="20"></a> <script type="text/javascript" src="http://platform.linkedin.com/in.js"></script><script type="in/share"></script></center> Thanks in advance I have the two following code snips im working with... <script type="text/javascript"> var url=document.location.href; document.write(url) </script> & the facebook comments box code: <div class="fb-comments" data-href="url" data-num-posts="20" data-width="550" data-colorscheme="dark"></div> I for the life of me cant figure out how to get the variable "url" into the href for the FB comment box. I'd like to do this so no matter what page the complete code is placed on it knows what page to associate the box with, without individual page editing. I'm new to javascript and can generally do some research and figure out what im doig but this has me baffled :| If anyone has the answer it would be GREATLY appreciated!! Thanks in advance :) i am developing a facebook application and i have this code here which queries the user id and other information: Code: $users = $facebook->api(array('method' => 'fql.query', 'query' => "SELECT uid, last_name, pic_big FROM user WHERE uid IN( SELECT uid FROM page_fan WHERE page_id='411133928921438' AND uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() ))")); I need to store the user id in an array so i can send invitation only to the users in the array generated. Code: function newInvite(){ var user_ids = ["1368246891", "1206927311", "1149862205"]; FB.ui({ method: 'apprequests', message: 'There goes the message for Penelope App users to invite their friends', to: user_ids, }); } THe user_ids must be the array which holds the user id genrated from the fql query... Help me with this... I have this script added to a facebook icon (#id) on my front page: (function() { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); })(); window.fbAsyncInit = function() { var fbClicked = false; FB.init({appId: 'Myappid', status: true, cookie: true, xfbml: true}); FB.Event.subscribe('auth.login', function(response) { if(response.session && fbClicked){ window.location = 'http://www.mysite.com/facebookauth/?ref=/'; } }); } function thFBShortCut() { FB.login(function(response) { fbClicked = true; if (response.session && response.perms && fbClicked) { window.location = 'http://www.mysite.com/facebookauth/?ref=/'; } }, {perms:'email,publish_stream'}); } function thFBLogin() { fbClicked = true; $('.popbox').fadeOut(); FB.getLoginStatus(function(response) { if(response.session && response.status == 'connected' && fbClicked) { window.location = 'http://www.mysite.com/facebookauth/?ref=/'; } }); } I want when whenever user press on facebook icon, the script should trigger facebook connect app. I added `<div id="fb-root"></div>` right after `<body <?php body_class(); ?>>`, but when I load my site I keep getting these error messages: document.getElementById("fb-root") is null and FB is not defined [Break On This Error] FB.login(function(response) { My html: <a id="facebookicon" onclick="thFBShortCut()">Login</a> Hi, I am trying to implement something like a javascript that can click and focus the Status Update Box on Facebook. Till now, I have nothing in hand that can perform the task so I thought about a javascript that can do it. I am not even a newbie to javascript but I know that it can perform various complicated tasks on client side. Can anyone here tell me how do I click the Status Update box and set it to focused by a javascript so that when I start typing the Status box receive the text ? Thanks hi there, I need to ask my users to input some numbers via textbox(or prompt) using a DELIMITER (,) between each digit. Then The program will display(list) when clicking a button. for this I will use three columns in the first column I have (2,4,6,9) to prompt. in the second column I have (3,4,7,10) to prompt. in the third columns I have (5,6,11,14) to prompt so the first lines should look like: 2,3,5 2,3,6 2,3,11 .... .... .... and the last line : 9,10,14 there should be 4x4x4=64 rows/lines How can we achieve this ? Thanks in advance hi to all... good day to u all... i have a noob question i followed this instruction Code: for (count=1; count<11; count++) { javascript code here } at the bottom of my page i did this Code: <script type="text/javascript"> for (counter=1; counter<11; counter++) { var followTrigger+counter+a = new Spry.Widget.Tooltip('following'+counter+'a', '#followMe'+counter+'a', {followMouse: true}); } </script> what im trying to do is to make multiple of this Code: <script type="text/javascript"> var followTrigger1a = new Spry.Widget.Tooltip('following1a', '#followMe1a', {followMouse: true}); var followTrigger2a = new Spry.Widget.Tooltip('following2a', '#followMe2a', {followMouse: true}); var followTrigger3a = new Spry.Widget.Tooltip('following3a', '#followMe3a', {followMouse: true}); var followTrigger4a = new Spry.Widget.Tooltip('following4a', '#followMe4a', {followMouse: true}); var followTrigger5a = new Spry.Widget.Tooltip('following5a', '#followMe5a', {followMouse: true}); var followTrigger6a = new Spry.Widget.Tooltip('following6a', '#followMe6a', {followMouse: true}); var followTrigger7a = new Spry.Widget.Tooltip('following7a', '#followMe7a', {followMouse: true}); var followTrigger8a = new Spry.Widget.Tooltip('following8a', '#followMe8a', {followMouse: true}); var followTrigger9a = new Spry.Widget.Tooltip('following9a', '#followMe9a', {followMouse: true}); var followTrigger10a = new Spry.Widget.Tooltip('following10a', '#followMe10a', {followMouse: true}); </script> i dont know why it wont work... any help pls... public static void main(String[] args){ int oddNo; oddNo = getOdd(); } public static int getOdd(){ int oddNo = 0; Scanner sc = new Scanner(System.in); while (oddNo % 2 == 0){ System.out.print("Enter an odd number : "); oddNo = sc.nextInt(); System.out.println("Wrong input ! "); } if (oddNo % 2 !=0); System.out.print("The odd number is : " + oddNo); return oddNo; } however, the output: Enter an odd number : 10 Wrong input ! Enter an odd number : 8 Wrong input ! Enter an odd number : 9 Wrong input ! (how to remove this?) The odd number is : 9 I need to loop through an array like this one: [1,2,4,8,8,16,32,64] I don't really know how to do this, so a little guidance would be great. Basically, I have 4 vars: a b c and d in the form of (ax + b)(cx + d) inside the loop something like this: i++ a = array[i] If (a*b > Math.floor(a) && a*b < Math.ceil(a)){ then increment i again and do the loop again} else{ break the loop and set leave a = array[i] } A code sample or something would be really nice (I don't know how to do the parts that are written out in text... Thanks! } Hi all, I use a forum hosting provider called forumotion and they have a chatbox feature on it. When a new message arrives I would like it to say so in the browser tab like facebook does. Here is the current code I am using: Code: <div id="fbfcbframe" style="display:none;background:white;padding:0px;position:fixed;bottom:25px;right: 23px;border:1px solid black;width:900px;"><div style="font-family:'lucida grande',tahoma,verdana,arial,sans-serif;font-size:11px;background-color: #526EA6;margin:-1px;margin-bottom:0px;padding: 4px 8px 5px;color:white;border-bottom: 1px solid #526EA6;border: 1px solid #254588;text-align:left;">Chat | <a href="http://www.thefacebookforum.net/Chat-Rules-and-Reminders-h22.htm"><font color="white">Rules and Reminders</font></a> | <a href="http://www.thefacebookforum.net/Chatbox-Reports-h33.htm" title="Submit your report"><font color="white"> Make a Report</font></a> <div style="height:16px;width:16;text-align:center;cursor:pointer;position: absolute;right: 5px;top: 2px;" id="minimize" onClick="this.parentNode.parentNode.style.display='none';document.getElementById('fbfcb').className='unclicked'"><div style="margin-top:10px;background-color: #ADBED8;float: right;height: 2px;overflow: hidden;width: 9px;"></div></div></div> <iframe id="cbframe" src="/chatbox/chatbox.forum"></iframe></div><script>document.getElementById('fbfcbframe').childNodes[1].onClick="document.getElementById('fbfcb').click();return 0";function toggleframe(){var x=document.getElementById('fbfcbframe').style;if(x.display=='none'){x.display='block';}else{x.display='none';}}</script><div id="fbfcb" class="unclicked" onClick="toggleframe();if(this.getAttribute('class')=='unclicked'){this.className='clicked'}else{this.className='unclicked'}"><img src="_.gif" style="width:16px;height:16px;margin-bottom:-2px;position:relative;bottom:-5px;left:-3px;background: transparent url(http://static.ak.fbcdn.net/rsrc.php/z3O30/hash/3wq3vjh4.png) no-repeat scroll -631px -101px;"> Chat</div> <style> #cbframe{border:0px solid black;height:290px;margin:-2px;margin-bottom:0px;width:900px;background:transparent}#fbfcb{width:188px;cursor:pointer;padding:3px 12px;background:url(http://static.ak.fbcdn.net/rsrc.php/z1V2B/hash/apfsevhg.png) repeat-x 0px 0px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;font-size:11px;padding-bottom:6px;border-top:1px solid #b5b5b5;border-right:1px solid #b5b5b5;border-left:1px solid #b5b5b5;-webkit-user-select:none;text-align:left !important;position:fixed;bottom:0px;right:23px}#fbfcb:hover{width:188px;cursor:pointer;padding:3px 12px;padding-bottom:6px;background:white;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;font-size:11px;border-top:1px solid #c5c5c5;border-right:1px solid #c5c5c5;border-left:1px solid #c5c5c5}.clicked{background:white !important;border:1px solid black !important;border-top-width:0px !important}.unclicked{}#minimize{height:16px;width:16;text-align:center;cursor:pointer;position:absolute;right:5px;top:2px}#minimize:hover div{background:white !important} </style> <span id="cbalarm"></span> <script type="text/javascript"> var cbmp3='http://fsb.zedge.net/content/2/3/3/3/4-813701-23333571.mp3'; var cbverif=1; var cbbegin=3; function getlastcb(){ if(jQuery('#cbframe').contents().find('#chatbox > p:last-child').length==0) return ''; else return jQuery('#cbframe').contents().find('#chatbox > p:last-child').html(); } function checkcb(){ if(getlastcb()==oldcb) return; oldcb= getlastcb(); if(oldcb=='') return; jQuery('#cbalarm').html('<object id="cbalarm" type="application/x-shockwave-flash" data="http://www.fileden.com/files/2010/6/2/2877694//dewplayer-mini.swf" width="0" height="0" style="visibility:hidden"><param name="movie" value="http://fsb.zedge.net/content/2/3/3/3/4-813701-23333571.mp3" /><param name="flashvars" value="mp3='+cbmp3+'&autoplay=1" /></object>'); } setTimeout("var oldcb=getlastcb();setInterval('checkcb()',cbverif*1000);",cbbegin*1000); </script> I know it is messy, it is to prevent rippers on forumotion. Code: function funt() { var link = document.getElementsByClassName("class")[0]; if(link != null) { var i = 0; if(check != link.childNodes[i]) { link.childNodes[i].click(); check = link.childNodes[i]; } else { window.location = "website" } } else { if(document.getElementById('enbut').value != "some value") { document.getElementById('id').click(); } window.location = "website" } t=setTimeout("funt()",3000); } with this i'm trying to get it to loop every 3 seconds using the settimeout function at the end of the loop. each time i run this it just runs once and exits. anyone know what i'm doing wrong? Hi Guys, I am trying to create a game similar to this https://www.carchallenge2014.com/practice.php What I want to know is how can I run a script so that the script will be able to click on the hands and increase the score. Willing to pay for the help as well. Tks hat i'm trying to achieve is to add two numbers using do while loop. below is the code however result wont show up. i cant seem to determine the error. help me pls. Quote: <script = "text/javascript"> function myanswer(x,y){ x=parseInt(x); y=parseInt(y); i=1; sum=0; do { sum=x+i; i++; } while(i<y) document.myform.asnwer.value=sum; } </script> <form name='myform'> Enter First number:<input type='text' name='x'></br> Enter Second number:<input type='text' name'y'></br> Result:<input type='text' name='answer'></br> <input type='button' value='Click on Me!' onclick="myanswer(myform.x.value,myform.y.value);"</br> </form> I have a script where I can PregReplace soething in a string with a defined value from my input field and it works like a charm. Code: <?php echo '<input id="pfrom" type="text" value="" name="pfrom">'; ?> <script> function demoRegex(){ var txt = document.newform.thestring.value; var re = new RegExp(document.newform.pfrom.value, "g"); newtxt = txt.replace(re,''); alert(newtxt); } </script> But what if I have multiple input field like this: PHP Code: foreach($arr as $arr1=>$value){ echo '<input id="pfrom" type="text" value="" name="pfrom[]">'; } How do I get the javascript to run through all the fields? Hoping for help.... Thanks in advance ;-) We were given a task at school today. Basically we need to have a prompt box popup, and the user enters numbers 1-12 (1 for each month of the year). The prompt keeps popping up until the user types "stop". It will display the months that were entered. Could anyone assist me with this, thanks. What I want to make is an html that loop between 2 websites. so it starts out at website "a" (site "a" does have a timer that will redirect on its own) then it switches to website "b", and that goes on for 30 seconds and then switch back over to website "a" and so on forever. If someone could help me out with this, it would be greatly appreciated |