// ==UserScript==
// @name Jinroh-sow SW Res Popup
// @namespace http://wolf.nacht.jp/
// @description 人狼物語ポップアップスクリプト
// @version 0.110206
// @include http://wolf.nacht.jp/sw/*
// ==/UserScript==
var ajaxitems;
function closeWindow() {
$(".close").toggle(
function(){
var ank = $(this);
var base = ank.parents(".ajax");
base.fadeOut("nomal", function(){
base.remove();
});
return false;
},function(){
var ank = $(this);
var base = ank.parents(".ajax");
base.fadeOut("nomal", function(){
base.remove();
});
return false;
});
}
function setAjaxEvent(target){
// 記号類修飾
// 日時、発言プレビュー内部、を対象外にしておく。そうしないとヤバイ。
target.find("p:not(.multicolumn_label):not(.mes_date)").each(function(){
html = $(this).html();
$(this).html(
html
// .replace(/(\/\*)(.*?)(\*\/|$)/g,'$1$2$3')
// .replace(/(\*\*+)/g,'$&')
// .replace(/(\[)(.+?)(\])/g,'$&')
);
});
// アンカーポップアップ機能付与
target.find(".res_anchor").toggle(
function(mouse){
var ank = $(this);
var base = ank.parents(".inframe>div");
var text = ank.text();
var title = ank.attr("title");
var timeid = parseInt(new Date().getTime()/1000);
if( 0 == text.indexOf(">>") ){
var href = this.href.replace("#","&l=").replace("&move=page","").replace("mv=p","").replace("&ra=on","").replace(/\&r=\d+/,"");
href = href + "&r=1";
//alert(href);
$.get(href,{},function(data){
//alert(data);
var date = $(data).find(".name_info,.mes_date");
//alert(date.text());
var mesi = date.parents(".inframe>div");
//alert(mesi.text());
mesi.css('width',$(".inframe").width());
var close = $("×");
close.addClass("close").css({ "color":"#000","font-weight":"bold","font-size":"120%","margin":"5px 5px 5px 5px","cursor":"pointer","float":"right"});
var name = $(mesi).find(".content,.mes_date");
var mes = $("
");
mes.append(mesi);
mes.addClass("ajax").css('display', 'none').css('position', 'absolute').css('background','#000');
//mes.style.opacity = '0.20';
setAjaxEvent(mes);
name.append(close);
base.after(mes);
ajaxitems.push(mes);
var topm = mouse.pageY + 16;
var leftm = mouse.pageX; // 決めうち、本当はよくない。
var leftend = $("body").width() - mes.width() - 8;
if( leftend < leftm ) {
leftm = leftend;
}
mes.css({top:topm,left:leftm,zIndex:(timeid)});
$(mes).fadeIn();
closeWindow();
});
}else{
window.open(this.href, '_blank');
return false;
}
return false;
},function(mouse){
var ank = $(this);
var base = ank.parents(".inframe>div");
base.nextAll(".ajax").fadeOut("nomal", function(){
base.nextAll(".ajax").remove();
});
return false;
});
}
function initialize() {
ajaxitems = [];
setAjaxEvent($(".inframe"));
}
/*!
* jQuery JavaScript Library v1.4.2
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*/
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b