2007-09-28
2007-09-23
原创 火狐 书签 工具 SOO 用Google搜索在网页中选中的文字 如果选中的文字是网址直接打开
javascript:void(
function(){
var op = function( sel){
sel = sel.toString().replace( /^\s+/, '').replace(/\s+$/, '');
if(sel!=''){
var urlReg = /[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.{1}[a-z]{2,5}((:[0-9]{1,5})?(\/?|\/.*))?/i ;
var httpReg = /^(ht|f)tp(s?)\:\/\//i ;
if(!urlReg.test(sel)){
sel = "http://www.google.com/search?q= "+encodeURIComponent(sel);
}
else if(!httpReg.test(sel )){
sel = "http://" + sel;
}
//alert(sel);
open(sel);
}
}
var topSel = getSelection();
if (topSel!=""){op (topSel);}
else {
for(var i=0;i <frames.length;i++){
var fSel = frames[i ].getSelection();
if(fSel!=""){op(fSel );}
}
}
}()
)
使用时需要变成一行(以下代码是使用ShrinkSafe处理后的结果):
javascript:void (function(){var op=function(_2){_2=_2.toString().replace (/^\s+/,"").replace(/\s+$/ ,"");if(_2!=""){ var _3=/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.{1}[a-z]{2,5}((:[0-9]{1,5})?(\/?|\/.*))?/i;var _4=/^(ht|f)tp(s?)\:\/\//i;if(!_3.test(_2 )){_2="http://www.google.com/search?q="+encodeURIComponent (_2);}else{if(!_4.test(_2 )){_2="http://"+_2;}}open(_2);}};var _5=getSelection();if(_5!="" ){op(_5);}else{for(var i=0;i<frames.length;i++){var _7=frames[i].getSelection();if(_7 !=""){op(_7);}}}}());
说明:
- 只在火狐上测试通过,估计在IE上使用需要稍加修改 主要是如何获取选中文字方面略有不同
- 如果配合鼠标手势add-on(http://optimoz.mozdev.org/gestures/),设定足够好的快捷键,比如我设置了右键-左键序列作为该书签工具的快捷键方式,可以取得非常理想的效果,类似马桶(Maxthon)浏览器上的超级拖放(在火狐上可以再设定左键-右键序列作为在新标签页打开链接的快捷键,这样就可以完全实现马桶的超级拖放) 火狐上的确有个add-on叫 Super DragAndGo(https://addons.mozilla.org/en-US/firefox/addon/137?id=137&vid=266) 升级到火狐2.0后 只对衔接有效对选中的非链接无效 而且一直没有改正 而且速度比较慢 而且何必多装一个add-on呢
- 但别高兴太早了 如果配合鼠标手势使用 一定要注意关闭弹出窗口拦截 有adblock plus 其实关掉无妨 否则我这个脚本中open的窗口 统统会被关掉 奇怪的是 如果直接在书签工具栏里点击 倒是不会被拦截 哎 系统做大了真是复杂啊 另外 还要小心不要禁止掉JavaScript 比如 NoScript 就会拦截这个脚本 最终我放弃了NoScript这个add-on 太复杂了 没必要 我换了一个类似的add-on JavaScript黑名单(YesJavaScript) 这个简单 易用 正合我意 好了大功告成
- ShrinkSafe(http://alex.dojotoolkit.org/shrinksafe/)
- url正则表达式出处 http://nshb.net/node/252 略做改动以适应JavaScript
向火狐的贡献者们 致敬 火狐的地址栏里输入 about:credits 就可以看到他们
Our Contributors
We would like to thank our contributors, whose efforts make this software what it is. These people have helped by writing code and documentation, and by testing. They have created and maintained this product, its associated development kits, our build tools and our web sites.
A
Matti Aarnio, Josh Aas, Robert Accettura, Jason Ackley, Carl Adams, Tobias Adamson, Christopher A. Aillon, Juan Pablo Alcaraz, Jo Daniel Aleksandersen, Sam Allen, Warwick Allison, Matitiahu Allouche, A. Ambrose, Nicholas Ambrose, Andrew Anderson, Mark Anderson, Ryota Ando, Mike Ang, Hiroshi Annaka, Peter Annema, Edwin Aoki, Vidur Apparao, Carlos Araya, Smokey Ardisson, Koichi Ariyoshi, Kevin Arnold, Akhil Arora, Justin T. Arthur, Marc Attinasi, Bryan Atwood
B
Ninoschka Baca, Ariel Backenroth, Ryan Bacon, Rodrigo Bado, Ralf Baechle, Bradley Baetz, Péter Bajusz, Jeffrey W. Baker, Jerry Baker, Kirk Baker, Mitchell Baker, Jay Ball, Stuart Ballard, John Bandhauer, Mark Banner, Jens Bannmann, Jason Barnabe, David Baron, Jason Bassford, Ricardo Batista, German Bauer, Michael Bayne, Patrick Beard, Glen Beasley, Nick Beaudrot, Nicholas Bebout, Adam Becevello, Neal Bedard, Christine Begle, Geoffrey Beir, Stephen Beitzel, Artem Belevich, Ruslan Belkin, Kevin Berkheiser, Uri Bernstein, Juraj Betak, Pete Bevin, Gayatri Bhimaraju, David Bienvenu, Christian Biesinger, Jatin Billimoria, Eric Bina, Alex Bishop, Marlon Bishop, Colin R. Blake, Jessica Blanco, Joaquin Blas, Christopher Blizzard, Garrett Blythe, Chuck Boatwright, Brian Bober, Travis Bogard, Bozhan Boiadzhiev, Mark Bokil, Nelson Bolyard, Phillip Bond, Chris Booton, Mauro Botelho, Robert E. Boughner, Joey Bowles, Norris Boyd, Kathleen Brade, Justin Bradford, Don Bragg, Ryan Brase, Daniel Bratell, Daniel Brickley, David Brittain, Eric Broadbent, Sarah Broadwell, Tomas Brodsky, Daniel Brooks, Germaine Brown, Jeremy Browne, Erik Bruchez, Ben Bucksch, Leston Buell, Simon Bünzli, Eric Burley, Edward J. Burns, Jonathan Buschmann, Grace Bush, Angela Butler-McDonald, Marc Byrd
C
Jeff Caldwell, Conrad Carlen, Bjorn Carlson, Laurel Carlson, Jan Carpenter, Evan Carter, Andrew Cassin, Ryan Cassin, Sudhakar Chandrasekharan, Gary Chan, John Chang, Wan-Teh Chang, Milind Changire, Steve Chapel, Christopher S. Charabaruk, Serge Charapaev, Andrew Chatham, Paul Chek, Ginn Chen, Ray Chen, Tao Cheng, Alexey Chernyak, Troy Chevalier, Pascal Chevrel, Lisa Chiang, Hankin Chick, Sean Chitwood, Joe Chou, Howard Chu, Robert Churchill, Ashley Clark, James Clark, Steve Clark, Richard Cohn, Lorenzo Colitti, Pete Collins, Scott Collins, Don Cone, Mike Connelly, Mike Connor, Alex Converse, Chris Cooper, Catherine Corre, Simone Cox, Donnie Cranford, Tim Craycroft, Neil Cronin, Todd Crowe, Jim Crumley, Crysgem, Nicholas Cull, J. Shane Culpepper, Stacey Curtis
D
Steve Dagley, Denis Daly, Magnus André Damli, Bruce Davidson, Angus Davis, Anthony Davis, Paul Davis, Michael Dayah, Mo DeJong, John Dee, Javi Delgadillo, Tom Dell, Vince DeMarco, Prashant Desale, Crutcher Dunnavant, Harish Dhurvasula, Matthew Dillon, Patrick-James Dionisio, Steve Dobbelstein, Jeremy M. Dolan, Simford Dong, Clayton Donley, Stephen Donner, Thomas Down, Rick Downes, Asa Dotzler, George Drapeau, Chris Dreckman, Bert Driehuis, David Drinan, York Du, Alvin Duan, Micah Dubinko, Jean-François Ducarroz, Suresh Duddi, Jim Dunn, Michael Dunn, Karsten Düsterloh, Jeff Dyer
E
Jason Eager, Ali Ebrahim, Rafael Ebron, Sean Echevarria, Brandon Ehle, Brendan Eich, Jan Eldenmalm, Rick Elliott, Steve Elmer, Joseph Elwell, Dawn Endico, Hans-Andreas Engel, Kai Engert, Jean-Jacques Enser, Beth Epperson, David Epstein, Harish Kumar Epuri, Ken Estes, Ramiro Estrugo, Matthias Ettrich, Jim Everingham, Christian Eyrich
F
John Fairhurst, Gilbert Fang, Darin Fisher, David Fisher, Matt Fisher, Greg Fiumara, Werner Fleck, Alec Flett, Bret Ford, Robin Foster, Hugues Fournier, Marc Fraioli, Joe Francis, Andreas Franke, Simon Fraser, Jonathan Freeman, Alan Freier, Noah Friedman, Michael J. Fromberger, Chris Fuchs, Koji Fujimoto, C. Fung, Igor Furlan, Scott Furman, Ryoichi Furukawa
G
Niccolò Gallarati, Jeff Galyan, Bruce Gao, Sean Gao, David Gardiner, Jeff Garzik, Stephen Gates, Prachi Gauriar, Serge Gautherie, Claudius Gayle, Samir Gehani, Jim Gellman, Henrik Gemal, David Gerard, Rick Gessner, John Giannandrea, Bill Gibbons, Rob Ginda, Daniel Glazman, Mike Gleeson, Jennifer Glick, Joshua Go, Esther Goes, Eli Goldberg, Sol Goldfarb, Ben Goodger, Fenella Gor, Paul Gorodyansky, Jonathan Granrose, Jarrod Gray, Pamela Greene, Joseph Gregorio, Tague Griffith, Steven Groginsky, Patrick Gu, Karl Guertin, Ramanathan Guha, Arnt Guldbrandsen, Georgi Guninski, Pat Gunn, Sanjay Gupta, Gábor Lipták
H
Derkjan de Haan, Dave Haas, David Hallowell, Mark B. Hamby, Mark Hammond, Paul Hangas, Henrik Lynggaard Hansen, Stefan Hanske, Jennifer Hao, Lawrence Hardiman, Stephen Hardt, Cyrus Harmon, Matthew Harmsen, Warren Harris, Hirotoshi Harunaga, Brad Hart, Mark Harvey, Achim Hasenmueller, Amancio Hasty, Jasper Hauser, Adrian Havill, Terry Hayes, Leif Hedstrom, Prabhat Hegde, Michael Hein, Brian Heinrich, Jason Heirtzler, Thorsten Heit, Robert Hencke, Richard Henderson, Patrick Hendriks, Andrew Henry, Stefan Hermes, Tara Hernandez, Daniel Rodríguez Herrera, Richard Hess, Joe Hewitt, Kipp Hickman, Ian Hickson, James Hicks, Jon Hicks, Ralf Hildebrandt, Chris Hill, Tim Hill, Ludovic Hirlimann, Stanley Ho, Eric Hodel, Grey Hodge, Andrew Hodgkinson, Chris Hofmann, Martin Honnen, Vera Horiuchi, Max Horn, Waldemar Horwat, Naoki Hotta, Chris Houck, Chad House, Dora Hsu, Candice Huang, Dave Huang, Kevin Huang, Bert Hubert, Markus Hübner, James Huff, Karl Ove Hufthammer, Dan Hugo, Roman Huy-Prech, David Hyatt, Marco S. Hyman
I
Miguel de Icaza, Benito Infantino, Jaagup Irve
J
Dave Jagoda, Darshan Jani, Neeti Jain, Jamus Jegier, Rob Jerdonek, Randell Jesup, Henry Jia, Jack Jia, David Joham, Glenn Johnson, Jason Johnston, Alan S. Jones, Brian Jones, Jeffrey Jones, Dainis Jonitis, Jonas Jørgensen, Ani Joshi, Rick Ju, Michael Judge, Bob Jung, Choi Junho, Gerard Juyn
K
Dai. K., Shotaro Kamio, Christian Kaiser, Takuomi Kagaya, Aaron Kaluszka, Edward Kandrot, Tetsuya Kaneishi, Paul Kanz, Ryuzi Kambe, Blake Kaplan, Michael Kaply, Phil Karlton, David Karlton, Chris Karnaze, Suresh Kasinathan, Peter Kasting, Masaki Katakai, Makoto Kato, Alfred Kayser, Koike Kazuhiko, Joe Keane, Chris Keating, Michael R. Kedl, R.J. Keller, Oliver Klee, Juergen Keil, Miodrag Kekic, Lina Kemmel, Todd Kennedy, Jason Kersey, Masatoshi Kimura, Brian King, Jerry L. Kirk, Christopher Kline, Marcia Knous, Kit Knox, Jeffrey S. Kobal, Teruko Kobayashi, Paul Kocher, Yannick Koehler, Kurt Kohler, Dmitry Kohmanyuk, Greg Kolanek, Justin A. Kolodziej, Stephen Koren, Greg Kostello, Chiaki Koufugata, Mike Kowalski, Daniel Kraft, Ori Kravitz, Nick Kreeger, Ramesh Krishnamagaru, John Kristian, Christopher Kritzer, Eric Krock, Jan Kroken, Scott Kronick, Radha Kulkarni, Rethi Kumar, Igor Kushnirskiy, Gerardo Kvaternik
L
Dirk Laessig, Steve Lamm, Tom Lane, Todd Larason, Sharon Laquinta, Alexander Larsson, Chris Lattner, Ben Laurie, Bill Law, Roger Lawrence, Chris Lawson, Martin Lawyer, Thaks Van Le, Jeremy Lea, Antoine Leca, Elliot Lee, Kevin Lee Hoa Lee, Taek Lee, Michiel van Leeuwen, Jan Leger, Michelle Lei, Thomas Lendacky, Attila Lendvai, Jonathan Lennox, Jake Lentz, Mike Lenz, Tomi Leppikangas, Ian Leue, Michael Leventhal, Aaron Leventhal, Clayton Lewis, Jessie Li, Richard Li, Shanjian Li, Shuehan Liang, Dan Libby, Sarah E.V. Liberman, Nicolás Lichtmaier, Kurt J. Lidl, Pontus Lidman, Mark Lin, Frank van der Linden, David Lindes, Srinivas Lingutla, Peter Linss, Betty Lipkin, Zach Lipton, Luigi Lira, Calvin Liu, Mindy Liu, Vladimir Livshits, Richard K. Lloyd, Adam Lock, Reed Loden, Syd Logan, Robert Longson, Michael Lowe, Charity Lu, Harry Lu, Robin Lu, Xiaobin Lu, Peter Lubczynski, Torben Lüders, Bill Lynch, Gregory Lynn, Chris Lyon
M
Braden McDaniel, Scott MacGregor, Paul MacQuiddy, Ere Maijala, Wade Majors, Waqar Malik, Daniel Malmer, Klaus Malorny, Charles Manske, Steve Mansour, Giorgio Maone, Brent Marshall, Neil Marshall, Owen Marshall, Stephen Martin, Gervase Markham, Joonas Marttila, Kazushi Marukawa, Tsukasa Maruyama, Allan Masri, Jordi Mas, Matthew Mastracci, Daniel Matejka, David Matiskella, Taro Matsuzawa, Chris McAfee, Mike McCabe, Kevin McCarthy, Don McCasland, Tim McClarren, Kevin McCluskey, Mike McCool, Patrick McCormick, David McCusker, Ian McGreer, Dan McGuirk, John McMullen, Tim McNerney, Bob Meader, Tim Meader, David Meeker, Rich Megginson, Myk Melez, Hovik Melikyan, Ralph Mellor, Don Melton, Jim Melvin, Jordan Mendelson, Mark Mentovai, Ben Mesander, Eric A. Meyer, Felix Miata, O'Reilly Michael, Steven Michaud, Bernd Mielke, Malini Minasandram, Bill Mitchell, Eric B. Mitchell, Frank Mitchell, Bruce Mitchener, Jon Mittelhauser, Peter Mock, Soren Juul Moller, Katsuhiko Momoi, Simon Montagu, Lou Montulli, Stuart Morgan, Dan Morrill, John Morrison, Steve Morrison, Steve Morse, Dan Mosedale, Adam Moss, Egota Motohiro, Srilatha Moturi, Thomas Mueller, Constantine A. Murenin, Sean Murphy, Kevin Murray, Spencer Murray, Brian J. Murrell, Alex Musil, Akira Mutsuro
N
Geetha Nagarajan, Noriyuki Nakajima, Glen Nakamura, Masayuki Nakano, James Lewis Nance, Chris Nandor, Chak Nanga, Shashi Narain, Antti Näyhä, Christopher Nebergall, David Nebinger, Chris Nelson, Dru Nelson, Bryce Nesbitt, Brad Neuberg, Dave Neuer, John Neystadt, Giao Nguyen, Hoa Nguyen, Thu Nguyen, Vuong Doan Nguyen, Andrew Niese, Martin Nilsson, Tristan Nitot, Takashi Nobsawa, Michael Noe, Greg Noel, Aleksey Nogin, Eoin Norris, Leonard Norrgård, Mike Norton, Daniel Nunes, Pam Nunn
O
Ian Oeschger, Eric Olson, Zaw Oo, Wei Tsang Ooi, Serge Orlov, Tina Ornduff, Rick Osborne, Hideo Oshima, Brian Ostrom, Andreas Otte
P
Shawn Packwood, Isriya Paireepairit, Harrison Page, Wladimir Palant, Raju Pallath, Marcus Pallinger, Mats Palmgren, Bill Panagouleas, Par Pandit, Simon Paquet, Tom Paquin, Steve Parkinson, Stuart Parmenter, Varada Parthasarathi, Davide Pasetto, Balazs Pataki, Dhiren Patel, Curt Patrick, Akkana Peck, Javier H. Pedemonte, Julian Pellico, Reinhold Penner, Christopher Petersen, Phil Peterson, Frank Petitta, Loan Pham, Pierre Phaneuf, Thom Phillabaum, Paul Phillips, John Pierce, Julien Pierre, Martijn Pieters, Paul Pietromonaco, Mike Pinkerton, Tom Pixley, Rich Pizzarro, Michael Plitkins, Erik van der Poel, Philip Pokorny, Eric Pollmann, Rick Potts, Roozbeh Pournader, Harshal Pradhan, Larry Prall, Christopher Pratt, Andreas Premstaller, Terri Preston, Jane Prusakova, Scott Putterman
Q
Florian Quèze
R
Jim Race, Bhuvan Racham, Amarjeet Singh Rai, Nisheeth Ranjan, Keith Rarick, Samphan Raruenrom, Neil Rashbrook, Sheela Ravindran, J. Paul Reed, Oleg Rekutin, Bob Relyea, Hervé Renault, Lisa Repka, Markus Rex, Carlos Reyes, Tim Rice, Sean Richardson, Victor Riley, Tom Rini, A. Daniel Roberts, Brad Roberts, Tony Robinson, Fred Roeber, Greg Roelofs, Brian Rogers, Andrei Romanov, Dan Rosen, Wolfgang Rosenauer, Doron Rosenberg, Jim Roskind, Blake Ross, James Ross, Catalin Rotaru, Tim Rowley, Steve Rubinstein, Jesse Ruderman, Steve Rudman, Torsten Rüger, Philipp Rumpf, Terje Runde, Brian Ryner
S
Chris Saari, Masaaki Saitoh, Gagan Saksena, Joseph Samake, Wilfredo Sanchez, Pradeep Sanders, Jukka Santala, Montserrat Sanz, Pierre Saslawsky, Masatoshi Sato, Greg Scallan, Dylan K. Schiemann, Phil Schwan, Peter Schultz, Morgan Schweers, Will Scullin, Chris Seawood, Adnan Selimovic, Isan Selimovic, Raffaele Sena, Dimi Shahbaz, Berkley Shands, Wen ShaoHua, Bindu Sharma, Gavin Sharp, Mike Shaver, Hubert Shaw, Dylan Shea, Doug Sheppard, Gordon Sheridan, Gia Shervashidze, Jayesh Sheth, Roby Sherman, Jungshik Shin, Jonas Sicking, Roger B. Sidje, Samuel Sidler, Chris Siegler, Robert Sim, Andrew Simmonds, Franz Sirl, Henri Sivonen, Rich Skrenta, Henrik Skupin, Brandon Smith, Kyle Smith, Mark C. Smith, Miloslaw Smyk, Reed Snellenberger, Hoi-Sheung Wilson So, Henry Sobotka, Josh Soref, Jes Sorensen, Rod Spears, Seth Spitzer, Jim Spring, Sudharshan Srinivasan, Kenneth Stailey, Mark Stankus, Dale V. Stansberry, Rainer Staringer, Douglas Stebila, Jacob Steenhagen, Brian Stell, Johnny Stenback, Mitchell Stoltz, Urs Streidl, Sean Su, Kartik Subbarao, Hani Suleiman, Adam Sulmicki, John Sun, Keiki Sunagawa, Fredrik Sundberg, Kurt Swanson, Aaron Swartz
T
Lloyd Tabb, Hidetoshi Tajima, Mark Takacs, Jerry Tan, Yung-Fong Tang, Andrew Taylor, Owen Taylor, Tim Taylor, Arshad Tayyeb, Takayuki Tei, Raman Tenneti, David Tenser, Dean Tessman, Siyuan Tian, Huynh Trinh, Namachivayam Thirumazhusai, Chris Thomas, Matthew Thomas, Andrew Thompson, Rob Thorne, Heikki Toivonen, Asko Tontti, Chris Torek, Henri Torgemane, Nathan Torkington, Rüger Torsten, Chris Toshok, Aleks Totic, Joan Touzet, Michael Toy, Archimedes Trajano, Peter Trudelle, Jeff Tsai, Doug Turner, Mahesh Tyagarajan
U
John Unruh, Jonas Utterstron
V
Judson Valeski, Peter Van der Beken, Peter VanHelden, Jan Varga, Zoltan Varga, Eric Vaughan, Dan Veditz, Rodney Velasco, Andrew Veliath, Matthias Versen, Romain Vignes, Alistair Vining, Keith Visco, Sjoerd Visscher, Frank Visser, Andy Vogel, Andrew Volkov
W
Håkan Waara, Steven Wagner, Ronan Waide, Jeff Walden, Stephen Walker, Cathleen Wang, Philip K Warren, Andrew Wason, Chris Waterson, Robert Watkins, Matt Watson, Jonathan Watt, Nate Weaver, Dieter Weber, Peter Weilbacher, Dan Weinstein, Jeff Weinstein, Tom Weinstein, Terry Weissman, Mark Welch, Morten Welinder, Christian Wenz, Gail White, Derek Wickersham, Duncan Wilcox, Brian C. Wiles, Ian Wilkinson, Simon Wilkinson, Steffen Wilberg, David Williams, Steve Willis, John Wilson, Matt Wilson, Daniel Witte, Taco Witte, Philippe Wittenbergh, Andrew Wnuk, Shirley Woo, Simon Woodside, Andrew Wooldridge, Edwin Woudt, Mike Wynholds, Paul Wyskoczka
X
Joshua Xia, Ying-Lin Xia, Antonio Xu
Y
Satoru Yamaguchi, Kazu Yamamoto, Jay Yan, Koichi Yasuoka, Christopher Yeh, Prasad Yendluri, Bolian Yin, Roy Tetsuro Yokoyama, Eric York, Kyle Yuan
Z
Richard Zach, Vadim Zaliva, Matthew Zahorik, Jamie Zawinski, Boris Zbarsky, Pete Zha, Leon Zhang, Louie Zhao, Philip Zhao, Silvia Zhao, Kevin Zhou, Sam Ziegler, Jiri Znamenacek
This is a list of people who have contributed significant code, documentation or Quality Assurance effort to the Mozilla Project. Any such contributors who wish to be added to the list should send mail to credits@mozilla.org with your name and a sentence (citation) summarizing your contribution, something like this.