Difference between revisions of "Courses/Schijt aan je Site"

From Publication Station
Line 26: Line 26:


'''Een bookmarklet met jQuery'''
'''Een bookmarklet met jQuery'''
javascript:(function(){
 
<nowiki><code>javascript:(function(){
var fileref=document.createElement('script');
var fileref=document.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("type","text/javascript");
Line 40: Line 41:
       };
       };
})();
})();
</code></nowiki>


'''Veel Voorkomende Irritaties'''
'''Veel Voorkomende Irritaties'''

Revision as of 13:43, 18 December 2014

Voorbeeld jQuery

<html>

 <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script>
      $(function(){
      $("#knop").click(function(){
      	$(this).hide(); 
        });  
      });
    </script>
 </head>
 <body>
   <input type="button" id="knop" value="klik mij!"/>
 </body>

</html>

Voorbeeld Bookmarklet

Maak in je browser een nieuwe bookmark, maar in plaats van een web adres (url) vul je het volgende scriptje in:

javascript:(function(){alert('Je bookmarklet werkt!');})();

Als je nu naar een website gaat en je klikt op deze bookmark, gaat je browser de bijbehorende javascript uitvoeren op die pagina. In plaats van de alert kun je alle javascript gebruiken die je maar wilt, je kunt zo dus ook de pagina aanpassen.

Een bookmarklet met jQuery

<code>javascript:(function(){
	var fileref=document.createElement('script');
	fileref.setAttribute("type","text/javascript");	
	fileref.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js");	
	
	window.setTimeout(main,1000);	
	
	function main(){
      alert('dit werkt');
	  $("img").click(function(){
      	$(this).hide(); 
        });  
      };
})();
</code>

Veel Voorkomende Irritaties

  • Media autoplaying in the background
  • Pop-ups
  • Annoying hover animations
  • Non-pausing sliding pictures
  • Pop-up with a question when opening website
  • Disable Right Click
  • Stop Browser Resize
  • Auto Refresh Page
  • Make Sure Users Meant To Close The Window
  • Resize Window To Certain Resolution
  • Disable The Ctrl Key
  • Make All Links Open In New Window
  • Disable Scrolling

http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/

http://www.paulund.co.uk/a-list-of-annoying-jquery-functions