Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Problema con le parentesi nel nome file

    Ciao a tutti.
    Ho un problema con Slimbox che non riesco a risolvere.
    Il Codice non supporta nomi di file con le parentesi all'interno, Es. immagine(1).jpg, ho visto che in questo 3d
    http://groups.google.com/group/slimb...753dc5f81b88d6

    parlano di sostituire le parentesi con %28 e %29, ma non ho capito dove e come devo inserire il comando per cambiare le stringhe dentro lo slimbox.

    Mi date una mano?Non sono un grande esperto di JS.

    Grazie

    Inserisco anche il codice dello slimbox:

    Codice PHP:
    var Lightbox = {

        
    init: function(options){
            
    this.options $extend({
                
    resizeDuration400,
                
    resizeTransitionfalse,    // default transition
                
    initialWidth250,
                
    initialHeight250,
                
    animateCaptiontrue,
                
    showCountertrue
            
    }, options || {});

            
    this.anchors = [];
            
    $each(document.links, function(el){
                if (
    el.rel && el.rel.test(/^lightbox/i)){
                    
    el.onclick this.click.pass(elthis);
                    
    this.anchors.push(el);
                }
            }, 
    this);
            
    this.eventKeyDown this.keyboardListener.bindAsEventListener(this);
            
    this.eventPosition this.position.bind(this);

            
    this.overlay = new Element('div', {'id''lbOverlay'}).injectInside(document.body);

            
    this.center = new Element('div', {'id''lbCenter''styles': {'width'this.options.initialWidth'height'this.options.initialHeight'marginLeft': -(this.options.initialWidth/2), 'display''none'}}).injectInside(document.body);
            
    this.image = new Element('div', {'id''lbImage'}).injectInside(this.center);
            
    this.prevLink = new Element('a', {'id''lbPrevLink''href''#''styles': {'display''none'}}).injectInside(this.image);
            
    this.nextLink this.prevLink.clone().setProperty('id''lbNextLink').injectInside(this.image);
            
    this.prevLink.onclick this.previous.bind(this);
            
    this.nextLink.onclick this.next.bind(this);

            
    this.bottomContainer = new Element('div', {'id''lbBottomContainer''styles': {'display''none'}}).injectInside(document.body);
            
    this.bottom = new Element('div', {'id''lbBottom'}).injectInside(this.bottomContainer);
            new 
    Element('a', {'id''lbCloseLink''href''#'}).injectInside(this.bottom).onclick this.overlay.onclick this.close.bind(this);
            
    this.caption = new Element('div', {'id''lbCaption'}).injectInside(this.bottom);
            
    this.number = new Element('div', {'id''lbNumber'}).injectInside(this.bottom);
            new 
    Element('div', {'styles': {'clear''both'}}).injectInside(this.bottom);

            var 
    nextEffect this.nextEffect.bind(this);
            
    this.fx = {
                
    overlaythis.overlay.effect('opacity', {duration500}).hide(),
                
    resizethis.center.effects($extend({durationthis.options.resizeDurationonCompletenextEffect}, this.options.resizeTransition ? {transitionthis.options.resizeTransition} : {})),
                
    imagethis.image.effect('opacity', {duration500onCompletenextEffect}),
                
    bottomthis.bottom.effect('margin-top', {duration400onCompletenextEffect})
            };

            
    this.preloadPrev = new Image();
            
    this.preloadNext = new Image();
        },

        
    click: function(link){
            if (
    link.rel.length == 8) return this.show(link.hreflink.title);

            var 
    jimageNumimages = [];
            
    this.anchors.each(function(el){
                if (
    el.rel == link.rel){
                    for (
    0images.lengthj++) if(images[j][0] == el.href) break;
                    if (
    == images.length){
                        
    images.push([el.hrefel.title]);
                        if (
    el.href == link.hrefimageNum j;
                    }
                }
            }, 
    this);
            return 
    this.open(imagesimageNum);
        },

        
    show: function(urltitle){
            return 
    this.open([[urltitle]], 0);
            
        },

        
    open: function(imagesimageNum){
            
    this.images images;
            
    this.position();
            
    this.setup(true);
            
    this.top window.getScrollTop() + (window.getHeight() / 15);
            
    this.center.setStyles({topthis.topdisplay''});
            
    this.fx.overlay.start(0.8);
            return 
    this.changeImage(imageNum);
        },

        
    position: function(){
            
    this.overlay.setStyles({'top'window.getScrollTop(), 'height'window.getHeight()});
        },

        
    setup: function(open){
            var 
    elements $A(document.getElementsByTagName('object'));
            
    elements.extend(document.getElementsByTagName(window.ie 'select' 'embed'));
            
    elements.each(function(el){
                if (
    openel.lbBackupStyle el.style.visibility;
                
    el.style.visibility open 'hidden' el.lbBackupStyle;
            });
            var 
    fn open 'addEvent' 'removeEvent';
            
    window[fn]('scroll'this.eventPosition)[fn]('resize'this.eventPosition);
            
    document[fn]('keydown'this.eventKeyDown);
            
    this.step 0;
        },

        
    keyboardListener: function(event){
            switch (
    event.keyCode){
                case 
    27: case 88: case 67this.close(); break;
                case 
    37: case 80this.previous(); break;    
                case 
    39: case 78this.next();
            }
        },

        
    previous: function(){
            return 
    this.changeImage(this.activeImage-1);
        },

        
    next: function(){
            return 
    this.changeImage(this.activeImage+1);
        },

        
    changeImage: function(imageNum){
            if (
    this.step || (imageNum 0) || (imageNum >= this.images.length)) return false;
            
    this.step 1;
            
    this.activeImage imageNum;

            
    this.center.style.backgroundColor '';
            
    this.bottomContainer.style.display this.prevLink.style.display this.nextLink.style.display 'none';
            
    this.fx.image.hide();
            
    this.center.className 'lbLoading';

            
    this.preload = new Image();
            
    this.preload.onload this.nextEffect.bind(this);
            
    this.preload.src this.images[imageNum][0];
            return 
    false;
        },

        
    nextEffect: function(){
            switch (
    this.step++){
            case 
    1:
                
    this.center.className '';
                
    this.image.style.backgroundImage 'url('+this.images[this.activeImage][0]+')';
                
    this.image.style.width this.bottom.style.width this.preload.width+'px';
                
    this.image.style.height this.prevLink.style.height this.nextLink.style.height this.preload.height+'px';

                
    this.caption.setHTML(this.images[this.activeImage][1] || '');
                
    this.number.setHTML((!this.options.showCounter || (this.images.length == 1)) ? '' 'Image '+(this.activeImage+1)+' of '+this.images.length);

                if (
    this.activeImagethis.preloadPrev.src this.images[this.activeImage-1][0];
                if (
    this.activeImage != (this.images.length 1)) this.preloadNext.src this.images[this.activeImage+1][0];
                if (
    this.center.clientHeight != this.image.offsetHeight){
                    
    this.fx.resize.start({heightthis.image.offsetHeight});
                    break;
                }
                
    this.step++;
            case 
    2:
                if (
    this.center.clientWidth != this.image.offsetWidth){
                    
    this.fx.resize.start({widththis.image.offsetWidthmarginLeft: -this.image.offsetWidth/2});
                    break;
                }
                
    this.step++;
            case 
    3:
                
    this.bottomContainer.setStyles({topthis.top this.center.clientHeightheight0marginLeftthis.center.style.marginLeftdisplay''});
                
    this.fx.image.start(1);
                break;
            case 
    4:
                
    this.center.style.backgroundColor '#000';
                if (
    this.options.animateCaption){
                    
    this.fx.bottom.set(-this.bottom.offsetHeight);
                    
    this.bottomContainer.style.height '';
                    
    this.fx.bottom.start(0);
                    break;
                }
                
    this.bottomContainer.style.height '';
            case 
    5:
                if (
    this.activeImagethis.prevLink.style.display '';
                if (
    this.activeImage != (this.images.length 1)) this.nextLink.style.display '';
                
    this.step 0;
            }
        },

        
    close: function(){
            if (
    this.step 0) return;
            
    this.step = -1;
            if (
    this.preload){
                
    this.preload.onload = Class.empty;
                
    this.preload null;
            }
            for (var 
    f in this.fxthis.fx[f].stop();
            
    this.center.style.display this.bottomContainer.style.display 'none';
            
    this.fx.overlay.chain(this.setup.pass(falsethis)).start(0);
            return 
    false;
        }
    };

    window.addEvent('domready'Lightbox.init.bind(Lightbox)); 
    [Sorridi domani sarā peggio]

  2. #2
    Niente?
    Nessuno che mi sa aiutare?
    Praticamente devo togliere nella stringa le 2 parentesi, quella aperta e quella chiusa e sostituirle con %28 e %29, ho provato, ma non me li fa sostituire, mi sostituisce soltanto un carattere per stringa, come faccio a sostituirne 2 diversi?
    [Sorridi domani sarā peggio]

  3. #3
    codice:
    var str = "immagine(1).jpg";
    str = str.replace("(","%28").replace(")","%29");
    alert(str);
    HTH
    Zappa
    [PC:Presario 2515EU][Cpu:P4@2.3GHz][Ram: 512M][HDU:80G@5400 RPM]
    [Wireless:LinkSys][OS: Ubuntu 9.04 - Jaunty Jackalope]

  4. #4
    Originariamente inviato da homezappa
    codice:
    var str = "immagine(1).jpg";
    str = str.replace("(","%28").replace(")","%29");
    alert(str);
    HTH
    Zappa
    Ti ringrazio per la risposta, ma continua a non funzionarmi nč con Firefox, nč con Safari e nemmeno con Chrome, funziona solo con explorer.

    L'ho inserito in questa posizione del codice:


    Codice PHP:
     show: function(urltitle){     

    QUI
       
     
    return this.open([[urltitle]], 0); 
    [Sorridi domani sarā peggio]

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.