jQueryUI 主题切换器不加载图像

发布于 2024-10-13 05:11:44 字数 1138 浏览 2 评论 0原文

我想稍微玩一下主题切换器,所以我制作了一个简单的页面,只是为了在搞乱它之前看看它是如何工作的。

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"></script>
<script type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css"></script>
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script>
$(document).ready(function(){
  $('#switcher').themeswitcher();
  $('#calendar').datepicker();
});
</script>
</head>
<body>
  <div id="switcher"></div>
  <input type="text" id="calendar"></input>
</body>
</html>

但是页面加载后,我在 Chrome 中打开开发人员工具面板,脚本应该加载的所有图像都抛出 403 禁止错误。这很奇怪,因为我第一次尝试该页面时,切换器 div 就工作了,但我在日期选择器 id 上犯了一个拼写错误,所以我在修复它后重新加载了页面,然后收到了 403 错误。所以我想让它再次工作,但看起来在本地托管所有主题资源并更改主题切换器网址以反映这一点将是一件痛苦的事情;我错过了什么吗?

谢谢

I wanted to play with the themeswitcher a little, so I made a simple page just to see how it worked before messing with it.

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"></script>
<script type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css"></script>
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script>
$(document).ready(function(){
  $('#switcher').themeswitcher();
  $('#calendar').datepicker();
});
</script>
</head>
<body>
  <div id="switcher"></div>
  <input type="text" id="calendar"></input>
</body>
</html>

But after the page loads, I opened the developer tools panel in chrome and all the images that the script are supposed to load are throwing 403 forbidden errors. Which is weird because he switcher div worked the very first time I tried the page, but I made a typo on the datepicker id, so I reloaded the page after fixing it and then got 403 errors. So I want to get it working again, but it looks like it would be a pain to locally host all the theme resources and change the themeswitcher urls to reflect that; am I missing something?

Thanks

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

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

发布评论

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

评论(3

请恋爱 2024-10-20 05:11:44

不允许热链接到除 code.jquery.com 之外的 jQuery 属性。 http://blog. jquery.com/2010/12/30/hotlinking-to-be-disabled-on-jan-31-2011/

您只需将代码和图像下载到您自己的服务器,然后修改代码以指向您在自己的服务器上下载的图像。

You are not allowed to hotlink to jQuery properties other than code.jquery.com. http://blog.jquery.com/2010/12/30/hotlinking-to-be-disabled-on-jan-31-2011/

you just need to download the code and images to your own server then modify the code to point to the images you downloaded on your own server.

睫毛溺水了 2024-10-20 05:11:44

我无法找到在哪里可以下载 jQuery 主题切换器代码,但我确实在 github 上遇到了以下内容 https://github.com/harborhoffer/Super-Theme-Switcher

I was not able to find where you can download the jQuery theme switcher code but I did come across the following on github https://github.com/harborhoffer/Super-Theme-Switcher

厌味 2024-10-20 05:11:44

详细说明泰勒斯的回答:

我有类似的错误,所以我从 http://jqueryui.com/themeroller/ 下载了js themeswitchertool/,将其保存为 jquery.themeswitcher.js 并将所有 http jquery-ui url 替换为 google apis https url。

唯一的变化是在 var switcherpane 中,其中每个链接如下所示:

<li><a href=
"http://jqueryui.com/themeroller/css/parseTheme.css.php?....">
<img src=
"http://jqueryui.com/themeroller/images/themeGallery/theme_90_ui_dark.png" alt=
"UI Darkness" title="UI Darkness" /> <span class="themeName">UI
darkness</span></a></li>

我将其替换为:

<li><a href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/themes/ui-lightness/jquery-ui.css">
<img src="content/images/theme_90_ui_light.png" alt="UI Lightness" title=
"UI Lightness" /><span class="themeName">UI lightness</span></a></li>

如果您搜索该文件,则会进一步向下引用一些其他 html 图像。

您可以在此处找到所有图片

To elaborate on Tylers answer:

I had similar errors so I downloaded the js from http://jqueryui.com/themeroller/themeswitchertool/, saved it as jquery.themeswitcher.js and replaced all http jquery-ui urls with google apis https urls.

The only changes were in the var switcherpane where each link looks like:

<li><a href=
"http://jqueryui.com/themeroller/css/parseTheme.css.php?....">
<img src=
"http://jqueryui.com/themeroller/images/themeGallery/theme_90_ui_dark.png" alt=
"UI Darkness" title="UI Darkness" /> <span class="themeName">UI
darkness</span></a></li>

Which I replaced with:

<li><a href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/themes/ui-lightness/jquery-ui.css">
<img src="content/images/theme_90_ui_light.png" alt="UI Lightness" title=
"UI Lightness" /><span class="themeName">UI lightness</span></a></li>

If you search through the file there are a few other html images that are referenced further down.

You can find all the images here

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