WebSite X5Help Center

 
Craig D.
Craig D.
User

Adding custom code to page causes Search function on page to fail  en

Author: Craig D.
Visited 3131, Followers 1, Shared 17  

Adding custom code to page causes Search function on page to fail.

Custom code is listed below and on following webpage  http://exploreglencarbon.com/

Do you have any suggestions to resolve issue?

Thank you.

+++++++++++++++++++++++++++++++++++++++++++ html widget

<head>
<script src="reelslideshow.js" type="text/javascript">
</script>
<script type="text/javascript">
var firstreel=new reelslideshow({
    wrapperid: "logoreel", //ID of blank DIV on page to house Slideshow
    dimensions: [166, 80], //width/height of gallery in pixels. Should reflect dimensions of largest image
    imagearray: [
    ["http://www.exploreglencarbon.com/logos/associatedbank163x34.gif", "https://www.associatedbank.com/", "_blank"],
    ["http://www.exploreglencarbon.com/logos/advertise165x80a.png", "http://www.exploreglencarbon.com/", "_blank"],
    ["http://www.exploreglencarbon.com/logos/woodennickel78x79.gif", "http://www.bnd.com/2012/01/22/2022255/wooden-nickel-makes-sense-in-glen.html", "_blank"],
    ["http://www.exploreglencarbon.com/logos/mick construction144x81.jpg", "https://www.facebook.com/pages/Mick-Construction/157644394265947", "_blank"],        ["http://www.exploreglencarbon.com/logos/wang_gang164x33.png", "http://www.wanggangasian.com/", "_blank"],
    ["http://www.exploreglencarbon.com/logos/whattowear150x49.gif", "http://www.whattowearboutique.com/", "_blank"],
    ["http://www.exploreglencarbon.com/logos/exactime152x71.jpg", "http://exacttime.biz/", "_blank"],
    ["http://www.exploreglencarbon.com/logos/oliveoils56x79.png", "http://oliveoilstoreandmore.com/", "_blank"],
    ["http://www.exploreglencarbon.com/logos/papajohnslogowhite90x60.png", "http://www.papajohns.com/index.html", "_blank"],
    ["http://www.exploreglencarbon.com/logos/ihop125x73.png", "http://data.gointranet.com/cgi-bin/unitloc/ihop/locator.cgi?cpage=main.html&cu=kramadan&cl=2098", "_blank"],
    ["http://www.exploreglencarbon.com/logos/chinaking80x80.jpg", "http://www.chinakingedwardsville.com", "_blank"],
    ["http://www.exploreglencarbon.com/logos/travelingtailsinn79x79.jpg", "http://travelingtailsinn.com/", "_blank"],
    ],
    displaymode: {type:'auto', pause:2500, cycles:0, pauseonmouseover:false},
    orientation: "h", //Valid values: "h" or "v"
    persist: false, //remember last viewed slide and recall within same session?
    slideduration: 1000 //transition duration (milliseconds)
})
</script>
</head>
<body onload="setState()">
<table align=center cellpadding=1 cellspacing=0>
<tr>
<td align=left valign=center><div id="logoreel"></div></td>
</tr>
</table>
<div style="font-size: 8px;"><br /></div>
++++++++++++++++++++++++++++++++++++++++++++++++ reelslideshow.js
/* Continuous Reel Slideshow
* Created: Aug 18th, 2010 by DynamicDrive.com. This notice must stay intact for usage
* Author: Dynamic Drive at http://www.dynamicdrive.com/
* Visit http://www.dynamicdrive.com/ for full source code
*/

jQuery.noConflict()

function reelslideshow(options){
    var $=jQuery
    this.setting={displaymode:{type:'auto', pause:2000, cycles:2, pauseonmouseover:true}, orientation:'h', persist:true, slideduration:500} //default settings
    jQuery.extend(this.setting, options) //merge default settings with options
    var curslide=(this.setting.persist)? reelslideshow.routines.getCookie("slider-"+this.setting.wrapperid) : 0
    this.curslide=(curslide==null || curslide>this.setting.imagearray.length-1)? 0 : parseInt(curslide) //make sure curslide index is within bounds
    this.curstep=0
    this.zIndex=1
    this.animation_isrunning=false //variable to indicate whether an image is currently being slided in
    this.posprop=(this.setting.orientation=="h")? "left" : "top"
    options=null
    var slideshow=this, setting=this.setting, preloadimages=[], slidesHTML=''
    for (var i=0; i<setting.imagearray.length; i++){ //preload images
        preloadimages[i]=new Image()
        preloadimages[i].src=setting.imagearray[i][0]
        slidesHTML+=reelslideshow.routines.getSlideHTML(setting.imagearray[i], setting.dimensions[0]+'px', setting.dimensions[1]+'px', this.posprop)+'\n'
    }
    jQuery(function($){ //on document.ready
        slideshow.init($, slidesHTML)
    })
    $(window).bind('unload', function(){ //on window onload
        if (slideshow.setting.persist) //remember last shown slide's index?
            reelslideshow.routines.setCookie("slider-"+setting.wrapperid, slideshow.curslide)
    })
}

