rulu ruru

post Scriptaculous - BlindLeft and BlindRight effects

August 11th, 2008

Filed under: javascript — starenka @ 21:20
Tags: , , ,

This is a simple ripoff of standard BlindUp and BlindDown effects known from script.aculo.us javascript framework. To use these effects simply download the source file and link the file after scriptacolous library. Effects are accesible as usual new Effect.BlindLeft(element);. Cheerz.

Effect.BlindRight = function(element) {
  element = $(element);
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({
    scaleContent: false,
    scaleY: false,
    scaleFrom: 0,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makeClipping().setStyle({width: ‘0px’}).show();
    },  
    afterFinishInternal: function(effect) {
      effect.element.undoClipping();
    }
  }, arguments[1] || { }));
};

Effect.BlindLeft = function(element) {
  element = $(element);
  element.makeClipping();
  return new Effect.Scale(element, 0,
    Object.extend({ scaleContent: false,
      scaleY: false,
      restoreAfterFinish: true,
      afterFinishInternal: function(effect) {
        effect.element.hide().undoClipping();
      }
    }, arguments[1] || { })
  );
};

Popularity: 24% [?]

post Easy image slider with scriptaculous and lightbox

August 11th, 2008

Filed under: javascript — starenka @ 00:07
Tags: , , ,

One lame image slider I made while ago. It just slides images with slight transition effect and shows lightboxed hi-res ones when clicked. See demo here, get example source overe here. Have fun!

JavaScript:

// "global" variables
var current_frame = images_count = 0;
var lame_slider;

document.observe(‘dom:loaded’, function()
{
    // loop thru all images and hide them
    lame_slider = $(’slider’).getElementsByTagName(‘li’);
    for(i=0;i<lame_slider.length;i++)
        if(i!=0) lame_slider[i].style.display = ‘none’;
    images_count = lame_slider.length -1;

    // hook click events on prev and next buttons
    $(‘next’).observe(‘click’,function() { slide(‘fw’);});
    $(‘prev’).observe(‘click’,function() { slide(‘back’);});
});

function slide(direction)
{
    // hide current image
    Effect.Fade(lame_slider[current_frame]);
    if(direction == ‘fw’)
        if (current_frame == images_count) { current_frame = 0; } else { current_frame++; }
    else
        if (current_frame == 0) { current_frame = images_count; } else { current_frame–; }
    // and show next or previous
    Effect.Appear(lame_slider[current_frame]);
}

HTML:

<div id="slide-show">
<ul id="slider">
<li><a href="img/fullres/01.jpg" rel="lightbox[left]"><img src="img/01.jpg" alt="01" title="01"    /></a></li>
<li><a href="img/fullres/02.jpg" rel="lightbox[left]"><img src="img/02.jpg" alt="02" title="02"    /></a></li>
<li><a href="img/fullres/02.jpg" rel="lightbox[left]"><img src="img/03.jpg" alt="03" title="03"    /></a></li>
<li><a href="img/fullres/04.jpg" rel="lightbox[left]"><img src="img/04.jpg" alt="04" title="04"    /></a></li>
<li><a href="img/fullres/05.jpg" rel="lightbox[left]"><img src="img/05.jpg" alt="05" title="05"    /></a></li>
</ul>
<img src="gfx/left.gif" alt="prev" width="15" height="15" id="prev"    />
<img src="gfx/right.gif" alt="next" width="15" height="15" id="next"    />
</div>

Popularity: 20% [?]

post Externí odkazy do nového okna a s vlastním stylem - JavaScript & Prototype

May 31st, 2008

Filed under: javascript — starenka @ 21:27
Tags: ,

Samozřejmě nic nového pod sluncem. Éra, kdy každý musel mít ikonku u externího odkazu taky vyšuměla, nicméně občas je to stále třeba. Komentář naopak zřejmě netřeba.

document.observe(‘dom:loaded’, function() { 

    $$(‘a’).each(function(el) {        
        if(el.readAttribute(‘href’).include(document.domain) == false)
        {
            el.setAttribute(‘target’,‘_blank’);
            el.addClassName(‘external’);
        }
    }, this);   
});

Popularity: 26% [?]

post Bumerang, banán a plantážnický web (update)

February 16th, 2008

Filed under: xss — starenka @ 20:47
Tags: , ,

Málo kdo se na českém internetu snaží vecpat někomu “svoji kvalitní službu” tak jako webhosting Banán.cz v čele s Radovanem Kalužou. Tato bizarní postavička flam(e)ující, nadávající a spamující kde se dá, taky stojí mimo jiném za stránkou owebu.cz. Smysl stránky, grafické pojetí, UI a vůbec technickou stránku věci radši posuzovat nebudu, zato je zde jedna unikátní fíčura: injectovaný javascript je spuštěn hned devětkrát….

%22%3E%3Cscript%20type=%22text/javascript%22%3Ealert(‘Plantae - Magnoliophyta - Liliopsida - Zingiberales - Musaceae - Musa’)%3C/script%3E%3CMETA%20content=%22

… string je totiž bez jakéhokoiliv ošetření nacpán do meta hlaviček. Stačí je jen šikovně prerušit. Nakonec i chybová hláška PHP leccos napoví (třeba, že se s uvozkovkama u banánu nikdo nemaže) a kromě XSS, by se zřejmě dalo pohrát i s SQL. Tak to je teda bumerang.

owebu.cz xss

Za polechtání stojí taktéž našláplý eshop a samozřejmě nemůžu nezmínit Radovanův blogísek.

Popularity: 49% [?]

post Disabling HTML entities in FCKEditor

December 25th, 2007

Filed under: javascript — starenka @ 13:56
Tags: , , , ,

What drives me crazy about FCKEditor is the fact, that by default it transforms characters to entities. For example š is in the source code represented as &scaron; .This sucks most when you are editing the source of the post previously written in WYSIWYG mode. It’s really hard to navigate thru such hordes of &s and it makes you pull your hair (if any).

Here’s a simple fix, tho. Locate your config file fckconfig.js in your FCK directory (if you’re using Wordpress with Dean’s FCKEditor For Wordpress it should be something like /wp-content/plugins/fckeditor_for_wordpress/fckeditor/fckconfig.js) and change these lines to:

FCKConfig.ProcessHTMLEntities = false ;
FCKConfig.IncludeLatinEntities = false ;
FCKConfig.IncludeGreekEntities = false ;

Popularity: 88% [?]

Next Page »
ruldrurd
© starenka 2oo7, cute alien monster by noizcut, original theme by Laurentiu Piron - customized by starenka | proudly powered by WordPress