海报墙Bookmarklet

霏昀

2007-12-03 13:29:48 来自: 霏昀(过年去柬埔寨吧!)

2008-10-30 更新

因为google page不能用了,而且豆瓣页面改版,所以原来的东西失效了。
NP提供了一个基于firefox greasemonkey的版本,在这里下载:http://userscripts.org/scripts/show/36244

感谢NP,恩恩

-----原文的分割线---------

纯粹好玩的东西,到下面链接加“豆瓣海报墙”的Bookmarklet
http://sakinijino.googlepages.com/DoubanBookmarklets.html

效果图片:
http://sakinijino.googlepages.com/DoubanPostersWall.JPG

在任意的电影(书、音乐)详情的页面,点击Bookmarklet,页面会变为随机位置放置该电影(书、音乐)的海报

鼠标移动到海报上,放大并不透明显示
悬停到海报,显示标题
单击海报,把所有“喜欢这部电影(书、音乐)也喜欢的”电影海报随机放到页面上,并锁定放大加边框显示(远程调用需要等待一会儿,等待时间随网速而定)。同时,此后悬停到海报,将显示标题和简介(ff下显示不全)
双击海报,进入该电影(书、音乐)的页面
点击空白处,所有海报缩小尺寸并半透明显示

环境:IE6, FF2, Opera9, Safari3下测试过。
已知bug:网速慢时,图片尺寸有可能出问题。

