Skip to content

Instantly share code, notes, and snippets.

@javiertoledo
Created May 1, 2010 19:10
Show Gist options
  • Save javiertoledo/386582 to your computer and use it in GitHub Desktop.
Save javiertoledo/386582 to your computer and use it in GitHub Desktop.
The ultimate jQuery plugin
/**
Mierder-mode for jQuery
-------------------------
Cuando quieres evitar que un formulario sea enviado
automáticamente por el navegador, podrías pensar que
es suficiente con asignar un "return false;" al evento
onsubmit de tu formulario, y esto era así hasta que
los ingenieros de Microsoft pensaron que sería divertido
cambiarlo y ver las caras que ponían los desarrolladores
cuando sus formularios funcionaban en todos los
navegadores del planeta excepto en IE8.
Por eso, y tras avanzadas investigaciones en la materia,
hemos decidido liberar el código fuente de una solución
extraordinaria a un problema tan molesto, y por fin tenemos
absolutamente gratis y con licencia MIT la solución
definitiva.
El plugin para jQuery que no debe faltar en tus aplicaciones
web, el habilitador del modo mierder, para que no debas
volver a preocuparte de que tus formularios no funcionen
en navegadores mierder nunca más!
Si pensáis que merecemos una recompensa por semejante
descubrimiento, aceptamos tarjeta de crédito, Paypal
y transferencias bancarias en todo el mundo.
LICENCIA
-----------------------
Copyright (c) 2010 Javier Toledo <cjtoledo@gmail.com>
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of
the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function enableMierderMode(){
$("form").submit(function(e) {
if(e){
//The secret of mierder browsers:
e.preventDefault();
}
return false;
});
}
@mrbicho
Copy link

mrbicho commented May 1, 2010

Sin duda una genial solución a tal derroche de profesionalidad :D

De ahora en adelante, todas mís aplicaciones web tendrán un pequeño hueco para el Mierder Mode ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment