Jump to content

freddyw

Members
  • Posts

    104
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

freddyw's Achievements

Member

Member (2/5)

0

Reputation

  1. Okay so the script I have so far works great. It does the job I originally intended. However, I want to take this script to the next level. What my script does: I enter in URL's for images from around the web into the text area. I click the submit button named "Show Images" And thumbnails of all the images show up on that page. If I click an image it opens up in a new webpage. That's what I originally wanted. But now I want to adapt. Which is this... <html> <head><Title> EffDub Image Loader</title> <!--An EffDub Creation In Association With NavNet! Please do not steal Completion date tested working 10/07/2010 Any bugs report to lazyfred@hotmail.co.uk--> </head> <style> input {background-color: red; } </style> <script type="text/javascript"> function showImages() { var urlListTxt = document.getElementById('urls').value; var urlListAry = urlListTxt.split('\n'); //Process inpur for valid urls var validURLsAry = new Array(); for(var idx=0; idx<urlListAry.length; idx++) { if(urlListAry[idx]!='') //Add condition to test for valid urls { validURLsAry[validURLsAry.length] = urlListAry[idx]; } } //Create the output var imgListOutput = ''; var url; for(var idx=0; idx<validURLsAry.length; idx++) //change preview size { url = validURLsAry[idx]; imgListOutput += '<a href="'+url+'" target="_blank"><img src="'+url+'" height="150" width="150" /></a>'; } document.getElementById('imgListDiv').innerHTML = imgListOutput; } </script> <body> Paste images into the text box<br> When images load, click on an image to see the image full size in a new tab.<br> <textarea name="urls" id="urls" style="height:150px;width:600px;"> </textarea> <br /> <button onclick="showImages();">Show Images</button> <br /><br /> <div id="imgListDiv"></div> </body> </html> I would like a checkbox to appear under each image. and a Select all/none checkbox with a download button. Then the selected images download to the specified folder. This is always run locally, therefore I'm hoping javascript will work. I can run this page from a server but I would rather not. As the images are already on the web, and its only the page that runs local, is it possible to achieve this? If this how. I have no idea, im wanting to advance further that my knowledge will let me.
  2. Why does it have to be PHP. couldn't i use JS and define the size of the images to be shown. If it has to be PHP thats fine. When the user enters the images is there an easy way to load the images into an array. The images entered will all be on a separate line. Also the images don't need to be uploaded to the server.
  3. Is it possible to create a textbox where you can insert urls of images (unlimited, so there's no maximum amount of images) then click submit and you have a webpage full of thumbnails that are clickable to make full size? Any help on where to start would be appreciated.
  4. Hey people. Here's something I'm trying to do and really cant figure out how to go about it. So I have a webpage and inside the webpage this piece of code appears several times <span class="icon private"></span> <div class="meta"><span>190 Images</span></div> The amount of times that piece of code appears is never certain. Nor is the number (or integer if we must) that is inside it. What I'm trying to create is a Greasemonkey script that will take the number from inside that snippet of code each time it appears and add them up and produce a total. Any thoughts are greatly appreciated.
  5. Im coming a bit stuck I now have this... <html> <head> <title>Reomove Dupes</title></head> <body> <form onsubmit="removeDups(); return false;"> <textarea rows="30" cols="100" id="list"> </textarea> <br> <input type="submit" value="Submit" /> </form> <script type="text/javascript"> function noDupes (arr) { var tmp = new Array(), results = new Array(); for (var m = arr.length - 1; m > -1; m--) { if (tmp[arr[m]] === undefined) tmp[arr[m]] = 1; else tmp[arr[m]] = undefined; } for (var t in tmp) { if (t !== undefined) results.push(t); } return results; } function removeDups() { var txtbox = document.getElementById("list"); txtbox.value = noDupes(txtbox.value.split(/\n/)).join("\n"); } </script> </body> </html> if i type the and and im left with (after clicking submit twice) the and I want to completely remove what was duplicated meaning the only word left in the box would be 'the' Any ideas? please?
  6. There's a website when you go to it, it asks you to save or d/l the source code. In that source code is one image that's .jpg Is there a way to write a grease monkey script so when you go that page you download the image. Its a different image each time but always .jpg. I want a script that says check source for a jpeg and download it. Thanks
  7. Brilliant! Thanks guys Appreciate the help
  8. Thanks for the reply. The order isnt important at all
  9. So basically im trying to create a function that checks lines entered into a text box that removes duplicates completely. For example in the text box this is wrote. The And To What Where The One And Where I dont want duplicates changing to one. I want them out. So it reads To What One Just a starting point would help please.
  10. Hi there. Im doing a research poster on the effects of internet addiction. Rather than having boring white boxes I decided to craete alert boxes (custom so I can title each box). then I'll do a print screen and drop it onto the poster. My problem is the text is longer than the search box. The width is fine its just the length. Is there a way to auto adjust the length so the alert box is the correct height. <HTML> <BODY> <STYLE type="text/css"> .okButton { background-color: #D4D4D4; font-color: #000000; font-size: 9pt; font-family: arial; width: 70px; height: 20px; } .alertTitle { background-color: #3C56FF; font-family: arial; font-size: 9pt; color: #FFFFFF; font-weight: bold; } .alertMessage { font-family: arial; font-size: 9pt; color: #000000; font-weight: normal; } .alertBoxStyle { cursor: default; filter: alpha(opacity=90); background-color: #E4E4E4; position: absolute; top: 200px; left: 200px; width: 100px; height: 50px; visibility:hidden; z-index: 999; border-style: groove; border-width: 5px; border-color: #FFFFFF; text-align: center; } </STYLE> <div id="alertLayer" class=alertBoxStyle></div> <SCRIPT LANGUAGE="JavaScript"> function BrowserCheck() { var b = navigator.appName; if (b == "Netscape") this.b = "NS"; else if (b == "Microsoft Internet Explorer") this.b = "IE"; else this.b = b; this.v = parseInt(navigator.appVersion); this.NS = (this.b == "NS" && this.v>=4); this.NS4 = (this.b == "NS" && this.v == 4); this.NS5 = (this.b == "NS" && this.v == 5); this.IE = (this.b == "IE" && this.v>=4); this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0); this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0); if (this.IE5 || this.NS5) this.VER5 = true; if (this.IE4 || this.NS4) this.VER4 = true; this.OLD = (! this.VER5 && ! this.VER4) ? true : false; this.min = (this.NS||this.IE); } is = new BrowserCheck(); alertBox = (is.VER5) ? document.getElementById("alertLayer").style : (is.NS) ? document.layers["alertLayer"] : document.all["alertLayer"].style; function hideAlert(){ alertBox.visibility = "hidden";} function makeAlert(aTitle,aMessage){ document.all.alertLayer.innerHTML = "<table border=0 width=100% height=100%>" + "<tr height=5><td colspan=4 class=alertTitle>" + " " + aTitle + "</td></tr>" + "<tr height=5><td width=5></td></tr>" + "<tr><td width=5></td><td width=20 align=left><img src='alert.gif'></td><td align=center class=alertMessage>" + aMessage + "<BR></td><td width=5></td></tr>" + "<tr height=5><td width=5></td></tr>" + "<tr><td width=5></td><td colspan=2 align=center><input type=button value='OK' onClick='hideAlert()' class=okButton><BR></td><td width=5></td></tr>" + "<tr height=5><td width=5></td></tr></table>"; thisText = aMessage.length; if (aTitle.length > aMessage.length){ thisText = aTitle.length; } aWidth = (thisText * 5) + 80; aHeight = 100; if (aWidth < 150){ aWidth = 200; } if (aWidth > 350){ aWidth = 350; } if (thisText > 60){ aHeight = 110; } if (thisText > 120){ aHeight = 130; } if (thisText > 180){ aHeight = 150; } if (thisText > 240){ aHeight = 170; } if (thisText > 300){ aHeight = 190; } if (thisText > 360){ aHeight = 210; } if (thisText > 420){ aHeight = 230; } if (thisText > 490){ aHeight = 250; } if (thisText > 550){ aHeight = 270; } if (thisText > 610){ aHeight = 290; } alertBox.width = aWidth; alertBox.height = aHeight; alertBox.left = (document.body.clientWidth - aWidth)/2; alertBox.top = (document.body.clientHeight - aHeight)/2; alertBox.visibility = "visible"; } </SCRIPT> <INPUT TYPE=button value="Alert" onClick="makeAlert('Abstract','This poster looks at the cause an reasoning for compulsive surfing. A trend has appeared over recent years and it seems more people are surfing simply due to Internet Addiction Disorder (IAD). There are many theories whether or not IAD is a real disorder. There is currently a debate whether to include IAD in 2012\’s Diagnostic and Statistical Manual of Mental Disorders (DSM).<br/><br/>“Many people are convinced that \‘Internet addiction\’ does exist, but it is possible that some of these advocates might be making money from promoting Internet addiction as an actual disorder.\” <br/>(Johnson, 2009, 10)<br/>People go online, usually with one objective in mind and become distracted by the opportunities online. It appears that wherever your interests lie, you will find something in that area online to distract you. Whether it be downloading the latest movie, catching the newest music video, chatting with friends, looking up guitar tabs, the list is endless. This poster uncovers why people become so distracted when they go online. If IAD is causing people to miss out on real life, neglect family, friend and their own needs such as sleep. It will also look at whether there is a link between IAD and depression.');"> </BODY> </HTML>
  11. Thanks. Ive cleaned it up. All looking good. The form is no longer working. I can hit enter, and the form works. But the submit button does nothing. My form code must be right for the form to work (when enter is pressed). So i guess my error is in the input type = submit section of the code. The form is connecting to a php script (which is correctly coded), the php script grabs data from twitter and puts it in an iframe on the html page. But why wont the submit button work? <form action="getkey.php" method ="post" target="results"> Search Twitter for...<input type="text" name="key"> <br> <input type="button" value="Search"> </form>
  12. Okay in my second form the submit is above the form and doesnt work. Also i have poitioned my iframe on the right hoping the 2 forms would stay in there place but they have moved down the screen below the iframe. I want the submit button under the form (and working). I also want the 2 forms moving up the screen. any help please? <html> <head><Title>Tweet to the world your thoughts on the news</title> </head> <iframe src="http://www.google.com/uds/modules/elements/newsshow/iframe.html?format=300x250" frameborder="0" width="300" height="250" marginwidth="0" marginheight="0"> </iframe> <P ALIGN="right"><iframe name="results" src="getkey.php" style='width: 500px; height: 1000px; border: 1px solid #000000; align: right;' name='test'></iframe></P> <div id="addtweet"> <table width='100%' height='100%'> <form action="tweet.php" method ="post"> <table> <tr><td align=right> <tr><td> <tr><td>Twitter Username:</td><td><input type="text" name="username" /> </td></tr> <tr><td>Twitter Password:</td><td><input type="password" name="password" /> </td></tr> <tr><td>Tweet:</td><td><input type="text" name="tweet" /> </td></tr> <tr><td align=right> <INPUT TYPE="button" value="add tweet"/> </td></tr> </form> </table> </div> <br><br> <div id="search"> <table width='100%' height='100%'> <form action="getkey.php" method ="post" target="results"> <table> <tr><td> <tr><td>Search Twitter for...:</td><td><input type="text" name="key" /> </td></tr> <INPUT TYPE="button" value="Search" /> </td></tr> </form> </table> </div> </html>
  13. Thanks I had already tried that and it clears the info in the iframe
  14. Hello fellow freaks. I've been trying allsorts and im stumped. It seems like what I'm trying isn't possable. I have an Iframe on my homepage. Inside the iframe is content loaded in from the twitter search API. So if u search NBC it would load the latest 10 tweets containing nbc, If you did this on twitter it would keep reloading. On my site the ten tweets are in an iframe and dont refresh. If i hit the refresh button, the content in the iframe goes. If i head have a meta auto refresh in the head, the content goes. I need the page to auto refresh but i need the iframe to remember the search from the PHP.
  15. Splitting a webpage. Hi there Im using the twitter API. When a user searches for a twitter story they are directed to a new page. however what i would prefere to have is a window on the right hand side of the page where the search results are displayed. My code is in three stages which is the HTML <html> <div id="search"> <table width='100%' height='100%'> <form action="getkey.php" method ="post"> <table> <tr><td> <tr><td>Search Twitter for...:</td><td><input type="text" name="key" /> </td></tr> <INPUT TYPE="button" value="Search" /> </td></tr> </form> </table> </div> </html> getkey.php <?php $key = $_POST['key']; include('search.php'); $twitter_query= '"'.$key.'"'; $search = new TwitterSearch($twitter_query); $results = $search->results(); foreach($results as $result){ $status=toLink($result->text); $pos = stripos($status,$key); echo "<div>"; echo substr($status,0,$pos)."<br />"; echo "<b>".strtoupper($key)."</b>".substr($status, $pos+count($key))."<br />"; echo "</div>"; //$display = $status.explode("i wish"); //echo $display[0]; } ?> and search.php <? /** * Wrapper class around the Twitter Search API for PHP * Based on the class originally developed by David Billingham * and accessible at http://twitter.slawcup.com/twitter.class.phps * @author Ryan Faerman <ryan.faerman@gmail.com> * @version 0.2 * @package PHPTwitterSearch */ class TwitterSearch { /** * Can be set to JSON (requires PHP 5.2 or the json pecl module) or XML - json|xml * @var string */ var $type = 'json'; /** * It is unclear if Twitter header preferences are standardized, but I would suggest using them. * More discussion at http://tinyurl.com/3xtx66 * @var array */ var $headers=array('X-Twitter-Client: PHPTwitterSearch','X-Twitter-Client-Version: 0.1','X-Twitter-Client-URL: http://ryanfaerman.com/twittersearch'); /** * Recommend setting a user-agent so Twitter knows how to contact you inc case of abuse. Include your email * @var string */ var $user_agent=''; /** * @var string */ var $query=''; /** * @var array */ var $responseInfo=array(); /** * Use an ISO language code. en, de... * @var string */ var $lang; /** * The number of tweets to return per page, max 100 * @var int */ var $rpp; /** * The page number to return, up to a max of roughly 1500 results * @var int */ var $page; /** * Return tweets with a status id greater than the since value * @var int */ var $since; /** * Returns tweets by users located within a given radius of the given latitude/longitude, where the user's location is taken from their Twitter profile. The parameter value is specified by "latitide,longitude,radius", where radius units must be specified as either "mi" (miles) or "km" (kilometers) * @var string */ var $geocode; /** * When "true", adds "<user>:" to the beginning of the tweet. This is useful for readers that do not display Atom's author field. The default is "false" * @var boolean */ var $show_user = false; /** * @param string $query optional */ function TwitterSearch($query=false) { $this->query = $query; } /** * Find tweets from a user * @param string $user required * @return object */ function from($user) { $this->query .= ' from:'.str_replace('@', '', $user); return $this; } /** * Find tweets to a user * @param string $user required * @return object */ function to($user) { $this->query .= ' to:'.str_replace('@', '', $user); return $this; } /** * Find tweets referencing a user * @param string $user required * @return object */ function about($user) { $this->query .= ' @'.str_replace('@', '', $user); return $this; } /** * Find tweets containing a hashtag * @param string $user required * @return object */ function with($hashtag) { $this->query .= ' #'.str_replace('#', '', $hashtag); return $this; } /** * Find tweets containing a word * @param string $user required * @return object */ function contains($word) { $this->query .= ' '.$word; return $this; } /** * Set show_user to true * @return object */ function show_user() { $this->show_user = true; return $this; } /** * @param int $since_id required * @return object */ function since($since_id) { $this->since = $since_id; return $this; } /** * @param int $language required * @return object */ function lang($language) { $this->lang = $language; return $this; } /** * @param int $n required * @return object */ function rpp($n) { $this->rpp = $n; return $this; } /** * @param int $n required * @return object */ function page($n) { $this->page = $n; return $this; } /** * @param float $lat required. lattitude * @param float $long required. longitude * @param int $radius required. * @param string optional. mi|km * @return object */ function geocode($lat, $long, $radius, $units='mi') { $this->geocode = $lat.','.$long.','.$radius.$units; return $this; } /** * Build and perform the query, return the results. * @param $reset_query boolean optional. * @return object */ function results($reset_query=true) { $request = 'http://search.twitter.com/search.'.$this->type; $request .= '?q='.urlencode($this->query); if(isset($this->rpp)) { $request .= '&rpp='.$this->rpp; } if(isset($this->page)) { $request .= '&page='.$this->page; } if(isset($this->lang)) { $request .= '&lang='.$this->lang; } if(isset($this->since)) { $request .= '&since_id='.$this->since; } if($this->show_user) { $request .= '&show_user=true'; } if(isset($this->geocode)) { $request .= '&geocode='.$this->geocode; } if($reset_query) { $this->query = ''; } return $this->objectify($this->process($request))->results; } /** * Returns the top ten queries that are currently trending on Twitter. * @return object */ function trends() { $request = 'http://search.twitter.com/trends.json'; return $this->objectify($this->process($request)); } /** * Internal function where all the juicy curl fun takes place * this should not be called by anything external unless you are * doing something else completely then knock youself out. * @access private * @param string $url Required. API URL to request * @param string $postargs Optional. Urlencoded query string to append to the $url */ function process($url, $postargs=false) { $ch = curl_init($url); if($postargs !== false) { curl_setopt ($ch, CURLOPT_POST, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs); } curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_NOBODY, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers); $response = curl_exec($ch); $this->responseInfo=curl_getinfo($ch); curl_close($ch); if( intval( $this->responseInfo['http_code'] ) == 200 ) return $response; else return false; } /** * Function to prepare data for return to client * @access private * @param string $data */ function objectify($data) { if( $this->type == 'json' ) return (object) json_decode($data); else if( $this->type == 'xml' ) { if( function_exists('simplexml_load_string') ) { $obj = simplexml_load_string( $data ); $statuses = array(); foreach( $obj->status as $status ) { $statuses[] = $status; } return (object) $statuses; } else { return $out; } } else return false; } } ?> <?php function toLink($text){ $text = html_entity_decode($text); $text = " ".$text; $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a href="\\1">\\1</a>', $text); $text = eregi_replace('(((f|ht){1}tps://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a href="\\1">\\1</a>', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1<a href="http://\\2">\\2</a>', $text); $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '<a href="mailto:\\1">\\1</a>', $text); return $text; } ?> Im sure its just a matter of div taga or iframes. However, im not the strongest programmer. Would appreciate much help with this. Thnaks to anyone who is willing to give me there time.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.