blog原文:http://sakinijino.blogbus.com/logs/11431902.html
----------------------------------------
Firefox Greasemonkey版本:
http://userscripts.org/scripts/show/15413
点击电影Detail页面中顶部的海报,进入海报墙模式
感谢NullPointer同学帮助移植

  • NullPointer

    2007-12-03 14:36:41 NullPointer (你从天空走下来,踩着我的呼吸。)

    华丽......

  • chez

    2007-12-03 14:41:05 chez (那些深刻在此生的幻象灵魂)

    这个不就是去年在什么小组内发现的一段js代码嘛.

  • NullPointer

    2007-12-03 14:45:23 NullPointer (你从天空走下来,踩着我的呼吸。)

    顺便发布一个GreaseMonkey的版本吧 ~

    我这种懒惰的用户喜欢自动载入的脚本,咔咔

  • 霏昀

    2007-12-03 15:07:16 霏昀 (过年去柬埔寨吧!)

    ----------------------------------------------------------
    2007-12-03 14:41:05 .Chez{R}
      这个不就是去年在什么小组内发现的一段js代码嘛.   
    ----------------------------------------------------------

    ??

  • 霏昀

    2007-12-03 15:35:57 霏昀 (过年去柬埔寨吧!)

    ----------------------------------------------------------
    2007-12-03 14:45:23 NullPointer (北京)
      顺便发布一个GreaseMonkey的版本吧 ~      我这种懒惰的用户喜欢自动载入的脚本,咔咔      
    ----------------------------------------------------------

    这个没法自动,自动了,subject的页面就挂了。。。

  • chez

    2007-12-03 15:38:35 chez (那些深刻在此生的幻象灵魂)

    javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);

    我以前的blog有备份 .

  • 霏昀

    2007-12-03 15:46:25 霏昀 (过年去柬埔寨吧!)

    ms不是一个东西~

  • chez

    2007-12-03 15:47:10 chez (那些深刻在此生的幻象灵魂)

    对象都是图片.

  • chez

    2007-12-03 15:48:13 chez (那些深刻在此生的幻象灵魂)

    看清楚了 不是一类东西.

  • NullPointer

    2007-12-03 16:55:21 NullPointer (你从天空走下来,踩着我的呼吸。)

    ----------------------------------------------------------
    2007-12-03 15:35:57 霏昀 (北京)
      这个没法自动,自动了,subject的页面就挂了。。。
    ----------------------------------------------------------

    改成点击封面图片进入就可以了

    脚本头改成
    if(typeof unsafeWindow.jQuery !== "undefined") {
    var jQuery = unsafeWindow.jQuery;
    var $ = jQuery
    }

    脚本尾巴套进事件里去,改成
    $("#in_tablem div.indent div.fil a:first").click(function(){
    var id = window.location.pathname.match('[0-9]+')[0];
    var title = $("form h1").text();
    var image_src = $("div.indent div.fil a img").attr('src').replace('lobelia.douban.com/mpic\', 'otho.douban.com/spic\')
    var url = window.location.pathname

    $("body").html("");

    d_width = ($.browser.msie ? document.documentElement.clientWidth : window.innerWidth) - 130
    d_height = ($.browser.msie ? document.documentElement.clientHeight : window.innerHeight) - 110

    new Subject({id:id, title:title, image_src:image_src, url: url});
    return false;
    })

    即可.....

    @霏昀 你来发布吧

    ps. “我不是小猫”原来是女生。。。。


  • 霏昀

    2007-12-03 16:57:14 霏昀 (过年去柬埔寨吧!)

    谁说我是女生。。。

  • NullPointer

    2007-12-03 16:59:14 NullPointer (你从天空走下来,踩着我的呼吸。)

    @霏昀
    囧,名字比较女生。。。

  • 霏昀

    2007-12-03 17:00:46 霏昀 (过年去柬埔寨吧!)

    囧rz。。。我怎么一点都不觉得。。。

    你改吧我发现我这都没有gm的说。。。

  • chez

    2007-12-03 17:01:53 chez (那些深刻在此生的幻象灵魂)

    NP 这脑筋........囧

  • NullPointer

    2007-12-03 17:04:50 NullPointer (你从天空走下来,踩着我的呼吸。)

    ----------------------------------------------------------
    2007-12-03 17:00:46 霏昀 (北京)
      你改吧我发现我这都没有gm的说。。。
    ----------------------------------------------------------

    。。。难怪你一直用bookmarklet,

    嗯,那我贴出来你去userscripts.org发布吧。

  • NullPointer

    2007-12-03 17:05:43 NullPointer (你从天空走下来,踩着我的呼吸。)

    if(typeof unsafeWindow.jQuery !== "undefined") {
    var jQuery = unsafeWindow.jQuery;
    var $ = jQuery
    }

    Subjects = {}

    var Subject = function(params){
    $.extend(this, params);
    this.friends = null;
    var _this =this;
    this.img = $("<img src='"+this.image_src+"' title='"+this.title+"\n ...... ("+decodeURI('%E5%8F%8C%E5%87%BB%E8%BF%9B%E5%85%A5')+")"+"' id='"+this.id+"' style='position:absolute; margin:0px; padding:5px; cursor:pointer'>")
    this.img.appendTo($('body'))
    this.zIndex = '';
    this.img.css('opacity', 0.3);
    this.left = Math.floor((Math.random()*d_width))+30
    this.img.css('left', this.left)
    this.top = Math.floor((Math.random()*d_height))+10
    this.img.css('top', this.top)
    this.isLarge = false;
    this.isFixedLarge = false;
    this.img.mouseover(function(){_this.setLarge();this.style.zIndex=20;})
    this.img.mouseout(function(){_this.setSmall();this.style.zIndex=_this.zIndex;})
    this.img.dblclick(function(){window.open(_this.url)})
    this.img.click(function(){
    if (Subjects[_this.id].getFriends()==null) _this.getFriendsRemote(function(){_this.focus()});
    else _this.focus();
    return false;
    })
    Subjects[this.id] = this;
    }


    Subject.prototype.setLarge = function(){
    if (this.isLarge) return;
    if (this.img[0].naturalWidth == null && (this.img[0].width<50 || this.img[0].height<50)) {
    this.img.css('opacity', 1);
    this.isLarge = true;
    return;
    }
    this._getImgNaturalSize()
    this.isLarge = true;
    this.img.animate({
    width: this.img[0].naturalWidth,
    height: this.img[0].naturalHeight,
    opacity: 1
    }, 300);
    }

    Subject.prototype.setSmall = function(){
    if (!this.isLarge || this.isFixedLarge) return;
    if (this.img[0].naturalWidth == null && (this.img[0].width<50 || this.img[0].height<50)) {
    this.img.css('opacity', 0.3);
    this.isLarge = false;
    return;
    }
    this._getImgNaturalSize()
    this.isLarge = false;
    this.img.animate({
    width: this.img[0].naturalWidth/2,
    height: this.img[0].naturalHeight/2,
    opacity: 0.3
    }, 300)
    }

    Subject.prototype.getFriends = function(callback){
    return this.friends;
    }

    Subject.prototype.getFriendsRemote = function(callback){
    if (this.friends != null) return;
    var _this = this;
    $.get(this.url, function(res){
    var tmp = $("<div></div>").append(res.replace(/<script(.|\s)*?\/script>/g, ""));
    var ss = tmp.find("div.obss dl.obs");
    var summary = $(tmp.find("div.indent")[1]).text().replace('<br>', '\n').substring(0, 500) + " ...... ("+decodeURI('%E5%8F%8C%E5%87%BB%E8%BF%9B%E5%85%A5')+")";
    _this.img.attr("title", _this.title+'\n'+summary)
    _this.friends = $.map(ss, function(s){
    s = $(s)
    var link =s.find('dd a');
    var url = link.attr('href');
    var id = url.match('[0-9]+')[0];
    if (Subjects[id] != null) return Subjects[id];
    var title = link.attr('title');
    var image_src = s.find('dt a img').attr('src');
    return new Subject({id:id, title:title, image_src:image_src, url: url});
    })
    if ($.isFunction(callback)) callback(_this.friends)
    })
    }

    Subject.prototype.focus = function(){
    if (Subject.focuseduser != null) Subject.focuseduser.unfocus()
    Subject.focuseduser = this;
    this.img.css('background-color', 'rgb(230, 251, 224)')
    this.zIndex = 15
    this.img.css('z-index', this.zIndex)
    this.isFixedLarge = true;
    this.setLarge();
    $.each(this.friends, function(i, f){
    f.focusAsFriend()
    })
    }

    Subject.prototype.focusAsFriend = function(){
    this.img.css('background-color', 'rgb(255, 246, 238)')
    this.zIndex = 10
    this.img.css('z-index', this.zIndex)
    this.isFixedLarge = true;
    this.setLarge();
    }

    Subject.prototype.unfocus = function(){
    this.img.css('background-color', 'transparent')
    this.zIndex = ''
    this.img.css('z-index', this.zIndex)
    this.isFixedLarge = false;
    this.setSmall();
    $.each(this.friends, function(i, f){
    f.unfocusAsFriend();
    })
    }

    Subject.prototype.unfocusAsFriend = function(){
    this.isFixedLarge = false;
    this.setSmall();
    this.img.css('background-color', 'transparent')
    this.zIndex = ''
    this.img.css('z-index', this.zIndex)
    }

    Subject.prototype._getImgNaturalSize = function(){
    if (!$.browser.mozilla) {
    if (this.img[0].naturalWidth == null) this.img[0].naturalWidth = this.img[0].width-10
    if (this.img[0].naturalHeight == null) this.img[0].naturalHeight = this.img[0].height-10
    }
    }

    $(document).click(function(){
    if (Subject.focuseduser != null) Subject.focuseduser.unfocus()
    })


    $("#in_tablem div.indent div.fil a:first").click(function(){
    var id = window.location.pathname.match('[0-9]+')[0];
    var title = $("form h1").text();
    var image_src = $("div.indent div.fil a img").attr('src').replace('lobelia.douban.com/mpic\', 'otho.douban.com/spic\')
    var url = window.location.pathname

    $("body").html("");

    d_width = ($.browser.msie ? document.documentElement.clientWidth : window.innerWidth) - 130
    d_height = ($.browser.msie ? document.documentElement.clientHeight : window.innerHeight) - 110

    new Subject({id:id, title:title, image_src:image_src, url: url});
    return false;
    })

  • NullPointer

    2007-12-03 17:11:07 NullPointer (你从天空走下来,踩着我的呼吸。)

    其实用Ajax做一个虚拟的电子书架不错,

    支持把书按标签自动分堆,鼠标悬停显示大图,可以拖放。

    现在豆瓣subject的收藏页面对海量数据支持得太差了。。。

    基本没办法“有效率的管理”数量超过一屏列表的任何东西。

  • 霏昀

    2007-12-03 17:25:59 霏昀 (过年去柬埔寨吧!)

    @NullPointer

    话说gm头的namespace支持正则表达式不。。。忘干净了。。。

  • NullPointer

    2007-12-03 17:28:02 NullPointer (你从天空走下来,踩着我的呼吸。)

    @霏昀

    我是这样写的。
    // @include http://www.douban.com/subject/*/

  • 霏昀

    2007-12-03 17:29:16 霏昀 (过年去柬埔寨吧!)

    懂了。。。真是忘干净了。。。

  • 霏昀

    2007-12-03 17:53:49 霏昀 (过年去柬埔寨吧!)

    ----------------------------------------------------------
    2007-12-03 17:04:50 NullPointer (北京)
      ----------------------------------------------------------   2007-12-03 17:00:46 霏昀 (北京)     你改吧我发现我这都没有gm的说。。。   ----------------------------------------------------------      。。。难怪你一直用bookmarklet,      嗯,那我贴出来你去userscripts.org发布吧。      
    ----------------------------------------------------------

    其实本质问题是我一直用被广大人民群众喜闻乐见的Internet Explorer,FF就被我当成开发工具来用。。。

  • NullPointer

    2007-12-03 18:06:01 NullPointer (你从天空走下来,踩着我的呼吸。)

    ----------------------------------------------------------
    2007-12-03 17:53:49 霏昀 (北京)
      其实本质问题是我一直用被广大人民群众喜闻乐见的Internet Explorer,FF就被我当成开发工具来用。。。
    ----------------------------------------------------------

    0rz. 每次用IE都被垃圾网站打败,满天飞的弹出广告和不请自到的ActiveX控件.....

    我更习惯加载了无数插件的Firefox环境是真的。要是把Firefox的Profiles目录删了,对我和重装系统差不多,要把这么多插件一个个找回来重装...

  • 霏昀

    2007-12-03 21:28:58 霏昀 (过年去柬埔寨吧!)

    其实ie7还是能用的~

  • su27根本就没有

    2007-12-04 00:35:58 su27根本就没有 (终于可以不用签名来说话了)

    我现在的状况是被firefox宠坏了,没有firebug的话就只有拒绝工作了。。。

  • NullPointer

    2007-12-04 01:14:47 NullPointer (你从天空走下来,踩着我的呼吸。)

    ----------------------------------------------------------
    2007-12-03 15:38:35 .Chez{R}
      javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);
      我以前的blog有备份 .
    ----------------------------------------------------------

    oh,这个东西我也在我的blog上贴过.....

  • 霏昀

    2007-12-04 11:04:28 霏昀 (过年去柬埔寨吧!)

    @su27根本就没有

    firebug那个js shell太难用了,跟这个比
    https://www.squarefree.com/bookmarklets/webdevel.html

    其实js有个shell就能干活了。而且这个还有ie的版本
    http://blog.monstuff.com/archives/000287.html

    兼容性就靠这个了

  • su27根本就没有

    2007-12-04 12:07:21 su27根本就没有 (终于可以不用签名来说话了)

    以前我也用jsenv和shell,不过后来觉得还是firebug对dom和shell整合得更方便。IE也有shell了,我倒是不知道,这是个好东西!哈哈~

  • NullPointer

    2007-12-04 12:08:47 NullPointer (你从天空走下来,踩着我的呼吸。)

    ----------------------------------------------------------
    2007-12-04 12:07:21 su27根本就没有 (北京)
      以前我也用jsenv和shell,不过后来觉得还是firebug对dom和shell整合得更方便。IE也有shell了,我倒是不知道,这是个好东西!哈哈~
    ----------------------------------------------------------

    囧rz,完全不懂你们在说什么。虽然我在用firebug

  • 霏昀

    2007-12-04 15:02:32 霏昀 (过年去柬埔寨吧!)

    ----------------------------------------------------------
    2007-12-04 12:07:21 su27根本就没有 (北京)
      以前我也用jsenv和shell,不过后来觉得还是firebug对dom和shell整合得更方便。IE也有shell了,我倒是不知道,这是个好东西!哈哈~
    ----------------------------------------------------------

    话说其实一直没好好研究过js这部分firebug应该怎么用,shell用顺手了就被绑住了。不过其他css之类的还是靠firebug的说

  • 霏昀

    2007-12-04 15:06:14 霏昀 (过年去柬埔寨吧!)

    @NullPointer
    就是一个js的命令行,直观的比firebug方便的地方想想也就是输入函数名可以显示函数的代码。总体来说firebug相当于整了dom,css,js等等的IDE,shell就是一个小js命令行,没太大可比性。

  • su27根本就没有

    2007-12-04 23:57:24 su27根本就没有 (终于可以不用签名来说话了)

    我觉得firebug调试js最舒服的地方是用来找dom元素,在命令行里只需要写出变量/表达式,fb就可以把该表达式引用的dom列出来并且跟页面dom建立关联(鼠标hover显示关联,点击编辑)。在js中用console.info或者console.dir打出来也有同样效果。。。还有Breakpoint和Watch的跟踪方法,我就没怎么用了。

  • 双面人小死

    2008-10-29 22:39:45 双面人小死 (Somebody check my brain)

    看不见效果图啊

  • NullPointer

    2008-10-29 23:31:21 NullPointer (你从天空走下来,踩着我的呼吸。)

    ----------------------------------------------------------
    32楼 2008-10-29 22:39:45 19岁 (知耻后勇) (西安) X
      看不见效果图啊
    ----------------------------------------------------------

    嗯,我刚才测试了一下GM版本,似乎已经失效了。。

  • 霏昀

    2008-10-29 23:54:21 霏昀 (过年去柬埔寨吧!)

    挂了很久很久了。。。

  • NullPointer

    2008-10-30 04:32:21 NullPointer (你从天空走下来,踩着我的呼吸。)

    海报墙Reloaded.

    改动原海报墙部分代码使之适用于改版后的豆瓣页面

    在每个书影音页面,“喜欢读"这本书"的人也喜欢:” 的标题栏右侧增加 【海报墙】 入口,
    点击则打开海报墙功能,

    下载地址:http://userscripts.org/scripts/show/36244

  • NullPointer

    2008-10-30 04:34:58 NullPointer (你从天空走下来,踩着我的呼吸。)

    ----------------------------------------------------------
    34楼 2008-10-29 23:54:21 霏昀 (北京) X
      挂了很久很久了。。。
    ----------------------------------------------------------

    这个功能挺有趣的,挂了可惜。其实就因为页面结构变了,我改了下入口和图片路径就ok了。 :)
      
    霏昀你把主贴里的下载地址更新一下就好了

  • 霏昀

    2008-10-30 10:01:45 霏昀 (过年去柬埔寨吧!)

    ----------------------------------------------------------
    36楼 2008-10-30 04:34:58 NullPointer (北京) X
      ----------------------------------------------------------
      34楼 2008-10-29 23:54:21 霏昀 (北京) X
        挂了很久很久了。。。
      ----------------------------------------------------------
      这个功能挺有趣的,挂了可惜。其实就因为页面结构变了,我改了下入口和图片路径就ok了。 :)
      霏昀你把主贴里的下载地址更新一下就好了
    ----------------------------------------------------------

    done


这个小组的插件也喜欢去   · · · · · · 

豆瓣 API
豆瓣 API (4180)
南京大屠杀电影囊括
南京大屠杀电影囊括 (125)
Firefox
Firefox (9463)
豆瓣fans
豆瓣fans (9529)
豆瓣排行榜
豆瓣排行榜 (23738)
Greasemonkey
Greasemonkey (893)