JavaScript - Directory Listing Script
Hello all,
I will start off by saying that i have little javascript knowledge. Ok, now that is out of the way, lol, I want to make a program or firefox extension or something to that nature that will build a Web Server Directory Index by scanning the server for all files and displaying them like this: I don't know where to start, or if javascript is capable of doing this. (if not could you suggest a language better equipped to do this? ) The reason for such a project is for my own personal security reasons. *gets on soap box* I want to know exactly what is going on behind a website before i let it run a bunch of code that could potentially harm my computer (i listen to security now, and i know how bad some Javascript can be) and if i am going to a website i don't know, i wanna scan, and see for myself if there is malicious code running. Now i know what your thinking... "hey kam... there is such a thing as a firewall / virus protection" but i am the kind of guy that want's to see for myself instead of trusting someone else program to tell me what is good and bad.... *gets down from soap box* any help would be absolutely amazing. Thx in advance, Kam Similar TutorialsHi friends, I am collecting and selling football stickers. Yes, World Cup 2010 stickers. The album have 640 distinct numbers. Everytime I receive a list of that stickers to buy by the user I would need ckeck out the price list because some stickers have different price from another. For example Stickers numbers: 00, 000, 1, 2, 3, 4, 5 and 29 costs 3,00. The stickers number 31, 50, 69, 88, 107, 126, 202, 411, 392, 544 and 637 costs = 1,00. The stickers 30, 49, 68, 87, 106, 125 costs 0,25 The sticker from 32 to 48 51 to 67 70 to 86 89 to 105 (and so on) costs 0,25 I would be glad if someone could help me for building a script which read from a textarea numbers contents and create a "short report" with the stickers numbers followed by its price and total sum. Bob Kuspe is there a way to take my random shuffle script that displays the array like this red, yellow, blue, green, black, grey and make it so that it would list them like this red yellow blue green black grey Code: <script type="text/javascript"> function myFunction() { document.getElementById("demo").style.display="block"; var myarray=["red","blue", "yellow", "green","black", "grey"] myarray.sort(function() {return 0.5 - Math.random()}) var x=document.getElementById("demo").innerHTML=myarray; var t=setTimeout(alertMsg,10000); } function alertMsg() { document.getElementById("demo").style.display="none"; } </script> <button onclick="myFunction()">Twister Drill</button> <font size="5" color="white"> <p id="demo"><br/></p> </font> Okay first things first. Firebug this website http://www.locksmith.com/ You will see that they have a script in the head tag. That script is: Quote: <script class="yext-synd-74qWXpBkYak="> (function () { var el = document.createElement('script'); el.async = true; el.src = '//s.yext-listings.com/yext?aid=74qWXpBkYak%3D&city=&state=&zip=&latitude=&longitude='; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(el); })(); </script> They also have a form. That form is: Quote: <form title="Enter your zip and find a qualified, local locksmith" action="results.asp" method="POST"> <p><font style="font-size: 19px; font-weight: 700">FIND A LOCKSMITH</font> <input type="text" value="14646" style="font-family: Arial; font-size: 22px; color: #666666; font-weight:bold;" onclick="this.value=''" size="5" name="zip"> <input type="image" style="position: relative; top:5px" name="B1" src="images/smallgo2.jpg"> </p> </form> When you enter your zip code into that form, I think it is passed to the el.src variable as a parsed string and sent to s.yext-listings.com/ like this: //s.yext-listings.com/yext?aid=74qWXpBkYak%3D&city=&state=&zip=INSERT_ZIP_CODE_PASSED_FROM_THE_FORM_HERE&latitude=&longitu de= When you click the submit button on the form with an input zip code, it takes you to a page where there is a huge DIV block with this script executing inside it: Quote: <script class="yext-synd-74qWXpBkYak="> (function () { var el = document.createElement('script'); el.async = true; el.src = '//s.yext-listings.com/yext?aid=74qWXpBkYak%3D&city=&state=&zip=33405&latitude=&longitude='; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(el); })(); </script> Well the result on the second page is a listing pulled from a database and laid out in the second page in a DIV block. My question! How do I emulate this on my website? I have the Yext service. I have been on the phone with the company for over a week now and I cant get any technical support on the integration. Apparently they are having a lot of lay offs and technical support is unavailable. I am assuming that I need to build a form in HTML and have it pass the zip code to that JavaScript snippet somehow? I also want to know how the JavaScript on the second page renders a listing result from that passed form value? Thank you so much for the help in advance. I know you guys can figure this out before I do. hello recently i finally managed to make a working shopping cart system, in that i can add as many items as i want and it will work, all using cookies. Then i have another page, the cart which reads the cookie entry made with each demo purchase, then using a while loop lists these items, the problem i am having, is that when i add the textbox which would hold the value of the quantity, it is put out on the next line down, instead of next to the text which i find quite annoying. Also i would like to know how i can add a button next to the textbox, for updating the quantity, also ide like to know how i could access that button, or have it do something, since it wouldnt be prewritten. any help would be greatly apreciated. here is a zip file containing the html files of the customizable purchase page, and the new shopping cart. be sure to refresh the page before trying to use the first page, so it establishes the counter cookie. I need someone to point me in the right direction... I have been tasked with creating a phone directory at work. I found an example that kind of works for what I need he http://www.mollerus.net/development/..._directory.cfm But we have a larger number of employees and I need to be able to sort the directory by first name, last name, or department. Can anyone show me where to go? Is there a download somewhere? I'll post the code below of what we're currently using. It is functional, but not pretty by any means, and needs altered to produce what we need. I don't know JavaScript, this is something I found a couple years ago that suited our purpose, but now it doesn't anymore. The Script: Code: function setUp(info) { var v = document.getElementById('phonesearch').selectedIndex.toString(); var ln, fn, ext; var arr = new Array(); var sel = document.getElementById('phonelist'); for (var i = sel.options.length-1; i >= 0 ; i--) { sel.options[i] = null; } for(i = 0; i < phonelist.length; i++ ) { fn = phonelist[i][0]; ln = phonelist[i][1]; ext= phonelist[i][2]; switch (v) { // case "1" : zo = ln+', '+fn; zv = zo +' : '+ext; break; case "2" : zo = fn+' '+ln; zv = zo +' : '+ext; break; case "3" : zo = ext+' : '+ln+', '+fn; zv = zo; break; default: zo = ln+', '+fn; zv = zo +' : '+ext; break; } if (info != '') { if (zo.toUpperCase().indexOf(info.toUpperCase(),0) == 0) { arr.push(zo+'||'+zv); } } else { arr.push(zo+'||'+zv); } } arr.sort(); // Like the original order, comment out this line! var z = []; for (i=0; i<arr.length; i++) { z = arr[i].split('||'); sel.options[i] = new Option(z[0],z[1],false,false); } var z = 13; if (phonelist.length < z) { z = phonelist.length; } sel.size = z; if (info == '') { sel.focus(); } } The Form Code: <form name="menuform" onSubmit="return false"> <p class="style1">Select to search by first name, last name, or extension. Then click in the text box on the bottom and type in the first few letters of who/what it is you're looking for.</p> <p class="style1">Then, simply click the entry you need.</p> <select id="phonesearch" onchange="setUp('')" size="4"> <option value=""><i>Choose one</i></option> <option value="1">Last name</option> <option value="2" selected>First name</option> <option value="3">Extension</option> </select> <br /><br /> <select id="phonelist" onclick="alert(this.value)"></select> <br /><br /> <input type="text" id="srch" value="" onkeyup="setUp(this.value)" size="20"> <br /><a href="#" onclick="sel=document.getElementById('srch');sel.value='';setUp('');sel.focus()">Search Clear</a> </form> I have more than a hundred images (small ones though), which is a cut-to-pieces large image arranged in tables that I want to preload. I have been looking for a preload script that could possibly load all images in a folder by wildcard and if possible via JavaScript. Any suggestions? Any other language will be welcome as long as it will run on Linux. I have a good preload javascript here that I downloaded from hotscripts.com that displays a progress bar, percentage of download, and number of images downloaded. The bad thing is that creating an array out of a hundred images will be tedious especially with computer genereted filenames! If anyone knows of a program that could automate the process then we can forget the wildcard! Hehe! Hope someone has ideas . Thanks in advance. I have almost 300 photos that I want to have in a gallery that is easy to use. I would like to avoid making 300 list items (as is necessary with all of the auto rotators and other jquery plug ins that I've found) but to have the images load straight from the folder after the rest of the website has loaded. It wold be nice if maybe there was a pretty horizontal scroll bar or something and the image in the middle of the page was biggest if possible, but I'm really not picky. I don't know what the best way is to display so many photos! They don't need captions or anything. Any ideas??? Thanks! Hi, I'm attempting to add the following functionality to my site. Essentially, two images are displayed with a link "View More". The user clicks "View More" and the two images are replaced by two new images. This can be repeated as required. It's a basic form of slideshow I guess, but after some googling all the tutorials etc available seem to be more aimed at fully blown shows, whereas I believe my problem is much more simple. The images are contained in a directory and are numbered like so: img1.jpg, img2.jpg. img3.jpg and so on. the code I came up with so far is PHP Code: <script type="text/javascript" language="JavaScript"> start = '<img src="gallery/img'; end = '.jpg" width="150" height="200" />'; function getImage() { var n = Math.ceil(Math.random() * 10); // i have 10 images var FirstImg=(start+n+end); var n = Math.ceil(Math.random() * 10); var SecondImg=(start+n+1+end); } /* so now I think I have two variables: FirstImg = <img src="gallery/img1.jpg" width="150" height="200" /> SecondImg = <img src="gallery/img4.jpg" width="150" height="200" /> but i'm now unsure how i'd go about displaying this on the page. ideally the HTML generated would be: <div class="pics"> <p><FirstImg></p> <p><SecondImg></p> <a href="#" onClick="return getImage()">View More</a> </div> */ </script> Am I on the right lines here or am I way off?? Appreciate some pointers. thanks a lot. is there some way to searching through multiple path or recursively searching through a path (folders and subfolders) using the code below which seems to search only one node in the tree? Many Thanks. there are basically subfolders in \documents and then subfolders therein. i would like to search it therein for all kinds of files/filenames based on "search criteria". one more thing - is it ok/advisable to use active x objects considering most modern browsers have it disabled or give warnings? Code: <script> var Fo =new ActiveXObject("Scripting.FileSystemObject"); var StrOut = new String(); var FileName = new String(); var Extention = new String(); function FindFile(FOo) { var FSo = new Enumerator(FOo.Files); for(i=0;!FSo.atEnd();FSo.moveNext()) { if(FileName == "*" || FSo.item().name.slice(0,FSo.item().name.lastIndexOf(".")).toLowerCase().indexOf(FileName)>-1) if(Extention == "*" || FSo.item().name.slice(FSo.item().name.lastIndexOf(".")+1).toLowerCase().indexOf(Extention)>-1){ StrOut += "<tr "+ ((i%2)? "":"bgcolor=#C4E3F2") +"><td width=50%><font class=find>" + FSo.item().name + "</font></td><td width=25%><font class=find>" + FSo.item().type + "</font></td><td width=50%><font class=find>"+ String(FSo.item().size/(1024*1024)).slice(0,3) +" MB</font></td></tr>"; i++ } } } function Search() { FileName = (search.value.lastIndexOf(".")>-1)? search.value.slice(0,search.value.lastIndexOf(".")):(search.value.length>0)? search.value.toLowerCase():"*"; //Get Searched File Name Extention = (search.value.lastIndexOf(".")>-1)? search.value.slice(search.value.lastIndexOf(".")+1).toLowerCase():"*"; // Get Searched File Extention Name if(path.value.length>0 && Fo.FolderExists(path.value)){ StrOut = "<table border=0 width=100% cellspacing=0>" FindFile(Fo.GetFolder(path.value)); outPut.innerHTML = StrOut+"</table>"; } else alert("Insert Correct Path Address"); } </script> Code: <BODY topmargin="0" leftmargin="0"> <table border=0 width=100% cellspacing="0" style="border-collapse: collapse" cellpadding="2"><tr> <td dir="ltr" bgcolor="#FFD9D9"><b><font face="Verdana" size="2">Filename : </font></b> </td> <td dir="ltr" bgcolor="#C4E3F2"> <input size=50 type=text id=search name=search class="Find"></td> </tr><tr> <td dir="ltr" bgcolor="#C4E3F2"> <p dir="ltr"></td> <td bgcolor="#FFD9D9"><input size=50 type=hidden value="\Documents" id=path name=path class="Find" > <input type=button value="Search" onClick=Search() class="Find"></td> </tr><tr> <td colspan=2 align=left bgcolor="#FFFFFF"><font face=Verdana size=2><b>Search Result</b></font><hr></td> </tr><tr> <td colspan=2 bgcolor="#FFFFFF"><div id=outPut></div></td> </tr></table> </BODY> </HTML> Can someone explain how to deploy an application in red5 webapps directory? On a remote server? Or is this something I'd have to hire a consultant for? Thanks I would like to use functionality similar to DirectoryInfo and FileInfo using server-side javascript in ASP.NET, but neither are recognized. What are the equivalents, if they exist, in javascript?
I have some basic HTML knowledge but rely pretty heavily on WYSIWYG editors (dreamweaver). I think this might be more of a PHP question and not necessarily require a js, but here it is. What I am trying to do is learn how to build a directory in a site that allows any visitor to the site to add A) the company's name, B) the site URL, and C) possibly a brief description. Ideally, the site would also have a drop down menu to select the category in which to post it. Is this too big an undertaking? Any help is greatly appreciated. And if anyone knows a good list of PHP actions that would be very helpful. Hi All, I have two scripts which I want to try and integrate. I am using a nice gallery script to show thumbnails which are appended to a an image wrapper which on click of the thumbnail shows the larger image in the image wrapper, I am trying to implement cloud zoom which is a plugin which uses image srcs to then point to an anchor href to show another larger zoom image either in the same place.. which is what I am trying to do or in another div beside. I have had to set me img srcs up in a certain way to easily enter some product details. and I need to try an manipulate the code to make it work to suit my file layout. I am using a var= images [ with a series of file locations and info such as below { src: 'romanticabride/thumbs/tn_Shauna.jpg', srcBig: 'romanticabride/images/Shauna.jpg', title: 'Shauna', longDescription: '<b><H1>Shauna</H1></b><br><b>Romantica Of Devon <br><br><h2>Sizes Available:</h2><br> 6 - 32.<b><br><b><br><b><b><b><H2>Colours Available:</h2><b><br>Various<br>Please Enquire Below<br><br><br><br><a href="mailto:tracy@cherishbridal.co.uk?subject=Web Enquiry Regarding Romantica Shauna Bridal Gown"class="enquiry rose glow" >Click To Enquire About This Item </a>' }, what I need is for cloud zoom to work when the main image wrapper is hovered over which means it will need to add a class or when the whichever srcBig: is hovered over it gets wrapped by href to make the script work . one of my pages is http://www.cherishbridal.co.uk/romaticabride.html the cloud zoom script is at http://www.professorcloud.com/mainsite/cloud-zoom.htm.. I am happy to share a jsfiddle with someone or explain further or post some code. Thank you in advance I have a script that works in seamonkey(my html editor) but when I use it in IE8 it says errors happen. Here's the code (the first line is on line 7 of the html file): Code: <script type="text/javascript"> function enlarge(imageNum) { var numToString = ""; if(parseInt(imageNum) < 10){ numToString = "0" + imageNum; } else { numToString = imageNum + ""; } window.open("images/LgScreenshot"+numToString+".jpg","Screenshot "+imageNum,"status=0,height=675,width=900,resizable=0"); } </script> And the errors: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.3; .NET CLR 3.0.30729) Timestamp: Wed, 10 Feb 2010 14:58:16 UTC Message: Object expected Line: 150 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html Message: Invalid argument. Line: 18 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html does any expert know how to pass parameters in the <script ..> tag? for instance; Code: <script type="text/javascript" src="script.js ?param1=val1¶m2=val2&etc "> in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani On this website: http://evancoleman.net/index.php I really like on the top how the menu has like 5 or 6 icons, and when you hover over them it shows a bubble with the name in them. Does anybody know where I can find this script? Thanks. Hello again . If these questions concerning Regular Expressions are inappropriate in this forum please let me know . Thank You. This expression <script[^>]*>.*?</script> matches ... Code: <script type="text/javascript">var cnnIsHomePage = true;</script> but not ... Code: <script type="text/javascript"> var cnnIsHomePage = true; </script> Please , how can i match the latter ? Hi, I'm using the following Javascript code to show a div layer depending on the URL Code: <script type="text/javascript"> if (location.href.match(/folder/)) { document.getElementById("div-layer").style.display="block"; } </script> This works perfectly when I visit http://www.domain.com/folder but I do not want it to match any subfolders beneath /folder, for example: http://www.domain.com/folder/sub-folder http://www.domain.com/folder/sub-folder2 etc. Does anyone know how I can modify the code to only match /folder or /folder/ and no subfolders beneath it? Thank you in advance. Hey, I have a forum, and the forum has an rss feed. I want to take the most 10 recent posts from the feed and insert it into my Home page. I have no clue how to do this. At the moment I have been manually entering the posts as you can see here. All the recent posts on the right side of the page are manually entered by me from my forum. Just wondering if anyone could guide me in a direction to do this programmatically. |