javascript

Javascript non intrusivo

04.15.09 | Comment?

… spiegato per negazioni.

Questo non è javascript non intrusivo.


<div class="linkFinali">
	<script type="text/javascript">
	//<![CDATA[
	document.write("<a href=\"javascript:history.back();\" onkeypress=\"if(event.keyCode != 9){doSomething();}\" rel=\"prev\">indietro<\/a>");
	//]]>
	</script>
	<noscript><div class="inline">&nbsp;</div></noscript>
</div>

Popularity: 1% [?]

traceroute

Traceroute maxb.net

04.09.09 | Comment?

Ultimamente ho problemi nel raggiungere il mio blog.

Facendo un traceroute a volte capita questo:


9  gi9-6.ccr01.mil01.atlas.cogentco.com (130.117.15.89)  19.124 ms  18.811 ms *
10  te2-2.ccr01.str01.atlas.cogentco.com (130.117.3.17)  34.789 ms te3-8.ccr01.str01.atlas.cogentco.com (154.54.1.237)  41.030 ms te3-2.ccr01.str01.atlas.cogentco.com (130.117.1.113)  36.981 ms
11  * * *
12  * * *
13  te3-2.mpd01.ymq02.atlas.cogentco.com (154.54.0.70)  115.984 ms te4-2.mpd01.ymq02.atlas.cogentco.com (154.54.6.141)  116.149 ms te3-2.mpd01.ymq02.atlas.cogentco.com (154.54.0.70)  116.159 ms
14  te4-7.mpd01.yyz02.atlas.cogentco.com (154.54.25.25)  130.363 ms  132.890 ms  124.229 ms
15  netfirms.demarc.cogentco.com (38.99.210.114)  131.964 ms  129.519 ms  143.212 ms
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

Altre volte è tutto ok.


 9  gi9-6.ccr01.mil01.atlas.cogentco.com (130.117.15.89)  16.954 ms  18.554 ms  15.981 ms
10  te3-2.ccr01.str01.atlas.cogentco.com (130.117.1.113)  26.014 ms te2-2.ccr01.str01.atlas.cogentco.com (130.117.3.17)  30.126 ms  33.005 ms
11  te3-2.mpd02.fra03.atlas.cogentco.com (130.117.3.81)  31.784 ms te4-2.mpd02.fra03.atlas.cogentco.com (130.117.0.193)  26.132 ms *
12  te3-1.ccr01.ams03.atlas.cogentco.com (130.117.2.202)  33.461 ms *  35.235 ms
13  te3-2.mpd01.ymq02.atlas.cogentco.com (154.54.0.70)  118.013 ms te4-2.mpd01.ymq02.atlas.cogentco.com (154.54.6.141)  122.766 ms te3-2.mpd01.ymq02.atlas.cogentco.com (154.54.0.70)  131.790 ms
14  te4-7.mpd01.yyz02.atlas.cogentco.com (154.54.25.25)  137.883 ms te8-6.mpd01.yyz02.atlas.cogentco.com (154.54.7.213)  133.390 ms te4-7.mpd01.yyz02.atlas.cogentco.com (154.54.25.25)  125.833 ms
15  netfirms.demarc.cogentco.com (38.99.210.114)  133.323 ms  132.206 ms  134.207 ms
16  w-213.netfirms.com (38.113.185.213)  132.826 ms  126.348 ms  135.912 ms
17  w-213.netfirms.com (38.113.185.213)  127.923 ms  129.281 ms  127.148 ms

Popularity: 1% [?]

bug, ie, javascript

IE: resize timer

04.03.09 | Comment?

Se volete collegare qualcosa all’evento resize (su IE) vi conviene usare sempre questo snippet di codice (jQuery):


var _resize_timer = null;
$(window).bind('resize', function(ev) {
	if (_resize_timer) clearTimeout(_resize_timer);
	_resize_timer = setTimeout(function(){
           //CODE
	}, 100);
});

invece del semplice (e funzionante codice)


$(window).bind('resize', function(ev) {
	//CODE
});

Provate voi stessi a ridimensionare la finestra (IE) :

http://maxb.net/scripts/ieresize/resize-ie.html
http://maxb.net/scripts/ieresize/resize.html

Popularity: 1% [?]

bug, ie, javascript

IE: document.body is null

04.03.09 | Comment?

Prima di impazzire come ho fatto io guardate questi 3 link (con ie).

Il tag <base /> potrebbe essere il problema.

Dico potrebbe perchè stiamo parlando di internet explorer. Il condizionale è d’obbligo.

Popularity: 3% [?]

javascript, jbgallery, jquery, plugins

jbgallery 1.0

03.30.09 | 48 Comments
ATTENTION : jbgallery 2.0 BETA

DEMO SITE

