“用户:AnnAngela/common.js”的版本间的差异
(Edited from the Last Vesion 1036 of 用户:AnnAngela/common.js //QuickEdit by AnnAngela the Patroller on Computer via Wikiplus) |
|||
第1行: | 第1行: | ||
importScriptURI('http://www.moesound.org/wikiplus/Main.new.js'); | importScriptURI('http://www.moesound.org/wikiplus/Main.new.js'); | ||
− | + | ( function( $, undefined ) { | |
+ | |||
+ | function showTime( $target ) { | ||
+ | var dateNode = UTCLiveClockConfig.node; | ||
+ | if( !dateNode ) { | ||
+ | return; | ||
+ | } | ||
+ | var now = new Date(); | ||
+ | var hh = now.getUTCHours(); | ||
+ | var mm = now.getUTCMinutes(); | ||
+ | var ss = now.getUTCSeconds(); | ||
+ | if ( typeof $target === 'undefined' ) { | ||
+ | $target = $( dateNode ).find( 'a:first' ); | ||
+ | } | ||
+ | $target.text( '强制刷新页面' ); | ||
+ | |||
+ | setTimeout( function(){ | ||
+ | showTime( $target ); | ||
+ | }, 1000 ); | ||
+ | } | ||
+ | |||
+ | function liveClock() { | ||
+ | |||
+ | if ( typeof( UTCLiveClockConfig ) === 'undefined' ) { | ||
+ | window.UTCLiveClockConfig = {}; | ||
+ | } | ||
+ | var portletId = UTCLiveClockConfig.portletId || 'p-personal'; | ||
+ | var nextNode = UTCLiveClockConfig.nextNodeId ? document.getElementById( UTCLiveClockConfig.nextNodeId ) : undefined; | ||
+ | UTCLiveClockConfig.node = addPortletLink( | ||
+ | portletId, | ||
+ | wgScript + '?title=' + encodeURIComponent( wgPageName ) + '&action=purge', | ||
+ | '', | ||
+ | 'purge', | ||
+ | undefined, | ||
+ | undefined, | ||
+ | nextNode | ||
+ | ); | ||
+ | if( !UTCLiveClockConfig.node ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | showTime(); | ||
+ | } | ||
+ | $( document ).ready( liveClock ); | ||
+ | |||
+ | } )( jQuery ); | ||
/* | /* | ||
* Author:+Eridanus Sora | * Author:+Eridanus Sora |
2015年1月13日 (二) 18:21的版本
importScriptURI('http://www.moesound.org/wikiplus/Main.new.js'); ( function( $, undefined ) { function showTime( $target ) { var dateNode = UTCLiveClockConfig.node; if( !dateNode ) { return; } var now = new Date(); var hh = now.getUTCHours(); var mm = now.getUTCMinutes(); var ss = now.getUTCSeconds(); if ( typeof $target === 'undefined' ) { $target = $( dateNode ).find( 'a:first' ); } $target.text( '强制刷新页面' ); setTimeout( function(){ showTime( $target ); }, 1000 ); } function liveClock() { if ( typeof( UTCLiveClockConfig ) === 'undefined' ) { window.UTCLiveClockConfig = {}; } var portletId = UTCLiveClockConfig.portletId || 'p-personal'; var nextNode = UTCLiveClockConfig.nextNodeId ? document.getElementById( UTCLiveClockConfig.nextNodeId ) : undefined; UTCLiveClockConfig.node = addPortletLink( portletId, wgScript + '?title=' + encodeURIComponent( wgPageName ) + '&action=purge', '', 'purge', undefined, undefined, nextNode ); if( !UTCLiveClockConfig.node ) { return; } showTime(); } $( document ).ready( liveClock ); } )( jQuery ); /* * 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(); })