1

所以我花了很长时间试图找到一个 Pinterest Pin It 按钮,它有一个计数器,当我点击它时,我可以从页面中选择任何图像。

Pinterest 提供的 Pinterest 代码要求您指定要共享的特定图像,但它有一个计数。

Pinterest 浏览器按钮可以在页面上使用,并会弹出一个 javascript 窗口,允许用户在页面上选择任何合适的图像,但它没有计数。

我一直在玩耍和寻找,并且非常接近。我有这段代码,这是我自己的一些代码,还有一些我在其他网站上找到的代码:

<a class='pin-it-button' count-layout='horizontal' href='http://pinterest.com/pin/create/button/?url={Encoded URL of Current Page}'>Pin It</a>
<a href='javascript:void(run_pinmarklet())' style='margin-left:-93px; width:43px; height:20px; display:inline-block;'/></a>
<script src='http://assets.pinterest.com/js/pinit.js' type='text/javascript'/>
<script type='text/javascript'>
function run_pinmarklet() {
var e=document.createElement('script');
e.setAttribute('type','text/javascript');
e.setAttribute('charset','UTF-8');
e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r=' + Math.random()*99999999);
document.body.appendChild(e);
}
</script> 

这样做基本上是通过使用计数按钮来作弊,然后将允许用户选择图像和元素的代码直接放在原始按钮的顶部。用户认为他正在单击 Pin It 按钮,但正在单击运行 javascript run_pinkarklet() 的按钮。

这可行,但是在我获得弹出窗口以选择图像并且我确实选择了图像之后,它然后被插入到弹出窗口中以完成固定,这可行-但同时在主页浏览器重新加载。它不会重新加载原始页面,但会重新加载当前文件夹的主 URL。

示例-假设我要固定的页面是: http ://www.example.com/folder1/page1.php

它重新加载到 - http://www.example.com/folder1/

我找不到任何方法来停止重新加载或让它至少重新加载源页面。

我已经在最新的 Chrome 和 Firefox 上确认了这种行为。

有任何想法吗?

4

3 回答 3

0

Pinterest 的小部件构建器现在支持任何图像选项。

于 2014-05-09T16:44:22.790 回答
-2

在 onclick 事件中将 URL 值设置为 cookie 变量。您可以访问 cookie 值,使用 cookie 值并重定向页面。

于 2012-08-31T12:21:19.190 回答
-3

javascript:void((function(){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8' );e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)}) ());

于 2012-08-16T07:56:06.980 回答