jbgallery is a webpage UI widget written in javascript on top of the jQuery library.
Its function is to show a single big image, multiple images, multiple gallery, slideshow, as site’s background or in “dialog” mode or as a common pop-up
jbgallery has two basic menus, one has music player buttons the other gives directly links to single images.
jbgallery provides a pubblic API to remote control the component, so it would be easier to bind also with a more complex menu (i.e. with thumbnails).

Examples:

Installation

Download and extract

jbgallery-1.0.zip

Or download single files :

Scripts js (include in head tag)


<script type="text/javascript" src="jquery.1.3.2.min.js"></script>
<script type="text/javascript" src="jbgallery-1.0.min.js"></script>

HTML structure


<div class="jbgallery">
  <ul>
    <li><a href="1.jpg" title="alternative text">1</a></li>
    <li><a href="2.jpg" title="alternative text">2</a></li>
    <!-- etc -->
  </ul>
</div>

JS


<script type="text/javascript">
jQuery(window).jbgcss("jbgallery.css");//customize url
jQuery(document).ready(function(){
  jQuery(".jbgallery").jbgallery();
});
</script>

OPTIONS & DEFAULTS

Write options HERE :

    jQuery(".jbgallery").jbgallery({HERE});

DEFAULTS


{
  style     :  "zoom",    //"centered", "zoom"
  slideshow :  false,
  menu      :  "simple",  //false, "numbers", "simple"
  interval  :  4000,
  fade      :  false,
  fade_time :  400,
  shortcuts :  [37,39],   //left and right arrows
  before    :  function(){}
  load      :  function(ev){},
  after     :  function(ev){},
  popup	    :  false,
  close	    :  function(ev){},
  labels    :  {
        play : "play",
        next : "next",
        prev : "prev",
        stop : "stop",
        close: "close"
  }
}

OPTIONS

  • style : string (‘zoom’/'centered’)
  • slideshow : boolean (true/false)
  • menu : string/boolean (‘simple’/'numbers’/false)
  • interval : number (milliseconds for slideshow)
  • fade : boolean (false/true)
  • fade_time : number (milliseconds for fadeIn/fadeOut effect)
  • shortcuts : array (keycodes for trigger events left/right via keyboard)
  • before : function (callback)
  • load : function(ev) (callback – native image load event)
  • after : function (callback)
  • popup : boolean (show close button)
  • close : function(ev) (callback after click close button. i.e. window.close())
  • labels: object – default:
    {
       play : "play",
       next : "next",
       prev : "prev",
       stop : "stop",
       close: "close"
    }

API (developers/designers)

  • jQuery("#jbgallery").jbgallery(); // build object FIRST
  • jQuery("#jbgallery").jbgallery(“go” , 2); // trigger event go, go to photo 2 if exist
  • jQuery("#jbgallery").jbgallery(“left”); // trigger event left (prev)
  • jQuery("#jbgallery").jbgallery(“right”); // trigger event right (next)
  • jQuery("#jbgallery").jbgallery(“play”); // trigger event play – autoplay start
  • jQuery("#jbgallery").jbgallery(“stop”); // trigger event stop – autoplay stop
  • jQuery("#jbgallery").jbgallery(“destroy”); // destroy object, events, expando
  • jQuery("#jbgallery").jbgallery(“current”); // return number of current photo

CONTENTS/FURTHER ELEMENTS

To add to the image further contents or other kind of elements you can use the following div. Otherwise you can add other divs copying the styles below.


<div id="jbg-content">
    <!-- PUT HERE CONTENT -->
    <div id="docs">
        <div class="wrapper">
        </div>
    </div>
    <!-- /PUT HERE CONTENT -->
</div>

#docs{width:500px;right:200px;top:15%;position:absolute;z-index:1000;}
#docs .wrapper{padding:10px;margin:10px;background:#fff;}

BROWSERS TESTED

  • Firefox 3 (winxp/linux)
  • Safari 3.2, 4 (winxp)
  • Chrome 1/2 (winxp)
  • Opera 9.6/10 (winxp/linux)
  • Internet Explorer 6/7/8 (winxp)
  • Konqueror 4.2.1 (linux)

KNOWN BUGS

Opera

I can’t prevent on the keydown default event (arrows) in Opera.
At “arrows” keydown that causes a pervers effect.
If you know a solution, please contact me.

DESIGN/GRAPHIC

The component is published with a minimalist graphic layout.
You are free to customize css and to ask me any change to add classes to the simple menus edited by me.
If you use API or design more complex menus, or if you write plugins populating html lists via ajax by flickr
or similar services, please share with me for the next version of this plugin.

CREDITS

This work is inspired by http://www.ringvemedia.com/ and Chicca

Photos by Chicca Vancini.
Thanks to Carlo.
Depends by jquery-1.3.2 by John Resig.

LICENSE

Copyright (c) 2009 Massimiliano Balestrieri
Licensed GPL licenses:
http://www.gnu.org/licenses/gpl.html

Popularity: 22% [?]