Daniele Cruciani
Programmatore Developer PHP/MySQL Freelance
mobile: +39 3489215204

icq skype msn linkedin fb t ff youtube picasa google me on github

Advertisement

You are here

javascript

    Debugging Javascript worker (and jQuery & workers howto)

    Even if I finally found Web workers:error and debugging article that explains it well and exensively, I just had to report that developing with Firefox is still the right choice in most case.

    Solved my problem with knockout

    Using a model with nested observable array I did not know how to refer to self in a event handler (click) on a element in a cycle on that observableArray ...

    Signal page as correct in Google Webmaster Tool (simulate mouse click)

    Google webmaster tool signals scanning errors. The is option to signal error a scorrected, but sometime a lot of error is solved at once, but interface do not give option to select it all.

    Also this trick could be usefull in other service..

    I loaded this code in chrome console (developer tool), modified from example code https://developer.mozilla.org/en/DOM/element.dispatchEvent

    Defer javascript execution using data

    Due to page performance you should load javascript at the end of page (see http://developer.yahoo.com/performance/rules.html), at least all javascript you can defer to load. There are script that have to load at the very begin of page. But are you sure there is no option?

    Well, actually this is a critical consideration on my own js script. When I wrote imagedata drupal example module I replaced {'imagedata ...} with a direct call to jquery plugin.

    jQuery context menu

    Ok, I admit I do not search to much out there if this is available..

    A simple jquery plugin that permit to show context menu

    I take inspiration from yahoo library: here is an example

    But I want it as jquery plugin and also I want to have option to choose the way it should work, for example I also want to fire context menu on hold down left mouse button for 1 second, or just hover on element.

    innerHTML problem with internet explorer (supposed)

    I lost some time to debug this

    $("#link").click(function(){
       $("#target").load('url/to/load');
    });
    

    The problem is on Internet Explorer (all version) that refuse to load data in #target, using $.get and innerHTML(data) do not help. The problem is with no well formed html! Internet Explorer refuse to load in dom a malformed html.
    Thus

    jQuery Waiting plugin

    This is a simple jQuery plugin for purpose of loading phase of an ajax request or anything else.
    $("#testdiv").waiting({imgsrc:"/files/aj-blue.gif"});
    
    to stop a waiting div
    $("#testdiv").stopWaiting();
    

    move multiple option in select with jQuery

    I look for this everywhere: how to move multiple option inside a select
    function upfield() {
      var el = $('#selectedfield').children('[@selected]:first').prev();
      $("#selectedfield")
        .children('[@selected]')
        .each(function(){
    	$(this).insertBefore(el);
          });
    
    }
    
    function downfield() {
      var el = $('#selectedfield').children('[@selected]:last').next();
      $("#selectedfield")
        .children('[@selected]')
        .each(function(){
    	$(this).insertAfter(el);
    	el = $(el).next();
          });
    }
    

    XMLHttpRequest, document element DOM parsing

    XMLHttpRequest use, works only if url is on same site. checklogin.php give <KO/> if login è fails <OK>XXX</OK> with XXX id of user when login è is ok

    Subscribe to RSS - javascript