裁片师后备

发布于 2024-10-14 11:40:22 字数 99 浏览 8 评论 0原文

我想知道是否有一种方法可以为 Piecemaker 提供回退功能,因此当在移动设备上查看网站时,页面会回退到使用基于 javascript 的滑块。

任何帮助表示赞赏。

I was wondering if there is a way to include a fallback functionality for Piecemaker, so when a website is viewed on mobile, the page falls back to using a javascript based slider.

Any help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的心境我的脸 2024-10-21 11:40:22

所以我想我找到了解决这个问题的方法,遵循 crayon1 的思路并改变它嵌入 Flash 的方式,以便可以包含后备子 html。这需要更改两个文件:

JavaScriptFlashGateway.js &

piecemaker-main.php
(假设我们正在讨论 WordPress 插件)

在 JavaScriptFlashGateway.js 中,找到以下代码:

function FlashTag(src, width, height)
{
    this.src       = src;
    this.width     = width;
    this.height    = height;
    this.version   = '9,0,0';
    this.id        = null;
    this.salign = "tl";
    this.scale = "noscale";
    this.allowScriptAccess = "always";
    this.allowfullscreen = "true";
    this.bgcolor   = 'ffffff';
    this.flashVars = null;
    this.wmode     = null;
}

并将其更改为:

function FlashTag(src, width, height, fallback)
{
    this.src       = src;
    this.width     = width;
    this.height    = height;
    this.fallback  = fallback;
    this.version   = '9,0,0';
    this.id        = null;
    this.salign = "tl";
    this.scale = "noscale";
    this.allowScriptAccess = "always";
    this.allowfullscreen = "true";
    this.bgcolor   = 'ffffff';
    this.flashVars = null;
    this.wmode     = null;
}

然后进一步找到这一行:“FlashTag.prototype.toString = function()”

并将整个函数替换为这样:

FlashTag.prototype.toString = function()
{
    var ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
    var flashTag = new String();
    flashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
    if (this.id != null)
    {
        flashTag += 'id="'+this.id+'" ';
    }
    flashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.version+'" ';
    flashTag += 'width="'+this.width+'" ';
    flashTag += 'height="'+this.height+'">';
    flashTag += '<param name="movie" value="'+this.src+'"/>';
    flashTag += '<param name="quality" value="high"/>';
    flashTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
    flashTag += '<param name="scale" value="noscale"/>';
    flashTag += '<param name="allowScriptAccess" value="always"/>';
    flashTag += '<param name="salign" value="tl"/>';
    flashTag += '<param name="allowfullscreen" value="true"/>';
    flashTag += '<param name="wmode" value="transparent"/>';
    if (this.flashVars != null)
    {
        flashTag += '<param name="flashvars" value="'+this.flashVars+'"/>';
    }
    if(!ie) {
        flashTag += '<object type="application/x-shockwave-flash" ';
        flashTag += 'data="'+this.src+'" ';
        flashTag += 'width="'+this.width+'" ';
        flashTag += 'height="'+this.height+'">';
        flashTag += '<param name="movie" value="'+this.src+'"/>';
        flashTag += '<param name="quality" value="high"/>';
        flashTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
        flashTag += '<param name="scale" value="noscale"/>';
        flashTag += '<param name="allowScriptAccess" value="always"/>';
        flashTag += '<param name="salign" value="tl"/>';
        flashTag += '<param name="allowfullscreen" value="true"/>';
        flashTag += '<param name="wmode" value="transparent"/>';
        if (this.flashVars != null)
        {
            flashTag += '<param name="flashvars" value="'+this.flashVars+'"/>';
        }
    }
    flashTag += this.fallback;
    if(!ie) {
        flashTag += '</object>';
    }
    flashTag += '</object>';
    return flashTag;
}

然后在piecemaker-main.php中,找到这一行:“var tag = new FlashTag('{$this->piecemakerSWF}', {$att['width']}+50, {$att['height ']}+100, '9,0,0');"

并将“9,0,0”替换为您需要的任何后备 html。

那么你就准备好了!希望这有帮助:)

So I think I found a way around this by following crayon1's vein of thought and changing how it embeds the flash so that fallback child html can be included. This requires changing two files:

JavaScriptFlashGateway.js &

