del.icio.us 的这个 playtagger 也是通过 flashVar 传递参数给flash,但用起来更简单,js遍历 .mp3 链接,createElement并且insertBefore 到这个链接的前面。惭愧,比我写的那个强多了…
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
if(typeof(Delicious) == ‘undefined’) Delicious = {}
Delicious.Mp3 = {
playimg: null,
player: null,
go: function() {
var all = document.getElementsByTagName(’a')
for (var i = 0, o; o = all[i]; i++) {
if(o.href.match(/.mp3$/i)) {
var img = document.createElement(’img’)
img.src = ‘http://del.icio.us/static/img/mp3/play.gif’; img.title = ‘listen’
img.height = img.width = 12
img.style.marginRight = ‘0.5em’
img.style.cursor = ‘pointer’
img.onclick = Delicious.Mp3.makeToggle(img, o.href)
o.parentNode.insertBefore(img, o)
}}},
toggle: function(img, url) {
if (Delicious.Mp3.playimg == img) Delicious.Mp3.destroy()
else {
if (Delicious.Mp3.playimg) Delicious.Mp3.destroy()
var a = img.nextSibling, c=”
if (document.defaultView && document.defaultView.getComputedStyle) c = document.defaultView.getComputedStyle(a,null).getPropertyValue(’color’)
else if (a.currentStyle) c = a.currentStyle['color']
c = c.replace(/^rgb|[ ()]/g, ”)
var hex = c.match(/^#?([a-f0-9]{6})$/), hexSm = c.match(/^#?([a-f0-9]{3})$/), rgb = c.match(/^([0-9]+),([0-9]+),([0-9]+)$/)
if (rgb) { var c16 = “0123456789abcdef”, c=”; for(var i=1,d;d=rgb[i];i++) { var j=d%16; c=c+c16.charAt((d-j)/16)+c16.charAt(j) } }
else if (hex) c = hex[1]
else if (hexSm) c = hexSm[1].charAt(0) + hexSm[1].charAt(0) + hexSm[1].charAt(1) + hexSm[1].charAt(1) + hexSm[1].charAt(2) + hexSm[1].charAt(2)
else c = “000000″
img.src = ‘http://del.icio.us/static/img/mp3/stop.gif’; Delicious.Mp3.playimg = img;
Delicious.Mp3.player = document.createElement(’span’)
Delicious.Mp3.player.innerHTML = ‘‘
img.parentNode.insertBefore(Delicious.Mp3.player, img.nextSibling)
}},
destroy: function() {
Delicious.Mp3.playimg.src = ‘http://del.icio.us/static/img/mp3/play.gif’; Delicious.Mp3.playimg = null
Delicious.Mp3.player.removeChild(Delicious.Mp3.player.firstChild); Delicious.Mp3.player.parentNode.removeChild(Delicious.Mp3.player); Delicious.Mp3.player = null
},
makeToggle: function(img, url) { return function(){ Delicious.Mp3.toggle(img, url) }}
}
Delicious.addLoadEvent = function(f) { var old = window.onload
if (typeof old != ‘function’) window.onload = f
else { window.onload = function() { old(); f() }}
}
Delicious.addLoadEvent(Delicious.Mp3.go)
Webleon 可真tnnd的勤奋!每天收的 delicious 都消化不了了!!!!

Flickr验证得了 0 分!
The score for http://www.flickr.com is 0 out of 10
* Refers to mash-ups ? No
* Attempts to be XHTML Strict ? No
* Has a Blogline blogroll ? No
* Appears to be built using Ruby on Rails ? No
* Has that goofy ‘My Blog is Worth’ link ? No
* Refers to VCs ? No
* Has prototype.js ? No
* Mentions Ruby ? No
* Actually mentions Web 2.0 ? No
* Refers to del.icio.us ? No
不过这些规则也太那个了吧…
很郁闷,又是一堆错误…:(用的是 sourceforge feedvalidator
1.xhtml strict 不支持 flash Methods
2.flash method 必须是明确的点击操作?可能是安全设置
http://www.macromedia.com/support/documentation/cn/flashplayer/help/settings_manager04.html
3.window.name 是给opera看的?
aaa.onclick=function(){
//if(window.opod1) window.document["opod1"].SetVariable(”castname”,”9999999999999″)
if(document.opod1)document.opod1.SetVariable(”castname”,”1.mp3″)
document.getElementById(”opod1″).SetVariable(”castname”,”1.mp3″)
document.getElementById(”opod1″).GotoFrame(1)
document.opod1.GotoFrame(1)
}
郁闷…
很不错,我就喜欢这种短小精干的代码,sourceforge的那个shoutbox弄了半天也没装好…
建库 shoutbox,然后建表,用 phpadmin 的sql命令行
CREATE TABLE shoutbox (
id INT(11) NOT NULL AUTO_INCREMENT,
message TEXT NOT NULL,
author VARCHAR(80) NOT NULL,
eml VARCHAR(50) NOT NULL,
date VARCHAR(50) NOT NULL,
ip VARCHAR(20) NOT NULL ,
PRIMARY KEY (id))
php code 另存为shoutbox.php
// 2. Show the shout post form
?>
}
?>
用iframe引用即可。