douzi6060 2014-01-18 15:53
浏览 41
已采纳

Javascript函数正确播放旧网站但不是新网站

I recently moved my companies website to one of our unused web servers in order to update the Joomla backend from 1.5.26 to the latest Joomla 2.5. We couldn't go to 3.x because of modules.I used SP Upgrade, and everything migrated brilliantly once I had my new theme and current modules installed.

We have a customized default theme and an assigned theme to the home page. Within the assigned theme (assigned to the home menu) directory, index.php has a script above the header. I will post this code below.

The old site can be found at the following link and when you first go to the site, you will see the video play. cpmchurchministries.com/old

The new site can be found at the following link and when you first go to the site, you will see only an image. cpmchurchministries.com/new

The code is the same for both sites, index.php:

<head>
    <jdoc:include type="head" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css"/>
    <script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/swf/swfobject.js"></script>
    <script type="text/javascript">
        swfobject.embedSWF("<?php echo $this->baseurl ?>/templates/chosenpeople/swf/cpm_logo.swf", "flash_logo", "245", "162", "7");
        window.addEvent('domready', function() {
            if($('default_header')) {
                if(Cookie.get("cpm_movie") != "full") {
                    full_movie();
                } else {
                    small_movie();
                }
            }
        });

        function small_movie() {
            $('default_header').removeClass('full_movie');
            $('default_header').addClass('small_movie');
            swfobject.embedSWF("<?php echo $this->baseurl ?>/templates/cphome/swf/header_home.swf", "flash_header", "696", "157", "7");
        }

    function full_movie() {
        $('default_header').removeClass('small_movie');
        $('default_header').addClass('full_movie');
        Cookie.set("cpm_movie", "full", {duration: 365});
        swfobject.embedSWF("<?php echo $this->baseurl ?>/templates/cphome/swf/video_header.swf", "flash_header", "696", "400", "7");
    }
</script>
<?php if ($editmode) echo '<link rel="stylesheet" href="'.$this->baseurl.'/templates/system/css/general.css" type="text/css" />'."
"; ?>

Has anyone run into a similar issue? Is it possible to get any help? Thank you. . .

  • 写回答

3条回答 默认 最新

  • douan8473 2014-01-18 16:46
    关注

    The newer version of Joomla that you are using uses a newer version of the MooTools library so you need to make the following two function changes to the code:


    OLD

    window.addEvent('domready', function() {
        if($('default_header')) {
            if(Cookie.get("cpm_movie") != "full") {
                full_movie();
            } else {
                small_movie();
            }
        }
    });
    
    
    function small_movie() {
        $('default_header').removeClass('full_movie');
        $('default_header').addClass('small_movie');
        swfobject.embedSWF("/new/templates/cphome/swf/header_home.swf", "flash_header", "696", "157", "7");
    }
    
    function full_movie() {
        $('default_header').removeClass('small_movie');
        $('default_header').addClass('full_movie');
        Cookie.set("cpm_movie", "full", {duration: 365});
        swfobject.embedSWF("/new/templates/cphome/swf/video_header.swf", "flash_header", "696", "400", "7");
    }
    

    NEW

    window.addEvent('domready', function() {    
      if($('default_header')) {
                if(Cookie.read("cpm_movie") != "full") {
                    full_movie();
                } else {
                    small_movie();
                }
            }
        });
    
    function small_movie() {
        $('default_header').removeClass('full_movie');
        $('default_header').addClass('small_movie');
        swfobject.embedSWF("/new/templates/cphome/swf/header_home.swf", "flash_header", "696", "157", "7");
    }
    function full_movie() {
        $('default_header').removeClass('small_movie');
        $('default_header').addClass('full_movie');
        Cookie.write("cpm_movie", "full", {duration: 365});
        swfobject.embedSWF("/new/templates/cphome/swf/video_header.swf", "flash_header", "696", "400", "7");
    }
    

    EDIT for easy copy paste

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画