piecemaker-main.php
(Assuming we're talking about the WordPress plugin)

In JavaScriptFlashGateway.js, find this code:

function FlashTag(src, width, height)
{
    this.src       = src;
    this.width     = width;
    this.height    = height;
    this.version   = '9,0,0';
    this.id        = null;
    this.salign = "tl";
    this.scale = "noscale";
    this.allowScriptAccess = "always";
    this.allowfullscreen = "true";
    this.bgcolor   = 'ffffff';
    this.flashVars = null;
    this.wmode     = null;
}

And change it to this:

function FlashTag(src, width, height, fallback)
{
    this.src       = src;
    this.width     = width;
    this.height    = height;
    this.fallback  = fallback;
    this.version   = '9,0,0';
    this.id        = null;
    this.salign = "tl";
    this.scale = "noscale";
    this.allowScriptAccess = "always";
    this.allowfullscreen = "true";
    this.bgcolor   = 'ffffff';
    this.flashVars = null;
    this.wmode     = null;
}

Then further down find this line: "FlashTag.prototype.toString = function()"

And replace that entire function with this:

FlashTag.prototype.toString = function()
{
    var ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
    var flashTag = new String();
    flashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
    if (this.id != null)
    {
        flashTag += 'id="'+this.id+'" ';
    }
    flashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.version+'" ';
    flashTag += 'width="'+this.width+'" ';
    flashTag += 'height="'+this.height+'">';
    flashTag += '<param name="movie" value="'+this.src+'"/>';
    flashTag += '<param name="quality" value="high"/>';
    flashTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
    flashTag += '<param name="scale" value="noscale"/>';
    flashTag += '<param name="allowScriptAccess" value="always"/>';
    flashTag += '<param name="salign" value="tl"/>';
    flashTag += '<param name="allowfullscreen" value="true"/>';
    flashTag += '<param name="wmode" value="transparent"/>';
    if (this.flashVars != null)
    {
        flashTag += '<param name="flashvars" value="'+this.flashVars+'"/>';
    }
    if(!ie) {
        flashTag += '<object type="application/x-shockwave-flash" ';
        flashTag += 'data="'+this.src+'" ';
        flashTag += 'width="'+this.width+'" ';
        flashTag += 'height="'+this.height+'">';
        flashTag += '<param name="movie" value="'+this.src+'"/>';
        flashTag += '<param name="quality" value="high"/>';
        flashTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
        flashTag += '<param name="scale" value="noscale"/>';
        flashTag += '<param name="allowScriptAccess" value="always"/>';
        flashTag += '<param name="salign" value="tl"/>';
        flashTag += '<param name="allowfullscreen" value="true"/>';
        flashTag += '<param name="wmode" value="transparent"/>';
        if (this.flashVars != null)
        {
            flashTag += '<param name="flashvars" value="'+this.flashVars+'"/>';
        }
    }
    flashTag += this.fallback;
    if(!ie) {
        flashTag += '</object>';
    }
    flashTag += '</object>';
    return flashTag;
}

Then in piecemaker-main.php, find this line: "var tag = new FlashTag('{$this->piecemakerSWF}', {$att['width']}+50, {$att['height']}+100, '9,0,0');"

And replace '9,0,0' with whatever fallback html you need.

Then you're set! Hope this helps :)

独自唱情﹋歌 2024-10-21 11:40:22

你能弄清楚这一点吗?我不认为 Piecemaker 默认有这个选项,而且我还没有看到一种方法可以用 javascript 100% 模仿 Piecemaker 的 Flash 效果(还)。

可能有更好的方法来做到这一点,但首先想到的是使用移动浏览器检测代码(有几种可用的..不确定您喜欢哪种编码语言,但只需快速进行谷歌搜索即可您可以找到不同的选项)。然后,您可以使用 Piecemaker 作为默认显示页面版本,或者如果访问者使用移动浏览器,则显示带有您选择的 javascript/jQuery 滑块的版本。

编辑 看起来这是一个很好的替代方案,对旧版浏览器有一些后备: http ://tympanus.net/Development/Slicebox/index4.html

希望有帮助!

Were you able to figure this out? I don't think Piecemaker has this option by default and I haven't seen a way to do this with javascript that 100% mimics the Flash effects of Piecemaker (yet).

There is probably a better way to do this, but the first thing that comes to mind is using a mobile browser detection code (there are several of these available.. not sure what coding language you prefer, but just do a quick Google search and you can find different options). Then you can display either a version of your page using Piecemaker as the default or, if the visitor is using a mobile browser, display a version with the javascript/jQuery slider of your choice.

EDIT Looks like this is a good alternative with some fallback for older browsers: http://tympanus.net/Development/Slicebox/index4.html

Hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文