用户:AnnAngela/common.js
注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件。
importScriptURI('http://www.moesound.org/wikiplus/Main.new.js'); /* * Author:+Eridanus Sora * Work for hitokoto showing */ function hitokoto(){ var self = this; this.API = 'http://api.hitokoto.us/rand?encode=jsc&charset=utf-8'; this.Interval = 5000; this.loadScript = function(){ $("head").append('<script id="hitokoto_loader" src="' + self.API + '" />'); } this.setIntervalEvent = function(Event,Interval){ setInterval(Event,Interval); } this.displayHitokoto = function(Hitokoto){ console.log("You get a new Hitokoto:" + Hitokoto.hitokoto); var author = Hitokoto.author; var cat = Hitokoto.cat; var catname = Hitokoto.catname; var date = Hitokoto.date; var id = Hitokoto.id; var source = Hitokoto.source; var content = Hitokoto.hitokoto; var like = Hitokoto.like; var desc = "「" + content + "」 Author : " + author + " @ " + date + " Category : " + catname; $("#hitokoto").children().fadeOut('slow',function(){ $("#hitokoto").html($("<span></span>").attr("title",desc)); $("#hitokoto span").append($("<a>" + content + "</a>").attr({"href":"http://hitokoto.us/view/" + id,"target":"_blank"}).css("display","none").animate({ opacity: 1}, 0, function() { $(this).fadeIn('slow'); }).after($('<a id="toHitokoto" title="一言(ヒトコト)">一言</a>').attr({'href':'http://hitokoto.us/','target':'_blank'}).css('display','none').animate({ opacity: 1}, 0, function() { $(this).fadeIn('slow'); }).before($('<span id="spliter" title=""> —— </span>').css('display','none').animate({ opacity: 1}, 0, function() { $(this).fadeIn('slow'); })))); $("head").find('#hitokoto_loader').remove(); }); } this.init = function(){ window.hitokoto = this.displayHitokoto; this.loadScript(); this.setIntervalEvent(this.loadScript,this.Interval); } } $(document).ready(function(){ $("#siteSub").after('<div id="hitokoto"><span></span></div>'); H = new hitokoto(); H.init(); })