reelslideshow.prototype={

    slide:function(nextslide, dir){ //possible values for dir: "left", "right", "top", or "down"
        if (this.curslide==nextslide)
            return
        var slider=this
        var nextslide_initialpos=this.setting.dimensions[(dir=="right"||dir=="left")? 0 : 1] * ((dir=="right"||dir=="down")? -1 : 1)
        var curslide_finalpos=-nextslide_initialpos
        var posprop=this.posprop
        if (this.animation_isrunning!=null)
            this.animation_isrunning=true //indicate animation is running
        this.$imageslides.eq(dir=="left"||dir=="top"? nextslide : this.curslide).css("zIndex", ++this.zIndex) //increase zIndex of upcoming slide so it overlaps outgoing
        this.$imageslides.eq(nextslide).css(reelslideshow.routines.createobj(['visibility', 'visible'], [posprop, nextslide_initialpos])) //show upcoming slide
            .animate(reelslideshow.routines.createobj([posprop, 0]), this.setting.slideduration, function(){slider.animation_isrunning=false})
        this.$imageslides.eq(this.curslide).animate(reelslideshow.routines.createobj([posprop, curslide_finalpos]), this.setting.slideduration, function(){jQuery(this).css("visibility", "hidden")}) //hide outgoing slide
        this.curslide=nextslide
    },

    navigate:function(keyword){ //keyword: "back" or "forth"
        clearTimeout(this.rotatetimer)
        var dir=(keyword=="back")? (this.setting.orientation=="h"? "right" : "down") : (this.setting.orientation=="h"? "left" : "up")
        var targetslide=(keyword=="back")? this.curslide-1 : this.curslide+1
        targetslide=(targetslide<0)? this.$imageslides.length-1 : (targetslide>this.$imageslides.length-1)? 0 : targetslide //wrap around
        if (this.animation_isrunning==false)
            this.slide(targetslide, dir)
    },

    rotate:function(){
        var slideshow=this
        if (this.ismouseover){ //pause slideshow onmouseover
            this.rotatetimer=setTimeout(function(){slideshow.rotate()}, this.setting.displaymode.pause)
            return
        }
        var nextslide=(this.curslide<this.$imageslides.length-1)? this.curslide+1 : 0
        this.slide(nextslide, this.posprop) //go to next slide, either to the left or upwards depending on setting.orientation setting
        if (this.setting.displaymode.cycles==0 || this.curstep<this.maxsteps-1){
            this.rotatetimer=setTimeout(function(){slideshow.rotate()}, this.setting.displaymode.pause)
            this.curstep++
        }
    },

    init:function($, slidesHTML){
        var slideshow=this, setting=this.setting
        this.$wrapperdiv=$('#'+setting.wrapperid).css({position:'relative', visibility:'visible', overflow:'hidden', width:setting.dimensions[0], height:setting.dimensions[1]}) //main DIV
        if (this.$wrapperdiv.length==0){ //if no wrapper DIV found
            alert("Error: DIV with ID \""+setting.wrapperid+"\" not found on page.")
            return
        }
        this.$wrapperdiv.html(slidesHTML)
        this.$imageslides=this.$wrapperdiv.find('div.slide')
        this.$imageslides.eq(this.curslide).css(reelslideshow.routines.createobj([this.posprop, 0])) //set current slide's CSS position (either "left" or "top") to 0
        if (this.setting.displaymode.type=="auto"){ //auto slide mode?
            this.setting.displaymode.pause+=this.setting.slideduration
            this.maxsteps=this.setting.displaymode.cycles * this.$imageslides.length
            if (this.setting.displaymode.pauseonmouseover){
                this.$wrapperdiv.mouseenter(function(){slideshow.ismouseover=true})
                this.$wrapperdiv.mouseleave(function(){slideshow.ismouseover=false})
            }
            this.rotatetimer=setTimeout(function(){slideshow.rotate()}, this.setting.displaymode.pause)
        }
    }

}

reelslideshow.routines={

    getSlideHTML:function(imgref, w, h, posprop){
        var posstr=posprop+":"+((posprop=="left")? w : h)
        var layerHTML=(imgref[1])? '<a href="'+imgref[1]+'" target="'+imgref[2]+'">' : '' //hyperlink slide?
        layerHTML+='<img src="'+imgref[0]+'" style="border-width:0;" />'
        layerHTML+=(imgref[1])? '</a>' : ''
        return '<div class="slide" style="position:absolute;'+posstr+';width:'+w+';height:'+h+';text-align:center;">'
            +'<div style="width:'+w+';height:'+h+';display:table-cell;vertical-align:middle;">'
            +layerHTML
            +'</div></div>' //return HTML for this layer
    },


    getCookie:function(Name){
        var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
        if ([removed].match(re)) //if cookie found
            return [removed].match(re)[0].split("=")[1] //return its value
        return null
    },

    setCookie:function(name, value){
        [removed] = name+"=" + value + ";path=/"
    },

    createobj:function(){
        var obj={}
        for (var i=0; i<arguments.length; i++){
            obj[arguments[i][0]]=arguments[i][1]
        }
        return obj
    }
}

Posted on the
3 ANSWERS - 1 CORRECT
Incomedia
Samantha M.
Incomedia

Hello Craig! Wink

I am very sorry but we are here to help with any question, issue or doubt you have on the program, we can not help you with your personal HTML codes.

Maybe another user can help?

Read more
Posted on the from Samantha M.
Craig D.
Craig D.
User
Author

Very good.  I just wanted to make you aware that adding custom code can cause search function in program to fail.

Thank you.

Read more
Posted on the from Craig D.
Incomedia
Samantha M.
Incomedia

Hi Craig!

This can happen with any kind of code that is added extra in the program. It isn't the code itself it is the code in the program that probalby interfears with the rest.

Thank you for pointing it out anyway, that was very kind of you!

Read more
Posted on the from Samantha M.