User:Wikiwide
m (→Keyword search: local page) |
m (→Keyword search: local page) |
||
Line 72: | Line 72: | ||
==Keyword search: local page== | ==Keyword search: local page== | ||
- | Copied from: [http://talk.maemo.org/showthread.php?t=25103 | + | Copied from: [http://talk.maemo.org/showthread.php?t=25103 HOW-TO Keyword search in MicroB Browser] by q335r49 |
Edits: break-lines. Most of the script is barely readable. | Edits: break-lines. Most of the script is barely readable. | ||
Edits: list of search engines. | Edits: list of search engines. |
Revision as of 04:39, 3 February 2015
Hand-writing recognition:CellWriter
Auto-rotating,QWERTY&T9 virtual keyboard
Virtransim: applet to choose virtual keyboard
Saera: Pocketsphinx+eSpeak+PyGTK and Voicy: Pocketsphinx+...
Gem: Goldendict, Estardict, Mstardict and QStarDict
[color=blue]Hildon banner[/color]
How can frontcam be turned into rgb light sensor?
Camera or touchscreen for [B]heartrate[/B]?
Fennec 17 XUL for Maemo Midori 0.4.0 for Maemo
X-CSSU-Force-Landscape=true, thanks to sLumPia
Magnetometer : Metal Detector
Fremantle D-Bus service : Alternative applications
MyPaint : bigger icons
Tracker crawling : disabling
Libre
Outside
Sailbot, International Robotic Sailing Competition
Annual Autonomous Ground Vehicle Competition
Keyword search: local page
Copied from: HOW-TO Keyword search in MicroB Browser by q335r49 Edits: break-lines. Most of the script is barely readable. Edits: list of search engines.
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> if( typeof(window.safeGet) != typeof(false) ) { window.safeGet = new Object(); } function locclean( locvarcl, loctrue ) { var locvarar = new Array(/\+/g,/%27/g,/%5C/g,/%0A/g,/%0D/g,/%0C/g,/%0B/g); var varlocar = new Array(" ","\\'","\\\\","\\n","\\r","\\f","'+unescape('%0B' )+'"); var x; if( loctrue ) { locvarar.length = 1; } //If I'm not using eval(), I only need to convert the + for( x = 0; x < locvarar.length ; x++ ) { locvarcl = locvarcl.replace( locvarar[x], varlocar[x] ); } return unescape( locvarcl ); } //returns the length of a valid string plus the whitespace around it function findString(tempVal) { if( tempVal.replace( /^\s*/, "" ).charAt( 0 ) != "'" && tempVal.replace( /^\s*/, "" ).charAt( 0 ) != '"' ) { return -1; } //I did have a regular expression to detect valid strings but NS4 had a bug that made it fail. var backSl = 0; for( var y = 1; ( backSl % 2 || tempVal.replace( /^\s*/, "" ).charAt( y ) != tempVal.replace( /^\s*/, "" ).charAt( 0 ) ) && y < tempVal.length - 1; y++ ) { if( !tempVal.replace( /^\s*/, "" ).charAt( y ).replace( /[\n\r\f]/, "" ) ) { return -1; } if( tempVal.replace( /^\s*/, "" ).charAt( y ) == "\\" && ( tempVal.replace( /^\s*/, "" ).charAt( y + 1 ) == "\\" || tempVal.replace( /^\s*/, "" ).charAt( y + 1 ) == tempVal.replace( /^\s*/, "" ).charAt( 0 ) ) ) { backSl++; } else { backSl = 0; } } if( y == 1 ) { y = 0; } return y + 1 + ( tempVal.length - tempVal.replace( /^\s*/, "" ).length ) + ( tempVal.replace( /^\s*/, "" ).substr( y + 1 ).length - tempVal.replace( /^\s*/, "" ).substr( y + 1 ).replace( /^\s*/, "" ).length ); } var lvTempVar = window.location.href.replace( /#.*/, "" ).replace(/'/g,'%27').replace( /&/g, "&window."+(safeGet?'safeGet.':'') ) + "&", getVars = new Array(), locvarx = 0, locvartemp = ""; if( lvTempVar.indexOf( "?" ) + 1 && lvTempVar.substr( lvTempVar.indexOf( "?" ) + 1 ).length > 1 ) { //there are variables, what are they? lvTempVar = ( "window." + (safeGet?'safeGet.':'') + lvTempVar.substr( lvTempVar.indexOf( "?" ) + 1 ) ); while( lvTempVar.indexOf( "&" ) + 1 ) { locvartemp += locclean( lvTempVar.substr( 0, lvTempVar.indexOf( "=" ) ), true ) + lvTempVar.substring( lvTempVar.indexOf( "=" ), lvTempVar.indexOf( "&" ) + 1 ); lvTempVar = lvTempVar.substr( lvTempVar.indexOf( "&" ) + 1 ); } //that unescaped the variable names but not the contents lvTempVar = "window"; while( locvartemp.length > 0 ) { if( "^fdg".replace( /\W[\w\W]*/, "" ) ) { window.defaultStatus = "Browser bug detected. Script aborted without error."; break; } if( locvartemp.charAt( locvartemp.search( /\W/ ) ) == "." ) { //That last one was an object if( typeof( eval( lvTempVar ) ) != "object" ) { eval( lvTempVar + " = new Object();" ); } //this is a valid object. create it. locvartemp = locvartemp.substr( locvartemp.indexOf( "." ) + 1 ); //add the next valid word to the text to be evaluated lvTempVar += "." + locvartemp.substr( 0, locvartemp.search( /\W/ ) ); if( locvartemp.search( /[a-z_]/i ) != 0 ) { locvartemp = "&"; continue; } //the . after an object MUST be followed by a-z, A-Z, _. Force safe failure } else { if( locvartemp.charAt( locvartemp.search( /\W/ ) ) == "[" ) { //That last one was an array if( typeof( eval( lvTempVar ) ) != "object" ) { eval( lvTempVar + " = new Array();" ); } if( locvartemp.charAt( locvartemp.indexOf( "[" ) + findString( locvartemp.substr( locvartemp.indexOf( "[" ) + 1 ) ) + 1 ) == "]" ) { //they have used quotes. lvTempVar += locvartemp.substr( locvartemp.indexOf( "[" ), findString( locvartemp.substr( locvartemp.indexOf( "[" ) + 1 ) ) + 2 ); //valid. Add [THEIR_STRING] to the text to be evaluated locvartemp = locvartemp.substr( locvartemp.indexOf( "[" ) + findString( locvartemp.substr( locvartemp.indexOf( "[" ) + 1 ) ) + 2 ); } else { //they should have used a number. Have they? If not, force safe failure if( "" + parseInt( locvartemp.substring( locvartemp.indexOf( "[" ) + 1, locvartemp.indexOf( "]" ) ) ) + "" != locvartemp.substring( locvartemp.indexOf( "[" ) + 1, locvartemp.indexOf( "]" ) ).replace( /\s/g, "" ) || isNaN( parseInt( locvartemp.substring( locvartemp.indexOf( "[" ) + 1, locvartemp.indexOf( "]" ) ) ) ) ) { locvartemp = "&"; continue; } lvTempVar += locvartemp.substring( locvartemp.indexOf( "[" ), locvartemp.indexOf( "]" ) + 1 ); //valid. Add [THEIR_NUM] to the text to be evaluated locvartemp = locvartemp.substr( locvartemp.indexOf( "]" ) + 1 ); } if( locvartemp.charAt( 0 ) != "[" && locvartemp.charAt( 0 ) != "." && locvartemp.charAt( 0 ) != "=" ) { locvartemp = "&"; continue; } //the ] after an array MUST be followed by . or [ or =. Force safe failure } else { if( locvartemp.charAt( locvartemp.search( /\W/ ) ) == "=" ) { //This is the end of the variable name //this is a valid variable. create it/them. eval( lvTempVar + " = '" + locclean( locvartemp.substring( locvartemp.indexOf( "=" ) + 1, locvartemp.indexOf( "&" ) ) ) + "';" ); if( window.useArray ) { //they want the getVars array. Fill it up getVars[lvTempVar.replace( (safeGet?/window\.safeGet\./:/window\./), "" )] = locclean( locvartemp.substring( locvartemp.indexOf( "=" ) + 1, locvartemp.indexOf( "&" ) ), true ); getVars[locvarx] = locclean( locvartemp.substring( locvartemp.indexOf( "=" ) + 1, locvartemp.indexOf( "&" ) ), true ); locvarx++; } //prepare to use the next variable locvartemp = locvartemp.substr( locvartemp.indexOf( "&" ) + 1 ); lvTempVar = locvartemp.substr( 0, locvartemp.search( /\W/ ) ); } else { //safe failure window.defaultStatus = "Invalid variable format. Script aborted without error."; getVars = new Array(); //remove older answers break; //They have put in a variable that does not have a valid name format. abort. } } } } } locvartemp = null; lvTempVar = null; locvarx = null; //clear up i = safeGet.q.indexOf(" ") engine = safeGet.q.substr(0,i) term = safeGet.q.substr(i+1) switch (engine) { case "g": SearchSite = "https://www.google.com/search?q=%s"; break case "wp": SearchSite = "https://en.wikipedia.org/wiki/search?search=%s&go=Go"; break case "az": SearchSite = "https://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Daps&field-keywords=%s&x=0&y=0"; break case "tl": SearchSite= "https://www.teamliquid.net/tlpd/search.php?search=%s&type=all&x=18&y=7"; break case "d": SearchSite = "https://dictionary.reference.com/browse/%s";break case "itt": SearchSite = "https://www.internettablettalk.com/search/results.html?cx=partner-pub-1540416982644573%3As1i8nedfnqe&cof=FORID%3A9&q=%s& sa=Go"; break case "ma": SearchSite = "https://search.maemo.org/search?q=%s&btnG=Search&site=maemo-org&client=maemo-org&proxystylesheet=maemo-org&output=xml_no_dtd"; break case "qr": SearchSite = "./QrCodeR.html?q=%s"; break case "ssh": SearchSite = "./FireSSH.html?q=%s"; break case "om": SearchSite = "https://www.openstreetmap.org/search?query=%s"; break default: SearchSite= "" } window.location = SearchSite.replace("%s",term) </SCRIPT> </HEAD> </HTML>