'use strict';
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
ts.init = false;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var act;
(function (act_1) {
/**
* ...
* @author ferior
*/
var ActObj = /** @class */ (function () {
function ActObj() {
var _this = this;
//public x0: number;
//public y0: number;
//public w0: number;
//public h0: number;
//public a0: number;
//public r0: number;
//public z0: number;
//public rx0: number;
//public ry0: number;
//public rz0: number;
this.x = { vector: 0 };
this.y = { vector: 0 };
this.w = { vector: 0 };
this.h = { vector: 0 };
this.a = { vector: 0 };
this.r = { vector: 0 };
this.z = { vector: 0 };
this.rx = { vector: 0 };
this.ry = { vector: 0 };
this.rz = { vector: 0 };
this.ps = { vector: 0 };
this.acc = 0; //速度係数
this.method = act_1.ActionMethod.adsorb;
this.autoRemove = true;
this.SetFrom = function (act) {
_this.x.value = act.x.value;
_this.x.zero = act.x.value;
_this.y.value = act.y.value;
_this.y.zero = act.y.zero;
_this.w.value = act.w.value;
_this.w.zero = act.w.zero;
_this.h.value = act.h.value;
_this.h.zero = act.h.zero;
_this.a.value = act.a.value;
_this.a.zero = act.a.zero;
_this.r.value = act.r.value;
_this.r.zero = act.r.zero;
_this.z.value = act.z.value;
_this.z.zero = act.z.zero;
_this.rx.value = act.rx.value;
_this.rx.zero = act.rx.zero;
_this.ry.value = act.ry.value;
_this.ry.zero = act.ry.zero;
_this.rz.value = act.rz.value;
_this.rz.zero = act.rz.zero;
_this.ps.value = act.ps.value;
_this.ps.zero = act.ps.zero;
//this.x0 = this.x;
//this.y0 = this.y;
//this.w0 = this.w;
//this.h0 = this.h;
//this.r0 = this.r;
//this.z0 = this.z;
//this.rx0 = this.rx;
//this.ry0 = this.ry;
//this.rz0 = this.rz;
};
if (ActObj.cnt !== 0)
throw "ActObjはgetActObjにて取得してください。";
}
ActObj.actPool = [];
ActObj.cnt = 0;
ActObj.getActObj = function () {
var actObj;
if (ActObj.cnt === 0)
actObj = new ActObj();
else {
actObj = ActObj.actPool.pop();
ActObj.cnt--;
}
return actObj;
};
ActObj.AddChash = function (count) {
for (var i = 0; i < count; i++)
ActObj.actPool[i] = new ActObj();
ActObj.cnt = count;
};
ActObj.removeActObj = function (actObj) {
ActObj.cnt = ActObj.actPool.push(actObj);
};
return ActObj;
}());
act_1.ActObj = ActObj;
var ActionElement = /** @class */ (function () {
function ActionElement(element) {
var _this = this;
this.x = 0;
this.y = 0;
this.w = 0;
this.h = 0;
this.a = 0;
this.r = 0;
this.z = 0;
this.rx = 0;
this.ry = 0;
this.rz = 0;
this.wo = 0;
this.ho = 0;
this.perspective = 0;
this.translateCredit = 'px';
this.getX = function () { return _this.x; };
this.getY = function () { return _this.y; };
this.getW = function () { return _this.w; };
this.getH = function () { return _this.h; };
this.getA = function () { return _this.a; };
this.getR = function () { return _this.r; };
this.getZ = function () { return _this.z; };
this.getRX = function () { return _this.rx; };
this.getRY = function () { return _this.ry; };
this.getRZ = function () { return _this.rz; };
this.getPS = function () { return _this.perspective; };
this.setX = function (value) { _this.x = value; _this.change = true; };
this.setY = function (value) { _this.y = value; _this.change = true; };
this.setW = function (value) { _this.w = value; _this.change = true; };
this.setH = function (value) { _this.h = value; _this.change = true; };
this.setA = function (value) { _this.a = value; _this.change = true; };
this.setR = function (value) { _this.r = value % 360; _this.change = true; };
this.setZ = function (value) { _this.z = value; _this.change = true; };
this.setRX = function (value) { _this.rx = value % 360; _this.change = true; };
this.setRY = function (value) { _this.ry = value % 360; _this.change = true; };
this.setRZ = function (value) { _this.rz = value % 360; _this.change = true; };
this.setPS = function (value) { _this.perspective = value; _this.change = true; };
this._change = false;
this._afterNo = 0;
this.reflesh = function () {
_this.change = false;
var style = _this.element.style;
//style.left = this.x.toString() + 'px';
//style.top = this.y.toString() + 'px';
//style.width = this.w.toString() + 'px';
//style.height = this.h.toString() + 'px';
style.opacity = (isFinite(_this.a) ? _this.a : '').toString();
var tf = {};
_this.setTransformProp(tf, 'scaleX', _this.w / _this.wo);
_this.setTransformProp(tf, 'scaleY', _this.h / _this.ho);
_this.setTransformProp(tf, 'translateX', _this.x);
_this.setTransformProp(tf, 'translateY', _this.y);
_this.setTransformProp(tf, 'translateZ', _this.z);
_this.setTransformProp(tf, 'rotate', _this.r);
_this.setTransformProp(tf, 'rotateX', _this.rx);
_this.setTransformProp(tf, 'rotateY', _this.ry);
_this.setTransformProp(tf, 'rotateZ', _this.rz);
var transform = "perspective(" + _this.perspective.toString() + "px) ";
for (var prop in tf) {
transform += prop + '(' + tf[prop] + ') ';
}
style.transform = transform;
};
this.gotoEndPoint = function () {
_this.reflesh();
};
this.setTransformProp = function (tf, key, value) {
if (!value) {
delete (tf[key]);
return;
}
switch (key) {
case 'scale':
case 'scaleX':
case 'scaleY':
tf[key] = value.toString();
break;
case 'rotate':
case 'rotateX':
case 'rotateY':
case 'rotateZ':
tf[key] = value.toString() + 'deg';
break;
default:
tf[key] = value.toString() + _this.translateCredit;
}
};
this.element = element;
var cssStyle = getComputedStyle(this.element);
var rect = this.element.getBoundingClientRect();
this.wo = parseFloat(cssStyle.width.replace('px', ''));
this.wo = (isNaN(this.wo)) ? rect.width : this.wo;
this.ho = parseFloat(cssStyle.height.replace('px', ''));
this.ho = (isNaN(this.ho)) ? rect.height : this.ho;
this.w = this.wo;
this.h = this.ho;
this.a = parseFloat(cssStyle.opacity);
this.a = (isNaN(this.a)) ? 1 : this.a;
var tf = cssStyle.transform.replace(/ */, '').split(')');
var len = tf.length;
var transform = {};
if (tf[0] !== 'none' && tf[0] !== '') {
for (var i = 0; i < len; i++) {
var key_value = tf[i].split('(');
if (!key_value[1])
continue;
var values = key_value[1].split(',');
var cnt = values.length;
var valueNum = [];
for (var j = 0; j < cnt; j++) {
valueNum[j] = parseInt(values[j]);
}
transform[key_value[0]] = valueNum;
switch (key_value[0]) {
case 'scale':
this.w = ((valueNum[0]) ? valueNum[0] : 1) * this.wo;
this.h = ((valueNum[1]) ? valueNum[1] : 1) * this.ho;
break;
case 'scaleX':
this.w = ((valueNum[0]) ? valueNum[0] : 1) * this.wo;
break;
case 'scaleY':
this.h = ((valueNum[0]) ? valueNum[0] : 1) * this.ho;
break;
case 'translate':
this.x = valueNum[0];
this.y = valueNum[1];
break;
case 'translateX':
this.x = valueNum[0];
break;
case 'translateY':
this.y = valueNum[0];
break;
case 'translateZ':
this.z = valueNum[0];
break;
case 'rotate':
this.r = valueNum[0];
break;
case 'rotateZ':
this.rz = valueNum[0];
break;
case 'rotateX':
this.rx = valueNum[0];
break;
case 'rotateY':
this.ry = valueNum[0];
break;
case 'perspective':
this.perspective = valueNum[0];
break;
}
}
}
this.tf = transform;
}
Object.defineProperty(ActionElement.prototype, "change", {
get: function () {
return this._change;
},
set: function (value) {
if (this._change === value)
return;
this._change = value;
if (value) {
this._afterNo = ts.ActionTimer.GetInstance().AddAfterFunction(this.reflesh);
}
else {
ts.ActionTimer.GetInstance().RemoveAfterFunction(this._afterNo);
this._afterNo = 0;
}
},
enumerable: true,
configurable: true
});
return ActionElement;
}());
act_1.ActionElement = ActionElement;
})(act = ts.act || (ts.act = {}));
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var ActionTimer = /** @class */ (function () {
function ActionTimer() {
var _this = this;
this.keySec = 0;
this.length = 0;
this.lastTime = 0;
this.startTime = 0;
this.lastFrame = -1;
this.afterFunc = [];
this.start = function () {
if (!ActionTimer.useAnimationFrame) {
_this.startTime = ActionTimer.getTime();
_this.timerToken = setInterval(_this.OnTickerEventBase, ActionTimer.nmInterval);
}
else {
_this.timerToken = requestAnimationFrame(_this.OnTickerEventBase);
}
};
this.stop = function () {
if (!ActionTimer.useAnimationFrame) {
clearTimeout(_this.timerToken);
}
else {
cancelAnimationFrame(_this.timerToken);
}
_this.timerToken = NaN;
};
this.Add = function (key, option) {
if (!key.key) {
_this.keySec++;
key.key = _this.keySec;
}
if (_this.actionList[key.key])
return;
_this.length++;
_this.actionList[key.key] = { key: key, opt: option };
if (_this.length === 1) {
_this.start();
}
};
this.Remove = function (key) {
if (!_this.actionList[key.key])
return;
_this.length--;
delete _this.actionList[key.key];
if (_this.length === 0) {
_this.stop();
}
};
this.AddAfterFunction = function (func) {
return _this.afterFunc.push(func) - 1;
};
this.RemoveAfterFunction = function (no) {
delete _this.afterFunc[no];
};
this.OnTickerEventBase = function () {
if (ActionTimer.useAnimationFrame) {
_this.timerToken = requestAnimationFrame(_this.OnTickerEventBase);
var lastTime = ActionTimer.getTime();
var diff = lastTime - _this.lastTime;
_this.lastTime = lastTime;
var frame = ts.MathBit.floor((lastTime - _this.startTime) / ActionTimer.nmInterval);
if (frame === _this.lastFrame) {
return;
}
if (frame !== 1) {
ActionTimer.lastFrameDeficiency = ts.MathBit.floor(diff / ActionTimer.nmInterval * 100) * 0.01;
}
else {
ActionTimer.lastFrameDeficiency = 0;
}
_this.lastFrame = frame;
if (!_this.timerToken)
return;
}
var len = _this.length;
if (len === 0) {
_this.stop();
return;
}
var list = _this.actionList;
for (var key in list) {
var set = _this.actionList[key];
var aobj = set.key;
var option = set.opt;
var index = aobj.getTickIndex();
try {
if (option) {
if (option.pauseCount !== 0) {
option.pauseCount -= 1;
if (aobj.OnTickerPauseEvent)
index = aobj.OnTickerPauseEvent(index, option);
if (option.pauseCount > 0) {
continue;
}
}
}
index = aobj.OnTickerEvent(index, option);
}
finally {
aobj.setTickIndex(index);
}
}
var funcs = _this.afterFunc;
for (var no in funcs) {
funcs[no]();
}
funcs.length = 0;
};
if (ActionTimer.instance !== undefined)
throw new Error('ActionTimerはシングルトンクラスです。');
this.actionList = Object.create(null);
}
Object.defineProperty(ActionTimer, "UseAnimationFrame", {
get: function () {
return ActionTimer.useAnimationFrame;
},
set: function (value) {
if (ActionTimer.instance !== undefined)
throw new Error('ActionTimerのインターバルはActionTimerを使用する前に設定してください。');
if (ActionTimer.useAnimationFrame === value)
return;
if (value && !requestAnimationFrame)
return;
ActionTimer.useAnimationFrame = value;
if (value) {
window.console.log('==== USE ANIMATION FRAME FOR NINESENSE ACTION TIMER ====');
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(ActionTimer, "Interval", {
get: function () {
return ActionTimer.nmInterval;
},
set: function (value) {
if (ActionTimer.instance !== undefined)
throw new Error('ActionTimerのインターバルはActionTimerを使用する前に設定してください。');
ActionTimer.nmInterval = value;
},
enumerable: true,
configurable: true
});
ActionTimer.nmInterval = 1000 / 60;
ActionTimer.useAnimationFrame = false;
ActionTimer.nowFunc = (window.performance && (performance.now ||
performance.mozNow ||
performance.msNow ||
performance.oNow ||
performance.webkitNow)) || new Date().getTime;
ActionTimer.getTime = function () {
return ActionTimer.nowFunc.call(performance);
};
ActionTimer.GetInstance = function () {
if (ActionTimer.instance === undefined) {
ActionTimer.instance = new ActionTimer();
}
return ActionTimer.instance;
};
ActionTimer.lastFrameDeficiency = 0;
return ActionTimer;
}());
ts.ActionTimer = ActionTimer;
var ActionObj = /** @class */ (function () {
function ActionObj(ticker) {
var _this = this;
this.index = 0;
this.getTickIndex = function () {
return _this.index;
};
this.setTickIndex = function (value) {
if (_this.index === value)
return;
_this.index = value;
if (value !== 0) {
ActionTimer.GetInstance().Add(_this, _this.option);
}
else {
ActionTimer.GetInstance().Remove(_this);
}
};
this.actionFromTo = function (from, to) {
var index = _this.getTickIndex();
if (index === from) {
_this.setTickIndex(to);
return true;
}
return false;
};
this.stopTo = function (to) {
var index = _this.getTickIndex();
if (index === 0) {
_this.setTickIndex(to);
return true;
}
return false;
};
this.OnTickerEvent = ticker;
}
return ActionObj;
}());
ts.ActionObj = ActionObj;
var ActionObjEx = /** @class */ (function (_super) {
__extends(ActionObjEx, _super);
function ActionObjEx(ticker) {
return _super.call(this, ticker) || this;
}
return ActionObjEx;
}(ActionObj));
ts.ActionObjEx = ActionObjEx;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
/**
* ...
* @author s.baba
*/
var MathBit = /** @class */ (function () {
function MathBit() {
}
/**絶対値*/
MathBit.abs = function (value) {
return (value ^ (value >> 31)) - (value >> 31);
};
MathBit.maxElement = 255;
MathBit.nearOne = 0.999999999999999;
MathBit.nearOneM = -0.999999999999999;
/**0に近い数値へ丸める*/
MathBit.floor = function (value) {
return ((value << 1)) >> 1;
};
/**0に遠い値へ丸める*/
MathBit.Upper = function (value) {
return (((value + ((value >= 0) ? MathBit.nearOne : MathBit.nearOneM)) << 1)) >> 1;
};
/**符号の一致*/
MathBit.equalSign = function (value1, value2) {
return (value1 ^ value2) >= 0;
};
/**符号の一致*/
MathBit.equalSignNum = function (value1, value2) {
return (MathBit.Upper(value1) ^ MathBit.Upper(value2)) >= 0;
};
/**符号変換*/
MathBit.changeSign = function (value) {
return (~value + 1);
};
/**偶数判定*/
MathBit.isEven = function (value) {
return !(value & 1);
};
/**左Bitシフト*/
MathBit.leftShift = function (value, i) {
return value << i;
//trace( 100 << 1 ) /* 出力 200 100に2の1乗を掛けてる */
//trace( 100 << 2 ) /* 出力 400 100に2の2乗を掛けてる */
//trace( 100 << 3 ) /* 出力 800 100に2の3乗を掛けてる */
//trace( 100 << 4 ) /* 出力 1600 100に2の4乗を掛けてる */
};
/**右Bitシフト*/
MathBit.rightShift = function (value, i) {
return value >> i;
//trace( 100 >> 1 ) /* 出力 50 100を2の1乗で割る */
//trace( 100 >> 2 ) /* 出力 25 100を2の2乗で割る */
};
MathBit.matchOut = function (value, sep) {
return (value & (sep - 1));
//trace( 5 & ( 2 - 1 ) ) /* 出力 1 */
/* 5を2で割ったときの余りは、っていう意味 */
};
MathBit.valueChange = function (a, b) {
a ^= b;
b ^= a;
a ^= b;
};
// nMinからnMaxまでのランダムな整数を返す
MathBit.randomInt = function (nMin, nMax) {
return MathBit.floor(Math.random() * (nMax - nMin + 1)) + nMin;
};
/**最大公約数計算*/
MathBit.euclid = function (a, b) {
var temp;
if (a < b) {
temp = a;
a = b;
b = temp;
}
if (b < 1)
return -1;
if (a % b == 0)
return b;
return MathBit.euclid(b, a % b);
};
return MathBit;
}());
ts.MathBit = MathBit;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
///
///
var jp;
///
///
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var act;
(function (act_2) {
var MathBit = jp.ninesense.ts.MathBit;
/**
* ...
* @author ferior
*/
var ActionMethod;
(function (ActionMethod) {
ActionMethod[ActionMethod["adsorb"] = 0] = "adsorb";
ActionMethod[ActionMethod["snap"] = 1] = "snap";
})(ActionMethod = act_2.ActionMethod || (act_2.ActionMethod = {}));
/**
* ...
* @author ferior
*/
var ActionTween = /** @class */ (function () {
function ActionTween() {
}
Object.defineProperty(ActionTween, "active", {
get: function () {
return ActionTween._active;
},
set: function (value) {
if (ActionTween._active === value)
return;
ActionTween._active = value;
if (value)
ts.ActionTimer.GetInstance().Add(ActionTween.actionObj, {});
else
ts.ActionTimer.GetInstance().Remove(ActionTween.actionObj);
},
enumerable: true,
configurable: true
});
ActionTween.list = Object.create(null);
ActionTween.activeList = Object.create(null);
ActionTween.noSeq = 0;
//private static var count:uint = 0;
ActionTween.activeCount = 0;
ActionTween.rMax = 360;
/**
* 新規アクションオブジェクトの作成
* @param target アクションさせるオブジェクト
* @param acc 1フレームの行動量(0~1)
* @param mathod 減速方法
* @return
*/
ActionTween.Act = function (target, acc, mathod) {
if (acc === void 0) { acc = 1; }
if (mathod === void 0) { mathod = ActionMethod.adsorb; }
var obj = act_2.ActObj.getActObj();
var obj0;
var acts;
if (target.actionTarget_uniqueKey) {
acts = ActionTween.list[target.actionTarget_uniqueKey] || ActionTween.activeList[target.actionTarget_uniqueKey];
}
if (!acts) {
acts = ActionTween.addNewSet(target);
obj0 = act_2.ActObj.getActObj();
acts.act[0] = obj0;
//count++;
}
else
obj0 = acts.act[0];
var callSets = target.actionTarget_callsets;
for (var nm in callSets) {
obj0[nm].value = callSets[nm].get();
obj0[nm].zero = obj0[nm].value;
}
//obj0.x.value = (("getX" in target) ? target.getX() : NaN) as number;
//obj0.y.value = (("getY" in target) ? target.getY() : NaN) as number;
//obj0.w.value = (("getW" in target) ? target.getW() : NaN) as number;
//obj0.h.value = (("getH" in target) ? target.getH() : NaN) as number;
//obj0.a.value = (("getA" in target) ? target.getA() : NaN) as number;
//obj0.r.value = (("getR" in target) ? target.getR() : NaN) as number;
//obj0.z.value = (("getZ" in target) ? target.getZ() : NaN) as number;
//obj0.rx.value = (("getRX" in target) ? target.getRX() : NaN) as number;
//obj0.ry.value = (("getRY" in target) ? target.getRY() : NaN) as number;
//obj0.rz.value = (("getRZ" in target) ? target.getRZ() : NaN) as number;
//obj0.ps.value = (("getPS" in target) ? target.getPS() : NaN) as number;
//obj0.x.zero = obj0.x.value;
//obj0.y.zero = obj0.y.value;
//obj0.w.zero = obj0.w.value;
//obj0.h.zero = obj0.h.value;
//obj0.a.zero = obj0.a.value;
//obj0.r.zero = obj0.r.value;
//obj0.z.zero = obj0.z.value;
//obj0.rx.zero = obj0.rx.value;
//obj0.ry.zero = obj0.ry.value;
//obj0.rz.zero = obj0.rz.value;
//obj0.ps.zero = obj0.ps.value;
obj.acc = acc * ((acc < 0) ? -1 : 1);
obj.method = mathod;
//obj.SetFrom(acts[acts.length-1]);
acts.act.push(obj);
return obj;
};
/**sorceオブジェクトのアクションキャッシュに対してtargetがシンクロするようにする*/
ActionTween.Sync = function (target, sorce) {
var actsSorce = (ActionTween.list[sorce.actionTarget_uniqueKey] || ActionTween.activeList[sorce.actionTarget_uniqueKey]).act;
ActionTween.list[target.actionTarget_uniqueKey] = { target: target, act: actsSorce.concat() };
delete ActionTween.activeList[target.actionTarget_uniqueKey];
};
ActionTween.addNewSet = function (target) {
if (!target.actionTarget_uniqueKey) {
ActionTween.noSeq++;
target.actionTarget_uniqueKey = ActionTween.noSeq;
target.actionTarget_callsets = {};
if ("getX" in target) {
target.actionTarget_callsets['x'] = { get: target.getX, set: target.setX };
}
if ("getY" in target) {
target.actionTarget_callsets['y'] = { get: target.getY, set: target.setY };
}
if ("getZ" in target) {
target.actionTarget_callsets['z'] = { get: target.getZ, set: target.setZ };
}
if ("getA" in target) {
target.actionTarget_callsets['a'] = { get: target.getA, set: target.setA };
}
if ("getW" in target) {
target.actionTarget_callsets['w'] = { get: target.getW, set: target.setW };
}
if ("getH" in target) {
target.actionTarget_callsets['h'] = { get: target.getH, set: target.setH };
}
if ("getR" in target) {
target.actionTarget_callsets['r'] = { get: target.getR, set: target.setR };
}
if ("getRX" in target) {
target.actionTarget_callsets['rx'] = { get: target.getRX, set: target.setRX };
}
if ("getRY" in target) {
target.actionTarget_callsets['ry'] = { get: target.getRY, set: target.setRY };
}
if ("getRZ" in target) {
target.actionTarget_callsets['rz'] = { get: target.getRZ, set: target.setRZ };
}
if ("getPS" in target) {
target.actionTarget_callsets['ps'] = { get: target.getPS, set: target.setPS };
}
}
var set = { target: target, act: [] };
ActionTween.list[ActionTween.noSeq] = set;
return set;
};
/**sorceオブジェクトのアクションをtargetへコピーする*/
ActionTween.Copy = function (target, sorce, acc, method) {
if (acc === void 0) { acc = NaN; }
if (method === void 0) { method = -1; }
var actsSorce = ActionTween.list[sorce.actionTarget_uniqueKey] || ActionTween.activeList[sorce.actionTarget_uniqueKey];
var acts = ActionTween.list[target.actionTarget_uniqueKey] || ActionTween.activeList[target.actionTarget_uniqueKey];
if (!actsSorce)
return;
if (!acts) {
acts = ActionTween.addNewSet(target);
}
if (!actsSorce) {
actsSorce = ActionTween.addNewSet(sorce);
}
var i = 0;
var source = actsSorce.act;
var to = acts.act;
var len = source.length;
var boolAcc = !isNaN(acc);
var index = acts.act.length - len;
if (index < 0)
index = 0;
for (i = 0; i < len; i++) {
var newAct;
if (!(to[index + i])) {
newAct = act_2.ActObj.getActObj();
to.push(newAct);
}
else {
newAct = to[index + i];
}
var sorceAct = source[i];
newAct.SetFrom(sorceAct);
var callSets = target.actionTarget_callsets;
for (var nm in callSets) {
var nv = newAct[nm];
var sv = sorceAct[nm];
nv.vector = sv.vector;
nv.min = sv.min;
nv.max = sv.max;
}
//newAct.x.vector = sorceAct.x.vector;
//newAct.y.vector = sorceAct.y.vector;
//newAct.w.vector = sorceAct.w.vector;
//newAct.h.vector = sorceAct.h.vector;
//newAct.a.vector = sorceAct.a.vector;
//newAct.r.vector = sorceAct.r.vector;
//newAct.z.vector = sorceAct.z.vector;
//newAct.rx.vector = sorceAct.rx.vector;
//newAct.ry.vector = sorceAct.ry.vector;
//newAct.rz.vector = sorceAct.rz.vector;
//newAct.ps.vector = sorceAct.ps.vector;
//newAct.x.min = sorceAct.x.min;
//newAct.y.min = sorceAct.y.min;
//newAct.w.min = sorceAct.w.min;
//newAct.h.min = sorceAct.h.min;
//newAct.a.min = sorceAct.a.min;
//newAct.r.min = sorceAct.r.min;
//newAct.z.min = sorceAct.z.min;
//newAct.rx.min = sorceAct.rx.min;
//newAct.ry.min = sorceAct.ry.min;
//newAct.rz.min = sorceAct.rz.min;
//newAct.ps.min = sorceAct.ps.min;
//newAct.x.max = sorceAct.x.max;
//newAct.y.max = sorceAct.y.max;
//newAct.w.max = sorceAct.w.max;
//newAct.h.max = sorceAct.h.max;
//newAct.a.max = sorceAct.a.max;
//newAct.r.max = sorceAct.r.max;
//newAct.z.max = sorceAct.z.max;
//newAct.rx.max = sorceAct.rx.max;
//newAct.ry.max = sorceAct.ry.max;
//newAct.rz.max = sorceAct.rz.max;
//newAct.ps.max = sorceAct.ps.max;
newAct.method = (method >= 0) ? method : sorceAct.method;
newAct.acc = (boolAcc) ? acc : sorceAct.acc;
}
};
/**オブジェクトのアクションを開始する*/
ActionTween.Start = function (target) {
var acts = ActionTween.list[target.actionTarget_uniqueKey];
if (!acts)
return;
delete ActionTween.list[target.actionTarget_uniqueKey];
ActionTween.activeList[target.actionTarget_uniqueKey] = acts;
ActionTween.activeCount++;
ActionTween.active = true;
};
/**オブジェクトのアクションを止める*/
ActionTween.Stop = function (target) {
var acts = ActionTween.activeList[target.actionTarget_uniqueKey];
if (!acts)
return;
delete ActionTween.activeList[target.actionTarget_uniqueKey];
ActionTween.list[target.actionTarget_uniqueKey] = acts;
ActionTween.activeCount--;
if (ActionTween.activeCount === 0)
ActionTween.active = false;
};
ActionTween.Remove = function (target) {
ActionTween.Stop(target);
var actObj = ActionTween.list[target.actionTarget_uniqueKey];
if (!actObj)
return;
var act = actObj.act;
var len = act.length;
for (var i = 0; i < len; i++) {
act_2.ActObj.removeActObj(act[i]);
}
delete ActionTween.list[target.actionTarget_uniqueKey];
};
/**キャッシュ数を取得する*/
ActionTween.Length = function (target) {
var acts = ActionTween.activeList[target.actionTarget_uniqueKey];
return acts.act.length - 1;
};
/**キャッシュ上のアクションオブジェクトをインデックスを指定して取得する*/
ActionTween.Chash = function (target, no) {
var acts = ((ActionTween.activeList[target.actionTarget_uniqueKey]) || (ActionTween.list[target.actionTarget_uniqueKey]));
if (acts && acts.act.length > no)
return acts.act[no];
else
return null;
};
/**キャッシュ上のアクションオブジェクトをインデックスを指定して取得する*/
ActionTween.LastChash = function (target) {
var acts = ((ActionTween.activeList[target.actionTarget_uniqueKey]) || (ActionTween.list[target.actionTarget_uniqueKey]));
if (acts && acts.act.length > 0)
return acts.act[acts.act.length - 1];
else
return null;
};
/**キャッシュ上のアクションオブジェクトをインデックスを指定して取得する*/
ActionTween.Reset = function (target) {
var obj0;
var set = ((ActionTween.activeList[target.actionTarget_uniqueKey]) || (ActionTween.list[target.actionTarget_uniqueKey]));
var acts = set.act;
if (acts.length > 0)
obj0 = acts[0];
if (!obj0)
return;
//obj0.x.value = ("getX" in target) ? target.getX() : null;
//obj0.y.value = ("getY" in target) ? target.getY() : null;
//obj0.w.value = ("getW" in target) ? target.getW() : null;
//obj0.h.value = ("getH" in target) ? target.getH() : null;
//obj0.a.value = ("getA" in target) ? target.getA() : null;
//obj0.r.value = ("getR" in target) ? target.getR() : null;
//obj0.z.value = ("getZ" in target) ? target.getZ() : null;
//obj0.rx.value = ("getRX" in target) ? target.getRX() : null;
//obj0.ry.value = ("getRY" in target) ? target.getRY() : null;
//obj0.rz.value = ("getRZ" in target) ? target.getRZ() : null;
//obj0.ps.value = ("getPS" in target) ? target.getPS() : null;
var callSets = target.actionTarget_callsets;
for (var nm in callSets) {
obj0[nm].value = callSets[nm].get();
}
};
/**キャッシュ上のアクションオブジェクトをインデックスを指定して取得する*/
ActionTween.Zero = function (target) {
var obj0;
var set = ((ActionTween.activeList[target.actionTarget_uniqueKey]) || (ActionTween.list[target.actionTarget_uniqueKey]));
var acts = set.act;
if (acts.length > 0)
obj0 = acts[0];
if (!obj0)
return;
//("setX" in target) || target.setX(obj0.x.value);
//("setY" in target) || target.setY(obj0.y.value);
//("setW" in target) || target.setW(obj0.w.value);
//("setH" in target) || target.setH(obj0.h.value);
//("setA" in target) || target.setA(obj0.a.value);
//("setR" in target) || target.setR(obj0.r.value);
//("setZ" in target) || target.setZ(obj0.z.value);
//("setRX" in target) || target.setRX(obj0.rx.value);
//("setRY" in target) || target.setRY(obj0.ry.value);
//("setRZ" in target) || target.setRZ(obj0.rz.value);
//("setPS" in target) || target.setPS(obj0.ps.value);
var callSets = target.actionTarget_callsets;
for (var nm in callSets) {
callSets[nm].set(obj0[nm].value);
}
};
/**現在のアニメーションの終点まで移動する*/
ActionTween.Fill = function (target) {
var obj1;
var set = ((ActionTween.activeList[target.actionTarget_uniqueKey]) || (ActionTween.list[target.actionTarget_uniqueKey]));
var acts = set.act;
if (acts.length > 1)
obj1 = acts[1];
if (!obj1)
return;
//("setX" in target) ? target.setX(obj1.x.value) : null;
//("setY" in target) ? target.setY(obj1.y.value) : null;
//("setW" in target) ? target.setW(obj1.w.value) : null;
//("setH" in target) ? target.setH(obj1.h.value) : null;
//("setA" in target) ? target.setA(obj1.a.value) : null;
//("setR" in target) ? target.setR(obj1.r.value) : null;
//("setZ" in target) ? target.setZ(obj1.z.value) : null;
//("setRX" in target) ? target.setRX(obj1.rx.value) : null;
//("setRY" in target) ? target.setRY(obj1.ry.value) : null;
//("setRZ" in target) ? target.setRZ(obj1.rz.value) : null;
//("setPS" in target) ? target.setPS(obj1.ps.value) : null;
var callSets = target.actionTarget_callsets;
for (var nm in callSets) {
callSets[nm].set(obj1[nm].value);
}
};
/**1フレーム分進める 全て目標値に達成すると true 一つでも達成してないとfalse*/
ActionTween.GoOneFrame = function (target) {
var set = ((ActionTween.activeList[target.actionTarget_uniqueKey]) || (ActionTween.list[target.actionTarget_uniqueKey]));
var acts = set.act;
if (!acts)
return true;
var act = acts[0];
var act1 = acts[1];
var bool = true;
var acc = act1.acc;
var method = act1.method;
//bool = (ActionTween.ActionXYZWH(act.x, act1.x, acc, method, target.setX)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.y, act1.y, acc, method, target.setY)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.w, act1.w, acc, method, target.setW)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.h, act1.h, acc, method, target.setH)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.a, act1.a, acc, method, target.setA, 0.05)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.r, act1.r, acc, method, target.setR)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.z, act1.z, acc, method, target.setZ)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.rx, act1.rx, acc, method, target.setRX)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.ry, act1.ry, acc, method, target.setRY)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.rz, act1.rz, acc, method, target.setRZ)) ? bool : false;
//bool = (ActionTween.ActionXYZWH(act.ps, act1.ps, acc, method, target.setPS)) ? bool : false;
var callSets = target.actionTarget_callsets;
for (var nm in callSets) {
bool = (ActionTween.ActionXYZWH(act[nm], act1[nm], acc, method, callSets[nm].set, (nm === 'a') ? 0.05 : 1)) ? bool : false;
}
if (bool) {
if (act1.ef) {
act1.ef.call(null, target, act);
}
}
return bool;
};
/**次のアクションを開始する*/
ActionTween.GoNextAction = function (target) {
var set = ((ActionTween.activeList[target.actionTarget_uniqueKey]) || (ActionTween.list[target.actionTarget_uniqueKey]));
var acts = set.act;
if (!acts)
return false;
var next = acts[1];
var to;
if (acts.length > 2) {
to = acts[2];
}
var fact = acts.reverse().pop();
try {
if (next.rf) {
next.rf.call(null, target, next);
}
next.SetFrom(fact);
if (to && to.sf) {
to.sf.call(null, target, to);
}
}
finally {
return (acts.reverse().length >= 2);
}
};
ActionTween._active = false;
ActionTween.actionObj = new ts.ActionObj(function (index) {
for (var key in ActionTween.activeList) {
var target = ActionTween.activeList[key].target;
if (ActionTween.GoOneFrame(target)) {
var acts = ActionTween.activeList[target.actionTarget_uniqueKey];
if (acts && acts.act[1].autoRemove) {
if (!ActionTween.GoNextAction(target)) {
ActionTween.Stop(target);
}
}
}
}
return 1;
});
ActionTween.ActionXYZWH = function (act, next, acc, method, setFunc, limit) {
if (limit === void 0) { limit = 1; }
if (isNaN(next.value))
return true;
if (act.value === next.value)
return true;
var exit = false;
var v = next.value - act.value;
var f = (v < 0) ? -1 : 1;
var min = next.min;
var max = next.max;
if (min && min > (v * f))
v = min * f;
var actV = MathBit.floor(v * 10000) * 0.0001 * f;
if (max)
actV = (max < actV) ? max : actV;
if (min)
actV = (min > actV) ? min : actV;
var t = actV * acc * f;
//if (min && min > (t * f)) {
// t = min * f;
//}
switch (method) {
case ActionMethod.adsorb:
if (actV > limit) {
var value = t;
act.value += value;
}
else {
act.value = next.value;
exit = true;
}
break;
case ActionMethod.snap:
var before = act.value;
act.value += (act.vector += t);
act.vector *= acc;
var over = (next.snap) && ((act.value - before) * f > v * f);
if (over || (act.vector * f < 1 && (actV < 0.02 || (min && actV <= min)))) {
act.value = next.value;
exit = true;
}
break;
default:
}
setFunc(act.value);
return exit;
};
return ActionTween;
}());
act_2.ActionTween = ActionTween;
})(act = ts.act || (ts.act = {}));
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
///
var jp;
///
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var LoaderToken = /** @class */ (function () {
function LoaderToken(url, query, start, end, progress, error, jsonpCallbackName, responseType) {
var _this = this;
this.loading = false;
this.OnLoadStart = function (ev) {
_this.start(_this, ev);
};
this.OnLoadEnd = function (ev) {
_this.loading = false;
if (_this.jsonpCallbackName) {
window[_this.uniqu] = function (data) {
delete window[_this.id];
_this.jsonpData = data;
_this.end(_this, ev);
_this.release();
};
}
else {
_this.end(_this, ev);
_this.release();
}
};
this.OnLoadProgress = function (ev) {
_this.progress(_this, ev);
};
this.OnLoadError = function (ev) {
_this.loading = false;
_this.error(_this, ev);
_this.release();
};
this.getData = function () {
if (_this.data)
return _this.data;
if (_this.request instanceof HTMLScriptElement) {
_this.data = _this.jsonpData;
}
else {
if (_this.request) {
_this.data = _this.request.response;
return _this.data;
}
return null;
}
return _this.data;
};
this.open = function (method) {
_this.loading = false;
if (_this.request instanceof HTMLScriptElement) {
_this.uniqu = btoa(_this.id);
_this.jsonpCallbackScript.innerHTML = 'window.' + _this.jsonpCallbackName + ' = function(data){ window.setTimeout( function () { window["' + _this.uniqu + '"](data) }, 1); }';
switch (method) {
case LoadMethod.GET:
_this.request.src = _this.id;
break;
case LoadMethod.POST:
_this.request.src = _this.url;
break;
}
}
else {
switch (method) {
case LoadMethod.GET:
_this.request.open("GET", _this.id, true);
break;
case LoadMethod.POST:
_this.request.open("POST", _this.url, true);
break;
}
}
};
this.setRequestHeader = function (header, value) {
if (!(_this.request instanceof HTMLScriptElement)) {
_this.request.setRequestHeader(header, value);
}
};
this.setResponseType = function (responseType) {
if (!(_this.request instanceof HTMLScriptElement)) {
_this.request.responseType = responseType;
}
};
this.send = function (data) {
if (data === void 0) { data = null; }
try {
if (_this.request instanceof HTMLScriptElement) {
_this.jsonpCallbackScript.parentElement.insertBefore(_this.request, _this.jsonpCallbackScript);
//this.jsonpCallbackScript.parentElement.appendChild(this.request);
}
else {
_this.request.send(data);
}
_this.loading = true;
}
catch (ex) {
_this.loading = false;
window.console.error(ex);
}
};
this.release = function () {
_this.request.removeEventListener("loadend", _this.OnLoadEnd);
_this.request.removeEventListener("error", _this.OnLoadError);
_this.request.removeEventListener("loadstart", _this.OnLoadStart);
_this.request.removeEventListener("progress", _this.OnLoadProgress);
_this.request = null;
_this.end = null;
_this.start = null;
_this.progress = null;
_this.error = null;
};
this.url = url;
this.query = query;
this.start = start;
this.end = end;
this.progress = progress;
this.error = error;
this.jsonpCallbackName = jsonpCallbackName;
if (!jsonpCallbackName) {
this.request = (function () {
try {
return new XMLHttpRequest();
}
catch (e) { }
try {
return new ActiveXObject('MSXML2.XMLHTTP.6.0');
}
catch (e) { }
try {
return new ActiveXObject('MSXML2.XMLHTTP.3.0');
}
catch (e) { }
try {
return new ActiveXObject('MSXML2.XMLHTTP');
}
catch (e) { }
return null;
})();
try {
this.request.responseType = responseType;
}
catch (e) {
//window.console.error(e.message);
}
this.request.addEventListener("loadend", this.OnLoadEnd);
this.request.addEventListener("error", this.OnLoadError);
this.request.addEventListener("loadstart", this.OnLoadStart);
this.request.addEventListener("progress", this.OnLoadProgress);
}
else {
var script = document.createElement('script');
script.async = true;
script.classList.add('jp-ninesense-ts-loader-script');
script.addEventListener("load", this.OnLoadEnd);
script.addEventListener("error", this.OnLoadError);
script.addEventListener("loadstart", this.OnLoadStart);
script.addEventListener("progress", this.OnLoadProgress);
this.request = script;
this.jsonpCallbackScript = document.createElement('script');
this.jsonpCallbackScript.type = 'text/javascript';
var sqripts = document.getElementsByTagName('SCRIPT');
var lastScript = sqripts[sqripts.length - 1];
lastScript.parentElement.appendChild(this.jsonpCallbackScript);
}
this.m_setEvent = true;
}
Object.defineProperty(LoaderToken.prototype, "Loading", {
get: function () {
return this.loading;
},
enumerable: true,
configurable: true
});
return LoaderToken;
}());
ts.LoaderToken = LoaderToken;
var Loader = /** @class */ (function () {
function Loader(serverUrl) {
var _this = this;
this.owners = Object.create(null);
this.method = LoadMethod.GET;
this.AddOwner = function (owner, server_url, query_filter) {
if (server_url === void 0) { server_url = ''; }
if (query_filter === void 0) { query_filter = {}; }
if (!owner.iloadOwner_uniquekey) {
owner.iloadOwner_uniquekey = Loader.noSeq;
Loader.noSeq++;
}
if (!_this.owners[owner.iloadOwner_uniquekey]) {
var filter = {};
filter[server_url] = query_filter;
_this.owners[owner.iloadOwner_uniquekey] = { owner: owner, filter: filter };
}
else {
var setting = _this.owners[owner.iloadOwner_uniquekey];
setting.owner = owner;
setting.filter[server_url] = query_filter;
}
};
this.RemoveOwner = function (owner, server_url) {
if (server_url === void 0) { server_url = null; }
if (!server_url) {
delete _this.owners[owner.iloadOwner_uniquekey];
}
else {
delete _this.owners[owner.iloadOwner_uniquekey].filter[server_url];
}
};
this.autoparse = true;
this.RequestGet = function (url, query, ContentType, sendObj, autoparse, jsonpCallbackName, responseType) {
if (query === void 0) { query = null; }
if (ContentType === void 0) { ContentType = "application/x-www-form-urlencoded"; }
if (sendObj === void 0) { sendObj = false; }
if (autoparse === void 0) { autoparse = true; }
if (jsonpCallbackName === void 0) { jsonpCallbackName = null; }
if (responseType === void 0) { responseType = "text"; }
var method = _this.method;
_this.method = LoadMethod.GET;
try {
return _this.RequestUrl(url, query, ContentType, sendObj, autoparse, jsonpCallbackName, responseType);
}
finally {
_this.method = method;
}
};
this.RequestPost = function (url, query, ContentType, sendObj, autoparse, jsonpCallbackName, responseType) {
if (query === void 0) { query = null; }
if (ContentType === void 0) { ContentType = "application/x-www-form-urlencoded"; }
if (sendObj === void 0) { sendObj = false; }
if (autoparse === void 0) { autoparse = true; }
if (jsonpCallbackName === void 0) { jsonpCallbackName = null; }
if (responseType === void 0) { responseType = "text"; }
var method = _this.method;
_this.method = LoadMethod.POST;
try {
return _this.RequestUrl(url, query, ContentType, sendObj, autoparse, jsonpCallbackName, responseType);
}
finally {
_this.method = method;
}
};
this.RequestUrl = function (url, query, ContentType, sendObj, autoparse, jsonpCallbackName, responseType) {
if (query === void 0) { query = null; }
if (ContentType === void 0) { ContentType = "application/x-www-form-urlencoded"; }
if (sendObj === void 0) { sendObj = false; }
if (autoparse === void 0) { autoparse = true; }
if (jsonpCallbackName === void 0) { jsonpCallbackName = null; }
if (responseType === void 0) { responseType = "text"; }
if (sessionStorage.getItem(Loader.timeName) === null) {
try {
sessionStorage.setItem(Loader.timeName, new Date().getMilliseconds().toString());
}
catch (ex) {
console.error(ex);
}
}
var send_query = query;
if (!sendObj) {
if (typeof send_query === 'object') {
var params = [];
for (var name in send_query) {
var value = send_query[name];
if (typeof value === 'object') {
value = JSON.stringify(value);
}
var param = encodeURIComponent(name) + '=' + encodeURIComponent(value);
params.push(param);
}
send_query = params.join('&').replace(/%20/g, '+');
}
}
var token;
switch (_this.method) {
case LoadMethod.GET:
var id = url + "?loaderID=" + (sessionStorage.getItem(Loader.timeName) || 'unknown') + "&" + send_query;
if (Loader.tokens[id]) {
return Loader.tokens[id];
}
token = new LoaderToken(url, query, _this.OnLoadStart, _this.OnLoadEnd, _this.OnLoadProgress, _this.OnLoadError, jsonpCallbackName, responseType);
token.autoparse = autoparse;
token.id = id;
token.open(_this.method);
try {
token.setRequestHeader("Content-Type", ContentType);
}
catch (ex) {
}
token.send();
break;
case LoadMethod.POST:
token = new LoaderToken(url, query, _this.OnLoadStart, _this.OnLoadEnd, _this.OnLoadProgress, _this.OnLoadError, jsonpCallbackName, responseType);
token.autoparse = autoparse;
switch (ContentType) {
case 'application/json':
if (typeof (query) === 'string') {
var send = query;
}
else {
var send = JSON.stringify(query);
}
break;
default:
var send = "loaderID=" + (sessionStorage.getItem(Loader.timeName) || 'unknown') + '&' + send_query;
}
token.id = url + "?" + send;
token.open(_this.method);
try {
token.setRequestHeader("Content-Type", ContentType);
}
catch (ex) {
}
if (!sendObj) {
token.send(send);
}
else {
token.send(send_query);
}
break;
}
Loader.tokens[token.id] = token;
return token;
};
this.RequestQuery = function (query, ContentType, sendObj) {
if (query === void 0) { query = null; }
if (ContentType === void 0) { ContentType = 'application/x-www-form-urlencoded'; }
if (sendObj === void 0) { sendObj = false; }
return _this.RequestUrl(_this.serverUrl, query, ContentType, sendObj, _this.autoparse);
};
this.isLoading = function (id) {
if (!Loader.tokens[id])
return false;
Loader.tokens[id].Loading;
};
//private m_setEvent: boolean = false;
//private SetEvent = (token: LoaderToken, set:boolean): boolean => {
// if (token.m_setEvent === set) return;
// token.m_setEvent = set;
// if (set) {
// this.request.addEventListener("loadend", token.OnLoadEnd);
// this.request.addEventListener("error", token.OnLoadError);
// this.request.addEventListener("loadstart", token.OnLoadStart);
// this.request.addEventListener("progress", token.OnLoadProgress);
// }
// else {
// this.request.removeEventListener("loadend", token.OnLoadEnd);
// this.request.removeEventListener("error", token.OnLoadError);
// this.request.removeEventListener("loadstart", token.OnLoadStart);
// this.request.removeEventListener("progress", token.OnLoadProgress);
// }
//}
this.checkFilter = function (token, ownerKey) {
var ownerInfo = _this.owners[ownerKey];
var filter = ownerInfo.filter;
var query;
if ((query = filter[token.url]) || filter['']) {
var skip = false;
for (var param in query) {
var v = token.query[param];
if (!v || v !== query[param]) {
skip = true;
break;
}
}
return !skip;
}
return false;
};
this.OnLoadStart = function (token, ev) {
for (var key in _this.owners) {
if (_this.checkFilter(token, key))
_this.owners[key].owner.LoadStart(token);
}
};
this.OnLoadEnd = function (token, ev) {
var request = ev.target;
var data = token.getData();
var res;
if (token.autoparse) {
try {
if (typeof (data) === 'string') {
data = JSON.parse(decodeURIComponent(data));
}
res = { id: data['id'], status: data['status'], data: data['data'] };
}
catch (ex) {
window.console.error('Loader:ParseError');
}
}
else {
res = { data: data };
}
if (!res) {
res = { id: '', status: { loading: false }, data: data };
}
//this.owners.forEach((value: boolean, index: iLoadOwner, owner: Map) => {
for (var key in _this.owners) {
if (_this.checkFilter(token, key)) {
var owner = _this.owners[key].owner;
owner.LoadEnd(token, res);
}
}
};
this.OnLoadError = function (token, ev) {
for (var key in _this.owners) {
if (_this.checkFilter(token, key))
_this.owners[key].owner.LoadError(token, ev);
}
};
this.OnLoadProgress = function (token, ev) {
var owner;
for (var key in _this.owners) {
if (_this.checkFilter(token, key))
_this.owners[key].owner.LoadProgress(token, ev);
}
};
this.OnFormat = function (data) {
};
this.serverUrl = serverUrl;
}
Object.defineProperty(Loader.prototype, "serverURL", {
get: function () {
return this.serverUrl;
},
set: function (value) {
this.serverUrl = value;
},
enumerable: true,
configurable: true
});
Loader.timeName = 'jp.ninesense.ts.Common.ajax.Loader.time';
Loader.noSeq = 0;
Loader.tokens = {};
return Loader;
}());
ts.Loader = Loader;
var LoadMethod;
(function (LoadMethod) {
LoadMethod[LoadMethod["GET"] = 0] = "GET";
LoadMethod[LoadMethod["POST"] = 1] = "POST";
})(LoadMethod = ts.LoadMethod || (ts.LoadMethod = {}));
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var HistoryValues = /** @class */ (function () {
function HistoryValues() {
var _this = this;
this.state = {};
this.targes = [];
this._popStateSetting = false;
this.OnPopState = function (e) {
if (!e.state)
return;
_this._popStateSetting = true;
try {
var state = e.state;
if (state['jp.ninesense.ts']) {
_this.state = state['jp.ninesense.ts'];
}
var len = _this.targes.length;
var s = _this.state;
for (var i = 0; i < len; i++) {
var set = _this.targes[i];
set.callback(set.target, s[set.id]);
}
}
finally {
_this._popStateSetting = false;
}
};
this.addTarget = function (id, target, defaultValue, callback) {
_this.targes.push({ id: id, target: target, callback: callback });
var state = _this.state;
var def = false;
if (!state[id]) {
state[id] = defaultValue;
def = true;
}
var s = window.history.state;
if (!s) {
s = {};
}
s['jp.ninesense.ts'] = state;
window.history.replaceState(s, '');
if (!def) {
callback(target, state[id]);
}
};
this.getState = function (id, key) {
if (_this.state[id]) {
return _this.state[id][key];
}
return null;
};
this.push = function (id, key, value) {
var state = _this.state;
if (!state[id]) {
state[id] = {};
}
state[id][key] = value;
_this.reflesh();
};
this.reflesh = function () {
if (_this.time)
return;
_this.time = setTimeout(function () {
var state = window.history.state;
if (!state)
state = {};
state['jp.ninesense.ts'] = _this.state;
window.history.pushState(state, '', '#' + ts.str.randomString(12));
_this.time = null;
}, 1);
};
if (HistoryValues.instance !== undefined)
throw new Error('シングルトンクラスを複数インスタンス化出来ません。');
HistoryValues.instance = this;
this.values = Object.create(null);
window.addEventListener('popstate', this.OnPopState);
var state = window.history.state;
if (state && state['jp.ninesense.ts']) {
this.state = state['jp.ninesense.ts'];
}
}
Object.defineProperty(HistoryValues.prototype, "PopStateSetting", {
get: function () {
return this._popStateSetting;
},
enumerable: true,
configurable: true
});
HistoryValues.GetInstance = function () {
if (HistoryValues.instance === undefined) {
HistoryValues.instance = new HistoryValues();
}
return HistoryValues.instance;
};
HistoryValues.useableHistory = function () {
if (window.history && window.history.replaceState) {
return true;
}
else {
return false;
}
};
return HistoryValues;
}());
ts.HistoryValues = HistoryValues;
HistoryValues.GetInstance();
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var ServerValues = /** @class */ (function () {
function ServerValues() {
var _this = this;
this.ReadValues = function (id, reviver) {
if (!_this.values[id]) {
var value = document.getElementById(id).getAttribute('data-jsvalues');
value = decodeURIComponent(value);
_this.values[id] = JSON.parse(value, reviver);
}
return _this.values[id];
};
if (ServerValues.instance !== undefined)
throw new Error('シングルトンクラスを複数インスタンス化出来ません。');
ServerValues.instance = this;
this.values = Object.create(null);
}
ServerValues.GetInstance = function () {
if (ServerValues.instance === undefined) {
ServerValues.instance = new ServerValues();
}
return ServerValues.instance;
};
return ServerValues;
}());
ts.ServerValues = ServerValues;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var WebStorageValue = /** @class */ (function () {
function WebStorageValue() {
this.state = {};
this.hash = {};
this.OnStrage = function (e) {
};
if (WebStorageValue.instance !== undefined)
throw new Error('シングルトンクラスを複数インスタンス化出来ません。');
WebStorageValue.instance = this;
this.values = Object.create(null);
var state = window.addEventListener('storage', this.OnStrage);
}
WebStorageValue.GetInstance = function () {
if (WebStorageValue.instance === undefined) {
WebStorageValue.instance = new WebStorageValue();
}
return WebStorageValue.instance;
};
return WebStorageValue;
}());
ts.WebStorageValue = WebStorageValue;
WebStorageValue.GetInstance();
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var db = /** @class */ (function () {
function db(name, version) {
if (version === void 0) { version = 1; }
this.OnError = function (e) {
};
this.OnUpgradeneeded = function (e) {
};
this.request = db.indexedDB.open(name, version);
this.request.onerror = this.OnError;
this.request.onupgradeneeded = this.OnUpgradeneeded;
}
db.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
db.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction || { READ_WRITE: "readwrite" };
db.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;
return db;
}());
ts.db = db;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var dom = /** @class */ (function () {
function dom() {
}
dom.mapping = [];
dom.init = function (url, func) {
var under = location.pathname;
if (under === url || url === '' || ((url instanceof RegExp) && url.test(under))) {
if (document.readyState === "complete" || document.readyState === 'interactive') {
dom.mapping.push(func);
return setTimeout(dom.loaded, 1);
}
if (!dom.mapping[0]) {
if (window.addEventListener) {
window.addEventListener('DOMContentLoaded', dom.loaded, false);
}
else if ('attachEvent' in window) {
window.attachEvent('onreadystatechange', dom.loaded);
}
}
dom.mapping.push(func);
}
};
dom.loaded = function (e) {
var len = dom.mapping.length;
var param = ts.http.getParam();
for (var i = 0; i < len; i++) {
if (dom.mapping[i](param) === true) {
break;
}
}
dom.mapping = [];
};
dom.insertNext = function (target, point) {
var next = point.nextSibling;
if (next) {
if (target === next)
return;
target.ownerDocument.insertBefore(target, next);
}
else {
point.parentElement.appendChild(target);
}
};
dom.insertLastSameTag = function (target) {
var elements = target.ownerDocument.getElementsByTagName(target.tagName);
var last = elements[elements.length - 1];
dom.insertNext(last, target);
};
return dom;
}());
ts.dom = dom;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var elements = /** @class */ (function () {
function elements() {
}
elements.getElementByAny = function (key) {
if (key instanceof HTMLElement) {
return key;
}
else {
return document.getElementById(key);
}
};
return elements;
}());
ts.elements = elements;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var imageLightBox = /** @class */ (function () {
function imageLightBox(query) {
var _this = this;
this.OnClick = function (e) {
var img = e.target;
if (img instanceof HTMLImageElement) {
e.preventDefault();
_this.lightBox.show();
var id = img.getAttribute('data-ns-gallery-id');
var current = document.getElementById('ns-gallery-' + id);
current.classList.add('active');
_this.current = id;
}
};
this.OnClickLightBox = function (e) {
if (_this.current) {
var current = document.getElementById('ns-gallery-' + _this.current);
current.classList.remove('active');
_this.current = null;
}
return true;
};
var galleries = document.querySelectorAll(query);
var len = galleries.length;
if (len === 0)
return;
var images = [];
for (var i = 0; i < len; i++) {
galleries[i].addEventListener('click', this.OnClick);
var gs = galleries[i].getElementsByTagName('img');
var cnt = gs.length;
for (var j = 0; j < cnt; j++) {
images.push(gs[j]);
}
}
var lightBox = new jp.ninesense.ts.lightBox('gallery-lightbox', this.OnClickLightBox);
var ul = document.createElement('ul');
len = images.length;
for (var i_1 = 0; i_1 < len; i_1++) {
var org = images[i_1];
var url = org.getAttribute('data-ns-big-image');
if (!url) {
url = org.src;
}
if (!url)
continue;
var img = document.createElement("img");
img.src = url;
img.alt = org.alt;
img.setAttribute('data-ns-gallery-id', i_1.toString());
org.setAttribute('data-ns-gallery-id', i_1.toString());
var li = document.createElement('li');
li.id = 'ns-gallery-' + i_1.toString();
var div = document.createElement('div');
div.appendChild(img);
li.appendChild(div);
ul.appendChild(li);
}
lightBox.Dom.appendChild(ul);
this.lightBox = lightBox;
}
imageLightBox.init = function (targetBlockQuery) {
if (targetBlockQuery === void 0) { targetBlockQuery = '.gallery'; }
jp.ninesense.ts.imageLightBox.instance = new imageLightBox(targetBlockQuery);
};
return imageLightBox;
}());
ts.imageLightBox = imageLightBox;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var imageResource = /** @class */ (function () {
function imageResource() {
}
Object.defineProperty(imageResource, "Canvas", {
get: function () {
if (!imageResource.canvas) {
imageResource.canvas = document.createElement('canvas');
}
return imageResource.canvas;
},
enumerable: true,
configurable: true
});
imageResource.blankImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAMAAAAoyzS7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////AAAAVcLTfgAAAAF0Uk5TAEDm2GYAAAAMSURBVHjaYmAACDAAAAIAAU9tWeEAAAAASUVORK5CYII=';
imageResource.createFillImage = function (width, height, color, alpha) {
if (color === void 0) { color = 'white'; }
if (alpha === void 0) { alpha = false; }
var canvas = imageResource.Canvas;
var context = canvas.getContext("2d", { alpha: alpha });
try {
canvas.width = width;
canvas.height = height;
context.fillStyle = color;
context.fillRect(0, 0, width, height);
return canvas.toDataURL('image/png');
}
finally {
context.clearRect(0, 0, width, height);
}
};
return imageResource;
}());
ts.imageResource = imageResource;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var imageSlider = /** @class */ (function () {
function imageSlider(selector, visualSelector, overlaySelector, mouseEventListenerSelector, repeat, writeImageSize, wrapElement, dummyClass) {
var _this = this;
if (overlaySelector === void 0) { overlaySelector = null; }
if (mouseEventListenerSelector === void 0) { mouseEventListenerSelector = ''; }
if (repeat === void 0) { repeat = true; }
if (writeImageSize === void 0) { writeImageSize = true; }
if (wrapElement === void 0) { wrapElement = document; }
if (dummyClass === void 0) { dummyClass = null; }
this.contents = [];
this.current = 0;
this.showDumyS = false;
this.showDumyE = false;
this.maxX = 0;
this.slidePauseCount = 500;
this.overlayOutAcc = 0.08;
this.overlayInAcc = 0.02;
this.backgroundMoveAcc = 0.1;
this.backgroundMoveMin = 1;
this.backgroundMoveMax = null;
this._autoSlide = true;
this._sliding = false;
this.mouseMovied = false;
this.repeat = true;
this.writeImageSize = false;
this.getChild = function (index) {
var c = _this.contents[index];
if (c) {
return c.picture;
}
else {
return null;
}
};
this.getChildX = function (index) {
var c = _this.contents[index];
if (c) {
return c.x;
}
else {
return null;
}
};
this.addClass = function (slideContents, className) {
if (slideContents.button)
slideContents.button.classList.add(className);
if (slideContents.text)
slideContents.text.classList.add(className);
if (slideContents.picture)
slideContents.picture.classList.add(className);
};
this.removeClass = function (slideContents, className) {
if (slideContents.button)
slideContents.button.classList.remove(className);
if (slideContents.text)
slideContents.text.classList.remove(className);
if (slideContents.picture)
slideContents.picture.classList.remove(className);
};
this._refreshChildWait = false;
this.refreshChildren = function (sync, sizeRefresh) {
if (sync === void 0) { sync = false; }
if (sizeRefresh === void 0) { sizeRefresh = true; }
if (!sync && (_this._sliding || _this._mouseDown)) {
_this._refreshChildWait = true;
return;
}
var len = _this.frame.children.length;
var cnt = 0;
var current = _this.current;
var wrapElement = _this.wrapElement;
for (var i = 0; i < len; i++) {
var child = _this.frame.children[i];
var id = child.getAttribute(imageSlider.attr);
if (!id)
continue;
if (!_this.contents[cnt]) {
var button_1 = document.createElement('button');
button_1.setAttribute('data-ns-slide-index', cnt.toString());
_this.contents[cnt] = {
picture: child,
img: child.querySelector("img"),
video: child.querySelector("video"),
x: 0,
text: ((id) ? wrapElement.querySelector('.overlay_contents[data-ns-slide="' + id.toString() + '"]') : null),
button: button_1
};
var li = document.createElement('li');
li.appendChild(button_1);
_this.buttonArea.appendChild(li);
}
else {
var content = _this.contents[cnt];
content.picture = child;
content.img = child.querySelector("img");
content.video = child.querySelector("video");
content.text = ((id) ? wrapElement.querySelector('.overlay_contents[data-ns-slide="' + id.toString() + '"]') : null);
switch (cnt) {
case current:
_this.addClass(content, 'active');
_this.removeClass(content, 'previous');
_this.removeClass(content, 'next');
break;
case current - 1:
_this.removeClass(content, 'active');
_this.addClass(content, 'previous');
_this.removeClass(content, 'next');
break;
case current + 1:
_this.removeClass(content, 'active');
_this.removeClass(content, 'previous');
_this.addClass(content, 'next');
break;
default:
_this.removeClass(content, 'active');
_this.removeClass(content, 'previous');
_this.removeClass(content, 'next');
}
}
cnt++;
}
var cLen = _this.contents.length;
if (cnt < cLen) {
for (var i = len; i < cLen; i++) {
var button = _this.contents[i].button;
button.parentElement.parentElement.removeChild(button.parentElement);
}
_this.contents.length = cnt;
}
if (_this.repeat) {
_this.dummyS.picture.innerHTML = _this.contents[cnt - 1].picture.innerHTML;
_this.dummyE.picture.innerHTML = _this.contents[0].picture.innerHTML;
_this.dummyS.img = _this.dummyS.picture.querySelector('img');
_this.dummyE.img = _this.dummyE.picture.querySelector('img');
_this.dummyS.video = _this.dummyS.picture.querySelector('video');
_this.dummyE.video = _this.dummyE.picture.querySelector('video');
_this.frame.insertBefore(_this.dummyS.picture, _this.contents[0].picture);
_this.dummyS.picture.style.position = 'absolute';
_this.dummyS.picture.style.left = '-100%';
_this.frame.appendChild(_this.dummyE.picture);
}
if (sizeRefresh) {
//this.OnResize();
_this.refreshPosition();
}
};
this.OnAction = function (index, option) {
switch (index) {
case 1: //リサイズ
//this.OnResize();
if (_this.refreshPosition()) {
_this.slideImage(false, false);
}
break;
case 2: //カレントへスライド
_this.slideImage();
break;
case 3: //オートスライド
if (!_this.resizing) {
_this.showImage(_this.current + 1, true);
}
return 2;
case 4: //スライド完了
//this.OnResize();
_this.refreshPosition();
_this.settingClass();
if (_this.onSlided) {
_this.onSlided();
}
return 0;
}
return 0;
};
this.ButtonClick = function (e) {
e.preventDefault();
var target = e.target;
var id = parseInt(target.getAttribute('data-ns-slide-index'));
if (isNaN(id))
return;
_this.showImage(id);
};
this.SetupVisual = function (visual, overlay, mouseEventListener) {
_this.visual = visual;
_this.overlay = overlay;
if (mouseEventListener) {
_this.eventListener = mouseEventListener;
}
else {
_this.eventListener = _this.visual.parentElement;
}
_this.eventListener.addEventListener(jp.ninesense.ts.devise.pointerEvents.start, _this.OnMouseStart);
var pictuers = visual.getElementsByTagName('div');
var rect;
_this.actionVisual = new jp.ninesense.ts.act.ActionElement(visual);
var act = jp.ninesense.ts.act.ActionTween.Act(_this.actionVisual, _this.backgroundMoveAcc, jp.ninesense.ts.act.ActionMethod.snap);
act.autoRemove = false;
act.x.snap = true;
act.x.value = 0;
act.x.min = _this.backgroundMoveMin;
act.x.max = _this.backgroundMoveMax;
jp.ninesense.ts.act.ActionTween.Start(_this.actionVisual);
if (overlay) {
_this.actionOverlay = new jp.ninesense.ts.act.ActionElement(overlay);
var act = jp.ninesense.ts.act.ActionTween.Act(_this.actionOverlay, _this.overlayInAcc, jp.ninesense.ts.act.ActionMethod.adsorb);
act.autoRemove = false;
act.a.snap = true;
act.a.value = 0;
jp.ninesense.ts.act.ActionTween.Start(_this.actionOverlay);
}
};
this.MoveEndFunction = function () {
};
this.next = function (animate) {
if (animate === void 0) { animate = true; }
_this.showImage(_this.current + 1, animate);
};
this.previous = function (animate) {
if (animate === void 0) { animate = true; }
_this.showImage(_this.current - 1, animate);
};
this.showImage = function (index, animate, doEvents) {
if (animate === void 0) { animate = true; }
if (doEvents === void 0) { doEvents = true; }
if (_this.repeat) {
if (index < -1)
index = _this.contents.length - 1;
if (_this.contents.length < index)
index = 0;
}
else {
if (_this.contents.length <= index)
index = _this.contents.length - 1;
if (index <= -1)
index = 0;
}
var current = _this.contents[_this.current];
if (current) {
_this.removeClass(current, 'active');
var next = _this.nextElement;
if (next) {
_this.removeClass(next, 'next');
}
if (_this.repeat) {
current.picture.nextElementSibling.classList.remove('next');
}
var previous = _this.previousElement;
if (previous) {
_this.removeClass(previous, 'previous');
}
if (_this.repeat) {
current.picture.previousElementSibling.classList.remove('previous');
}
//current.button.classList.remove('active');
//current.picture.classList.remove('active');
//if (current.text) current.text.classList.remove('active');
if (current.video) {
current.video.pause();
if (_this.repeat) {
if (_this.current === 0) {
_this.dummyE.video.pause();
}
else if (_this.current === _this.contents.length - 1) {
_this.dummyS.video.pause();
}
}
}
}
_this.current = index;
current = _this.contents[_this.current];
if (animate) {
_this.action.option.pauseCount = 0;
var actVisual = jp.ninesense.ts.act.ActionTween.LastChash(_this.actionVisual);
actVisual.ef = null;
if (_this.downPoints) {
_this.action.setTickIndex(2);
}
else {
var action = _this.action;
action.actionFromTo(3, 2);
action.actionFromTo(4, 2);
action.stopTo(2);
}
}
else {
_this.slideImage(false, doEvents);
}
};
this.setEndPoint = function (x, resetX) {
//window.console.log(x, this.maxX);
if (resetX === void 0) { resetX = null; }
if (!_this.actionVisual)
return;
var actVisual = jp.ninesense.ts.act.ActionTween.LastChash(_this.actionVisual);
if (!resetX && resetX !== 0) {
actVisual.x.value = x;
}
else {
_this.actionVisual.setX(resetX);
_this.actionVisual.gotoEndPoint();
jp.ninesense.ts.act.ActionTween.Reset(_this.actionVisual);
actVisual.x.value = x;
}
actVisual.x.min = _this.backgroundMoveMin;
actVisual.x.max = _this.backgroundMoveMax;
actVisual.acc = _this.backgroundMoveAcc;
if (_this.onVisualActSetting) {
_this.onVisualActSetting("slide", actVisual);
}
};
this.settingClass = function () {
var content = _this.contents[_this.current];
_this.addClass(content, 'active');
var next = _this.nextElement;
if (next) {
_this.addClass(next, 'next');
}
if (_this.repeat) {
content.picture.nextElementSibling.classList.add('next');
}
var previous = _this.previousElement;
if (previous) {
_this.addClass(previous, 'previous');
}
if (_this.repeat) {
content.picture.previousElementSibling.classList.add('previous');
}
};
this.slideImage = function (animate, doEvents) {
if (animate === void 0) { animate = true; }
if (doEvents === void 0) { doEvents = true; }
var showDummy = false;
var slideX;
var content;
var len = _this.contents.length;
if (len === 0)
return;
if (_this.current >= len) {
if (_this.repeat) {
_this.current = 0;
content = _this.contents[0];
slideX = _this.dummyE.x;
_this.showDumyE = true;
showDummy = true;
}
else {
_this.current = len - 1;
content = _this.contents[_this.current];
slideX = content.x;
}
}
else if (_this.current <= -1) {
if (_this.repeat) {
_this.current = len - 1;
content = _this.contents[_this.current];
slideX = _this.dummyS.x;
_this.showDumyS = true;
showDummy = true;
}
else {
_this.current = 0;
content = _this.contents[_this.current];
slideX = content.x;
}
}
else {
content = _this.contents[_this.current];
slideX = content.x;
}
var actVisual = jp.ninesense.ts.act.ActionTween.LastChash(_this.actionVisual);
if (!animate) {
_this.setEndPoint(slideX, slideX);
}
else {
//actVisual.x.value = slideX;
_this.setEndPoint(slideX);
}
if (_this.actionOverlay) {
var actOverlay = jp.ninesense.ts.act.ActionTween.LastChash(_this.actionOverlay);
_this.actionOverlay.setA(-1);
jp.ninesense.ts.act.ActionTween.Reset(_this.actionOverlay);
actOverlay.a.value = 1;
actOverlay.acc = _this.overlayInAcc;
if (_this.onOverlayActSetting) {
_this.onOverlayActSetting("fade-in", actOverlay);
}
}
//if (content.text) {
// content.text.classList.add('active');
//}
//content.button.classList.add('active');
//content.picture.classList.add('active');
_this.settingClass();
if (content.video) {
content.video.play();
if (_this.showDumyS) {
if (_this.dummyS.video) {
_this.dummyS.video.currentTime = content.video.currentTime;
_this.dummyS.video.play();
}
}
else if (_this.showDumyE) {
if (_this.dummyE.video) {
_this.dummyE.video.currentTime = content.video.currentTime;
_this.dummyE.video.play();
}
}
}
if (!_this._sliding) {
_this._sliding = true;
}
if (doEvents) {
if (_this.onSliding) {
_this.onSliding();
}
}
if (!showDummy) {
actVisual.ef = function () {
actVisual.ef = null;
if (actOverlay)
actOverlay.a.value = 1;
_this.showDumyE = false;
_this.showDumyS = false;
_this.waitAutoSlide();
_this._sliding = false;
if (_this._refreshChildWait) {
_this._refreshChildWait = false;
_this.refreshChildren();
}
//if (this.onSliding) {
if (doEvents) {
var action = _this.action;
action.actionFromTo(2, 4);
//action.actionFromTo(3, 4);
}
//}
};
}
else {
actVisual.ef = function () {
actVisual.ef = null;
if (!_this.downPoints) {
_this.DummyReset(0);
_this.waitAutoSlide();
}
_this._sliding = false;
if (_this._refreshChildWait) {
_this._refreshChildWait = false;
_this.refreshChildren();
}
//if (this.onSliding) {
if (doEvents) {
var action = _this.action;
action.actionFromTo(2, 4);
//action.actionFromTo(3, 4);
}
//}
};
}
};
this.waitAutoSlide = function () {
if (_this.autoSlide) {
if (_this.action.getTickIndex() === 0) {
_this.action.option.pauseCount = _this.slidePauseCount;
_this.action.setTickIndex(3);
}
}
};
this.OnMouseStart = function (e) {
try {
_this._mouseDown = true;
if (e instanceof MouseEvent) {
_this.MouseStart({ x: e.pageX, y: e.pageY });
}
else {
var touch = e.touches[0];
_this.MouseStart({ x: touch.pageX, y: touch.pageY });
}
}
finally {
_this.mouseMovied = false;
_this.mouseMoveEnabled = true;
_this.mouseEndEnabled = true;
}
};
this._mouseDown = false;
this._mouseMoveEnabled = false;
this._mouseEndEnabled = false;
this.mouseSlideEnabled = true;
this.OnMouseMove = function (e) {
if (!_this.mouseSlideEnabled) {
e.preventDefault();
return;
}
_this.mouseMovied = true;
var point;
if (e instanceof MouseEvent) {
point = { x: e.pageX, y: e.pageY };
_this.MouseMove(point);
}
else if (e.touches[0]) {
var touch = e.touches[0];
point = { x: touch.pageX, y: touch.pageY };
_this.MouseMove(point);
}
if (jp.ninesense.ts.MathBit.abs(point.y - _this.downPoints.mouse.y) < 1) {
e.preventDefault();
}
};
this.OnMouseEnd = function (e) {
try {
if (e instanceof MouseEvent) {
_this.MouseEnd({ x: e.pageX, y: e.pageY });
}
else if (e.touches[0]) {
var touch = e.touches[0];
_this.MouseEnd({ x: touch.pageX, y: touch.pageY });
}
else if (_this.movePoints) {
_this.MouseEnd({ x: _this.movePoints.x, y: _this.movePoints.y });
}
}
finally {
_this.mouseMoveEnabled = false;
_this.mouseEndEnabled = false;
_this.mouseMovied = false;
_this._mouseDown = false;
if (_this._refreshChildWait) {
_this._refreshChildWait = false;
_this.refreshChildren();
}
}
};
this.MouseStart = function (point) {
//window.console.log(point.x);
_this.action.setTickIndex(0);
_this.action.option.pauseCount = 0;
var act = jp.ninesense.ts.act.ActionTween.LastChash(_this.actionVisual);
//window.console.log(this.showDumyS, this.showDumyE);
_this.downPoints = {
mouse: point, client: { x: act.x.value, y: act.y.value }
};
//this.movePoints = point;
_this.DummyReset(point.x);
};
this.DummyReset = function (downPointX) {
if (_this.showDumyE) {
_this.showDumyE = false;
var x = _this.actionVisual.getX();
var dummyX = _this.dummyE.x;
var resetX = x - dummyX;
if (_this.downPoints) {
_this.downPoints.client.x = resetX;
_this.setEndPoint(downPointX - (_this.downPoints.mouse.x - resetX), resetX);
}
else {
_this.setEndPoint(0, 0);
}
}
else if (_this.showDumyS) {
_this.showDumyS = false;
var x = _this.actionVisual.getX();
var dummyX = _this.maxX - _this.dummyS.x;
var resetX = x - dummyX;
if (_this.downPoints) {
_this.downPoints.client.x = resetX;
_this.setEndPoint(downPointX - (_this.downPoints.mouse.x - resetX), resetX);
}
else {
var lastContent = _this.contents[_this.contents.length - 1];
_this.setEndPoint(lastContent.x, lastContent.x);
}
}
};
this.MouseMove = function (point) {
//window.console.log(point.x);
if (_this.downPoints) {
if (!_this.movePoints) {
if (jp.ninesense.ts.MathBit.abs(_this.downPoints.mouse.x - point.x) < 30) {
return;
}
}
_this._sliding = true;
_this.movePoints = point;
var act = jp.ninesense.ts.act.ActionTween.LastChash(_this.actionVisual);
act.x.value = point.x - (_this.downPoints.mouse.x - _this.downPoints.client.x);
if (_this.onVisualActSetting) {
_this.onVisualActSetting("mouse", act);
}
if (_this.actionOverlay) {
var act = jp.ninesense.ts.act.ActionTween.LastChash(_this.actionOverlay);
act.a.value = -1;
act.acc = _this.overlayOutAcc;
if (_this.onOverlayActSetting) {
_this.onOverlayActSetting("fade-out", act);
}
}
if (_this.onSliding) {
_this.onSliding();
}
}
};
this.MouseEnd = function (point) {
//window.console.log(point.x);
try {
if (!_this.mouseMovied)
return;
if (!_this.downPoints || !_this.movePoints) {
_this.showImage(_this.current);
return;
}
if (_this.movePoints.x === _this.downPoints.mouse.x) {
_this.showImage(_this.current);
return;
}
var diff = point.x - _this.downPoints.mouse.x;
if (diff > 50)
_this.showImage(_this.current - 1);
else if (diff < -50)
_this.showImage(_this.current + 1);
else
_this.showImage(_this.current);
}
finally {
_this.downPoints = null;
_this.movePoints = null;
_this.waitAutoSlide();
}
};
this.resizing = false;
this.OnResize = function (e) {
if (e === void 0) { e = null; }
if (_this.refreshPosition()) {
if (!_this._mouseDown) {
_this.slideImage(false, false);
}
}
};
this.refreshPosition = function () {
var len = _this.contents.length;
var rect = jp.ninesense.ts.Rects.Catch();
var frameSize = _this.frame.getBoundingClientRect();
var fw = frameSize.width;
var fh = frameSize.height;
var isMobileSize = window.innerWidth < 864;
var sumX = 0;
_this.resizing = true;
var retry = false;
var firstContents = _this.contents[0];
var offset = 0;
if (firstContents) {
offset = firstContents.picture.getBoundingClientRect().left - _this.frame.getBoundingClientRect().left;
}
try {
for (var i = 0; i < len; i++) {
var content = _this.contents[i];
var img = content.img;
if (i === 0) {
if (img && !img.complete) {
content.img.addEventListener("load", function () {
//this.refreshPosition();
if (_this.refreshPosition()) {
_this.slideImage(false, false);
}
});
retry = true;
return false;
}
else {
_this.waitAutoSlide();
}
}
if (isMobileSize) {
if (img) {
rect.width = img.naturalWidth;
rect.height = img.naturalHeight;
}
else {
rect.width = fw;
rect.height = fh;
}
var scale = rect.AsOverSize(fw, fh).toString();
var x = (fw - rect.width) * 0.5;
//content.img.style.transform = 'translateX(' + x.toString() + 'px ) scale3d(' + scale + ',' + scale + ',1)';
if (img) {
if (rect.width !== fw) {
img.style.width = '';
if (_this.writeImageSize) {
img.style.height = fh.toString() + 'px';
}
img.style.left = x.toString() + 'px';
}
else {
if (_this.writeImageSize) {
img.style.width = fw.toString() + 'px';
}
img.style.height = '';
img.style.left = x.toString() + 'px';
}
if (_this.repeat) {
if (i === 0) {
_this.dummyE.img.style.width = content.img.style.width;
_this.dummyE.img.style.height = content.img.style.height;
_this.dummyE.img.style.left = content.img.style.left;
}
else if (i === len - 1) {
_this.dummyS.img.style.width = content.img.style.width;
_this.dummyS.img.style.height = content.img.style.height;
_this.dummyS.img.style.left = content.img.style.left;
}
}
}
//content.img.style.left = x.toString() + 'px';
}
else {
if (img) {
img.style.transform = '';
img.style.width = '';
img.style.height = '';
}
}
content.x = sumX - offset;
sumX -= fw;
}
if (!isMobileSize) {
if (_this.repeat) {
_this.dummyE.img.style.width = '';
_this.dummyE.img.style.height = '';
_this.dummyS.img.style.width = '';
_this.dummyS.img.style.height = '';
}
}
if (_this.repeat) {
_this.dummyE.x = sumX;
_this.dummyS.x = fw;
}
if (!_this._mouseDown) {
_this.resizing = false;
//this.action.stopTo(1);
}
_this.maxX = -sumX + fw;
return true;
}
finally {
if (!retry) {
if (_this.onResized)
_this.onResized();
_this.resizing = false;
}
}
};
if (!wrapElement)
return;
this.wrapElement = wrapElement;
if (typeof (selector) === 'string') {
this.frame = wrapElement.querySelector(selector);
}
else {
this.frame = selector;
}
this.action = new jp.ninesense.ts.ActionObj(this.OnAction);
this.action.option = { data: null, pauseCount: 5 };
this.repeat = repeat;
this.writeImageSize = writeImageSize;
var tagName = 'div';
var visual;
if (typeof (visualSelector) === 'string') {
visual = wrapElement.querySelector(visualSelector);
}
else {
visual = visualSelector;
}
if (visual.tagName === 'UL') {
tagName = 'li';
}
this.dummyS = { picture: document.createElement(tagName), x: 0, img: null, video: null };
this.dummyE = { picture: document.createElement(tagName), x: 0, img: null, video: null };
if (dummyClass) {
this.dummyS.picture.className = dummyClass.s;
this.dummyE.picture.className = dummyClass.e;
}
this.buttonArea = document.createElement('ul');
this.buttonArea.classList.add('button-area');
this.refreshChildren(false, false);
window.addEventListener("resize", function () {
_this.action.option.pauseCount = 0;
_this.action.setTickIndex(1);
});
this.buttonArea.addEventListener("click", this.ButtonClick);
var overlay;
if (overlaySelector) {
if (typeof (overlaySelector) === 'string') {
overlay = wrapElement.querySelector(overlaySelector);
}
else {
overlay = overlaySelector;
}
}
var mouseEventListener;
if (mouseEventListenerSelector) {
if (typeof (mouseEventListenerSelector) === 'string') {
mouseEventListener = wrapElement.querySelector(mouseEventListenerSelector);
}
else {
mouseEventListener = mouseEventListenerSelector;
}
}
this.SetupVisual(visual, overlay, mouseEventListener);
this.OnResize();
if (this.overlay) {
this.overlay.parentElement.appendChild(this.buttonArea);
}
}
Object.defineProperty(imageSlider.prototype, "slideFrame", {
get: function () {
return this.frame;
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "currentIndex", {
get: function () {
return this.current;
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "currentElement", {
get: function () {
var c = this.contents[this.current];
if (c) {
return c;
}
else {
return null;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "previousElement", {
get: function () {
var index = this.current - 1;
if (index === -1 && this.repeat) {
index = this.contents.length - 1;
}
var c = this.contents[index];
if (c) {
return c;
}
else {
return null;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "nextElement", {
get: function () {
var index = this.current + 1;
if (index === this.contents.length && this.repeat) {
index = 0;
}
var c = this.contents[index];
if (c) {
return c;
}
else {
return null;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "length", {
get: function () {
return this.contents.length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "sliding", {
get: function () {
return this._sliding;
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "autoSlide", {
get: function () {
return this._autoSlide;
},
set: function (value) {
if (this._autoSlide === value)
return;
this._autoSlide = value;
if (value) {
this.frame.parentElement.classList.remove('slide-stop');
this.action.option.pauseCount = 0;
this.showImage(this.current, true);
}
else {
this.frame.parentElement.classList.add('slide-stop');
this.action.option.pauseCount = 0;
this.showImage(this.current, false);
this.action.setTickIndex(0);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "mouseDown", {
get: function () {
return this._mouseDown;
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "mouseMoveEnabled", {
get: function () { return this._mouseMoveEnabled; },
set: function (value) {
if (this._mouseMoveEnabled === value)
return;
this._mouseMoveEnabled = value;
if (value) {
this.eventListener.addEventListener(jp.ninesense.ts.devise.pointerEvents.move, this.OnMouseMove);
}
else {
this.eventListener.removeEventListener(jp.ninesense.ts.devise.pointerEvents.move, this.OnMouseMove);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "mouseEndEnabled", {
get: function () { return this._mouseEndEnabled; },
set: function (value) {
if (this._mouseEndEnabled === value)
return;
this._mouseEndEnabled = value;
if (value) {
if (jp.ninesense.ts.devise.isMobile) {
this.eventListener.addEventListener(jp.ninesense.ts.devise.pointerEvents.end, this.OnMouseEnd);
}
else {
document.addEventListener(jp.ninesense.ts.devise.pointerEvents.end, this.OnMouseEnd);
}
}
else {
this.eventListener.removeEventListener(jp.ninesense.ts.devise.pointerEvents.end, this.OnMouseEnd);
document.removeEventListener(jp.ninesense.ts.devise.pointerEvents.end, this.OnMouseEnd);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(imageSlider.prototype, "isLastIndex", {
get: function () {
return this.currentIndex + 1 >= this.length;
},
enumerable: true,
configurable: true
});
imageSlider.attr = 'data-ns-slide';
return imageSlider;
}());
ts.imageSlider = imageSlider;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
/*
*/
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var imageThrobber = /** @class */ (function () {
function imageThrobber(query, waitTime, loadingClass) {
var _this = this;
if (waitTime === void 0) { waitTime = 200; }
if (loadingClass === void 0) { loadingClass = 'imageloading-throbber'; }
this.images = {};
this.OnLoad = function (e) {
if (e === void 0) { e = null; }
var image = e.currentTarget;
var id = image.getAttribute(imageThrobber.attr);
_this.ShowImage(id);
};
this.ShowImage = function (id) {
var loadingImages = _this.images[id];
var image = loadingImages.img;
var dumy = loadingImages.dummy;
image.onload = null;
image.style.display = loadingImages.display;
dumy.parentElement.removeChild(dumy);
if (_this.loadingClass) {
image.parentElement.classList.remove(_this.loadingClass);
}
};
var images = document.querySelectorAll(query);
var len = images.length;
var cnt = 0;
var loadingImages = this.images;
this.loadingClass = loadingClass;
for (var i = 0; i < len; i++) {
var image = images[i];
if (!image.complete) {
cnt++;
var id = imageThrobber.attr + '_' + i.toString();
var w = image.width;
var h = image.height;
var dummy = document.createElement('canvas');
loadingImages[id] = { img: image, display: image.style.display, dummy: dummy, src: image.src };
image.style.display = 'none';
image.setAttribute(imageThrobber.attr, id);
dummy.className = image.className;
dummy.width = image.width;
dummy.height = image.height;
dummy.id = id;
dummy.style.maxWidth = '100%';
dummy.style.maxHeight = '100%';
dummy.style.width = 'auto';
dummy.style.height = 'auto';
if (loadingClass) {
image.parentElement.classList.add(loadingClass);
}
image.src = jp.ninesense.ts.imageResource.blankImage;
image.parentElement.insertBefore(dummy, image);
image.parentElement.removeChild(image);
}
}
setTimeout(function () {
for (var id in loadingImages) {
var img = loadingImages[id].img;
var dummy = loadingImages[id].dummy;
dummy.parentElement.insertBefore(img, dummy);
img.src = loadingImages[id].src;
if (!img.complete) {
img.onload = _this.OnLoad;
}
else {
_this.ShowImage(id);
}
}
}, waitTime);
}
imageThrobber.attr = 'data-ns-image-throbber-id';
imageThrobber.init = function (query, waitTime) {
imageThrobber.instance = new imageThrobber(query, waitTime);
};
return imageThrobber;
}());
ts.imageThrobber = imageThrobber;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var lightBox = /** @class */ (function () {
function lightBox(className, click) {
var _this = this;
this.scroll = 0;
this.show = function () {
document.body.appendChild(_this.dom);
_this.scroll = (window.pageYOffset !== undefined) ? window.pageYOffset : window.scrollY;
if (_this.body_inner) {
var style = _this.body_inner.style;
style.top = '-' + _this.scroll.toString() + 'px';
style.position = 'fixed';
style.overflow = 'hidden';
style.width = '100vw';
}
document.getElementsByTagName('html')[0].style.overflow = 'hidden';
};
this.hide = function () {
if (_this.dom.parentElement) {
_this.dom.parentElement.removeChild(_this.dom);
}
if (_this.body_inner) {
var style = _this.body_inner.style;
style.top = '';
style.position = '';
style.width = '';
window.scrollTo(0, _this.scroll);
}
document.getElementsByTagName('html')[0].style.overflow = '';
};
this.visible = function () {
if (_this.dom.parentElement) {
return true;
}
else {
return false;
}
};
this.OnMouseDown = function (e) {
if (e instanceof TouchEvent) {
_this.mousedownTarget = e.touches[0].target;
}
else {
_this.mousedownTarget = e.target;
}
};
this.OnClickLightBox = function (e) {
try {
if (!_this.click || _this.click(e)) {
_this.hide();
}
}
finally {
_this.mousedownTarget = null;
}
};
var lightBox = document.createElement("div");
var style = lightBox.style;
style.position = 'fixed';
style.top = '0px';
style.left = '0px';
style.width = '100vw';
style.height = '100vh';
lightBox.classList.add(className);
lightBox.addEventListener(jp.ninesense.ts.devise.pointerEvents.start, this.OnMouseDown);
lightBox.addEventListener('click', this.OnClickLightBox);
this.click = click;
this.body_inner = document.getElementsByClassName('body-inner')[0];
this.dom = lightBox;
}
Object.defineProperty(lightBox.prototype, "Dom", {
get: function () {
return this.dom;
},
enumerable: true,
configurable: true
});
Object.defineProperty(lightBox.prototype, "MouseDownTarget", {
get: function () {
return this.mousedownTarget;
},
enumerable: true,
configurable: true
});
return lightBox;
}());
ts.lightBox = lightBox;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var loadingLightBox = /** @class */ (function (_super) {
__extends(loadingLightBox, _super);
function loadingLightBox() {
var _this = _super.call(this, 'ns-loading-lightbox', function () {
return false;
}) || this;
_this.OnLightBoxClick = function (e) {
return false;
};
var wrap = document.createElement('div');
var throbberW = document.createElement('div');
throbberW.classList.add('throbber');
for (var i = 0; i < 12; i++) {
throbberW.appendChild(document.createElement('span'));
}
wrap.appendChild(throbberW);
var message = document.createElement('p');
wrap.appendChild(message);
var style = _this.Dom.style;
style.zIndex = '999999';
style.backgroundColor = 'rgba(0,0,0,0.7)';
_this.Dom.appendChild(wrap);
return _this;
}
loadingLightBox.getInstance = function () {
if (!loadingLightBox.instance) {
loadingLightBox.instance = new loadingLightBox();
}
return loadingLightBox.instance;
};
return loadingLightBox;
}(ts.lightBox));
ts.loadingLightBox = loadingLightBox;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var photoSlider = /** @class */ (function () {
function photoSlider(selector) {
var _this = this;
this.cashTags = {};
this.loaderTags = [];
this.current = -1;
this.loaded = -1;
this.currentPage = -1;
this.pages = [];
this.currentSize = 'full';
this.clickOnNextPage = true;
this.clickOnNextIndex = true;
this.clickOnPreviousPage = true;
this.clickOnPreviousIndex = true;
this._useToolSet = true;
this.beforeEntry = { page: -1, index: -1 };
this.OnSlided = function () {
var index = _this.slider.currentIndex;
var pIndex = _this.currentPage;
_this.refreshClass();
var entry = (index !== _this.beforeEntry.index || pIndex !== _this.beforeEntry.page);
if (entry) {
_this.beforeEntry.index = index;
_this.beforeEntry.page = pIndex;
}
if (_this.onEnter) {
_this.onEnter(pIndex, index, entry, !_this.slider.sliding);
}
};
this.refreshClass = function () {
if (!_this.slider)
return;
var max = _this.slider.length - 1;
var index = _this.slider.currentIndex;
var p = (max === 0) ? 0 : index / max;
var current = _this.bar.querySelector(".current");
current.style.transform = 'scaleX(' + p + ')';
var pMax = _this.pages.length - 1;
var pIndex = _this.currentPage;
var frameClass = _this.frame.classList;
if (index !== max) {
frameClass.remove('index-max');
}
else {
frameClass.add('index-max');
}
if (index !== 0) {
frameClass.remove('index-min');
}
else {
frameClass.add('index-min');
}
if (pIndex !== 0) {
frameClass.remove('page-min');
}
else {
frameClass.add('page-min');
}
if (pIndex !== pMax) {
frameClass.remove('page-max');
}
else {
frameClass.add('page-max');
}
};
this.setup = function () {
var slider = document.createElement("div");
slider.classList.add('photo-slider');
_this.sliderTag = slider;
var photo = document.createElement('div');
var controles = document.createElement('div');
_this.photo = photo;
photo.classList.add('photo');
controles.classList.add('controles');
photo.appendChild(slider);
var left = document.createElement('button');
var right = document.createElement('button');
var left_button = document.createElement('span');
var right_button = document.createElement('span');
left.type = 'button';
right.type = 'button';
left.appendChild(left_button);
right.appendChild(right_button);
left.classList.add('left');
right.classList.add('right');
var bar = document.createElement('div');
var loading = document.createElement("div");
loading.style.position = "absolute";
loading.style.width = '100%';
loading.style.transform = 'scaleX(0)';
loading.classList.add('loading');
var current = document.createElement("div");
current.style.position = "absolute";
current.style.width = '100%';
current.classList.add('current');
var barset = document.createElement('div');
barset.classList.add('barset');
bar.style.position = "relative";
//bar.style.width = "100%";
bar.appendChild(loading);
bar.appendChild(current);
bar.classList.add('bar');
bar.addEventListener(jp.ninesense.ts.devise.pointerEvents.start, _this.OnBarMousedown);
_this.left = left;
_this.right = right;
_this.bar = bar;
barset.appendChild(left);
barset.appendChild(bar);
barset.appendChild(right);
controles.appendChild(barset);
var controlUnder = document.createElement('div');
_this.scaleButton = document.createElement('button');
_this.scaleButton.innerHTML = '';
_this.scaleButton.classList.add('scale');
_this.scaleButton.addEventListener('click', function (e) {
var htmlClassList = document.documentElement.classList;
var classList = _this.scaleButton.classList;
if (!classList.contains('clicked')) {
classList.add('clicked');
htmlClassList.add('image-fixed');
}
else {
classList.remove('clicked');
htmlClassList.remove('image-fixed');
}
});
controlUnder.classList.add('toolset');
controlUnder.appendChild(_this.scaleButton);
controlUnder.style.width = '100%';
controles.appendChild(controlUnder);
_this.toolSet = controlUnder;
_this.constols = controles;
_this.frame.appendChild(photo);
_this.frame.appendChild(controles);
//this.show(0);
_this.frame.addEventListener("click", _this.OnClick);
//if (!jp.ninesense.ts.devise.isSafari) {
// this.wheelEnabled = true;
//}
window.addEventListener("keydown", _this.OnKeydown);
_this.createMenu();
_this.setupPage();
_this.photo.addEventListener(jp.ninesense.ts.devise.pointerEvents.start, _this.OnPhotoMouseDown);
_this.photo.addEventListener("contextmenu", function (e) {
e.preventDefault();
});
//this.photo.addEventListener('click', (e) => {
// if (this.isMobile || this.isMiddle) {
// if (window.innerWidth < window.innerHeight) {
// this.next(true);
// }
// else {
// if (e.pageX < window.innerWidth * 0.5) {
// this.previous(true);
// }
// else {
// this.next(true);
// }
// }
// }
// else {
// this.next(true);
// }
//});
};
this.photoMouseDown = false;
this.photoMouseDownPointX = 0;
this.photoMouseMovied = false;
this.OnPhotoMouseDown = function (e) {
_this.photoMouseMovied = false;
var pageX = 0;
if (e instanceof MouseEvent) {
switch (e.button) {
case 0:
break;
default:
return;
}
pageX = e.pageX;
}
else {
pageX = e.touches[0].pageX;
}
_this.photoMouseDownPointX = pageX;
if (!_this.photoMouseDown) {
_this.photoMouseDown = true;
window.addEventListener(jp.ninesense.ts.devise.pointerEvents.move, _this.OnPhotoMouseMove);
window.addEventListener(jp.ninesense.ts.devise.pointerEvents.end, _this.OnPhotoMouseUp);
}
};
this.OnPhotoMouseMove = function (e) {
var pageX = 0;
if (e instanceof MouseEvent) {
pageX = e.pageX;
}
else {
pageX = e.touches[0].pageX;
}
if (Math.abs(_this.photoMouseDownPointX - pageX) > 10) {
_this.photoMouseMovied = true;
}
};
this.OnPhotoMouseUp = function (e) {
window.removeEventListener(jp.ninesense.ts.devise.pointerEvents.move, _this.OnPhotoMouseMove);
window.removeEventListener(jp.ninesense.ts.devise.pointerEvents.end, _this.OnPhotoMouseUp);
try {
if (!_this.photoMouseMovied) {
var pageIndex = _this.pageIndex;
var current = _this.slider.currentIndex;
var isLast = _this.slider.isLastIndex;
var isStart = _this.slider.currentIndex === 0;
var enabledNext = (!isLast && _this.clickOnNextIndex) || (isLast && _this.clickOnNextPage);
var enabledPrebious = (!isStart && _this.clickOnPreviousIndex) || (isStart && _this.clickOnPreviousPage);
if (_this.isMobile || _this.isMiddle) {
if (window.innerWidth < window.innerHeight) {
if (enabledNext) {
_this.next(true);
}
}
else {
if (_this.photoMouseDownPointX < window.innerWidth * 0.5) {
if (enabledPrebious) {
_this.previous(true);
}
}
else {
if (enabledNext) {
_this.next(true);
}
}
}
}
else {
if (!e.shiftKey) {
if (enabledNext) {
_this.next(true);
}
}
else {
if (enabledPrebious) {
_this.previous(true);
}
}
}
if (_this.onClicked) {
_this.onClicked(pageIndex, current);
}
}
}
finally {
_this.photoMouseDown = false;
_this.photoMouseMovied = false;
}
};
this.getImages = function () {
var page = _this.pages[_this.currentPage];
var images = _this.images[page];
var isMobile = _this.isMobile;
var isMiddle = _this.isMiddle;
if (_this.isMobile && images['mobile']) {
images = images['mobile'];
_this.currentSize = 'mobile';
}
else if (_this.isMiddle && images['middle']) {
images = images['middle'];
_this.currentSize = 'mobile';
}
else {
images = images['full'];
}
return images;
};
this.getDir = function () {
var page = _this.pages[_this.currentPage];
var path;
switch (_this.currentSize) {
case 'middle':
path = _this.folder + page + '/middle/';
break;
case 'mobile':
path = _this.folder + page + '/mobile/';
break;
default:
path = _this.folder + page + '/';
}
return path;
};
this.setupPage = function (page, last) {
if (page === void 0) { page = 0; }
if (last === void 0) { last = false; }
if (page < 0)
page = 0;
if (_this.pages.length - 1 < page)
page = _this.pages.length - 1;
if (_this.currentPage === page)
return;
_this.currentPage = page;
_this.frame.classList.remove('show');
_this.loadorder = (last) ? 1 : 0;
if (!_this.createBlankImages()) {
_this.createLoadImage(_this.getImages());
}
if (_this.slider) {
if (!last) {
_this.slider.showImage(0, false);
}
else {
_this.slider.showImage(_this.slider.length - 1, false);
}
}
setTimeout(function () {
_this.frame.classList.add('show');
}, 500);
};
this.createMenu = function () {
//var menu = document.createElement('div');
//var link_list = document.createElement('ul');
var images = _this.images;
var no = -1;
for (var index in images) {
no++;
_this.pages[no] = index;
//var link = document.createElement('li');
//link.id = 'menu-link-' + index;
//var button = document.createElement('button');
//button.classList.add('menu-link-button');
//button.setAttribute(photoSlider.pageAttr, no.toString());
//button.type = 'button';
//link.appendChild(button);
//link_list.appendChild(link);
}
//menu.appendChild(link_list);
////this.frame.appendChild(menu);
};
this.addPage = function (pageIndex, images) {
if (images === void 0) { images = []; }
if (_this.images[pageIndex])
return false;
_this.pages[_this.pages.length] = pageIndex;
_this.images[pageIndex] = { full: images };
return true;
};
this.createBlankImages = function () {
var images = _this.getImages();
var isMobile = _this.isMobile;
var isMiddle = _this.isMiddle;
if (isMiddle) {
w = 768;
h = 768;
}
else if (isMobile) {
w = 566;
h = 566;
}
else {
w = 1045;
h = 1045;
}
var len = images.length;
var w;
var h;
if (!photoSlider.blankImage) {
photoSlider.blankImage = jp.ninesense.ts.imageResource.createFillImage(w, h, 'white', false);
}
var blank = photoSlider.blankImage;
var isCash = false;
var cash;
if (_this.cashTags[_this.currentPage]) {
cash = _this.cashTags[_this.currentPage];
_this.sliderTag.innerHTML = '';
for (var i = 0; i < len; i++) {
_this.sliderTag.appendChild(cash[i]);
}
isCash = true;
_this.loaded = len;
}
else {
//cash = [];
//this.cashTags[this.currentPage] = cash;
//this.sliderTag.innerHTML = '';
var slider = _this.sliderTag;
for (var i = 0; i < len; i++) {
//if (!this.images[this.loaded + 1]) break;
if (!_this.loaderTags[i]) {
var load = document.createElement('img');
load.classList.add('load-image');
load.src = blank;
load.id = 'load-image-' + (i + 1).toString();
load.width = w;
load.height = h;
var imgDiv = document.createElement('div');
imgDiv.classList.add('blank');
imgDiv.appendChild(load);
imgDiv.classList.add('current-image');
imgDiv.setAttribute(jp.ninesense.ts.imageSlider.attr, (i + 1).toString());
slider.appendChild(imgDiv);
_this.loaderTags[i] = imgDiv;
}
else {
var imgDiv = _this.loaderTags[i];
imgDiv.classList.add('blank');
var load = imgDiv.firstChild;
load.src = blank;
if (!imgDiv.parentElement) {
slider.appendChild(imgDiv);
}
}
//cash.push(imgDiv);
}
var cLen = _this.loaderTags.length;
for (var i = len; i < cLen; i++) {
var imgDiv = _this.loaderTags[i];
if (imgDiv.parentElement) {
var load = imgDiv.firstChild;
load.src = blank;
slider.removeChild(imgDiv);
}
}
_this.loaded = -1;
}
if (!_this.slider) {
_this.slider = new jp.ninesense.ts.imageSlider('.photo-slider', '.photo-slider', null, null, false, false);
_this.slider.backgroundMoveAcc = 0.1;
_this.slider.backgroundMoveMin = 0;
_this.slider.autoSlide = false;
_this.slider.onSliding = _this.OnSlided;
_this.slider.onSlided = _this.OnSlided;
}
else {
_this.slider.refreshChildren();
}
return isCash;
};
this.loadorder = loadorder.asc;
this.createLoadImage = function (images) {
var path = _this.getDir();
var load;
while (!load || load.complete) {
if (!images[_this.loaded + 1])
break;
var target;
switch (_this.loadorder) {
case loadorder.desc:
target = images.length - 1 - _this.loaded;
if (!images[target - 1])
break;
target--;
break;
default:
target = _this.loaded;
if (!images[target + 1])
break;
target++;
}
_this.loaded++;
var imgDiv = _this.loaderTags[target];
if (_this.loaded === 0) {
imgDiv.classList.add('active');
}
var load = imgDiv.firstChild;
load.addEventListener("load", _this.OnImageLoad);
var set = images[target];
load.width = set.width;
load.height = set.height;
load.src = path + set.url;
_this.refreshSizeMethod(target);
}
if (_this.onCreatedLoadImages) {
_this.onCreatedLoadImages(_this.currentPage);
}
};
this.refreshSizeMethod = function (no) {
var imgDiv = _this.loaderTags[no];
if (!imgDiv)
return;
var set = _this.getImages()[no];
if (!set)
return;
var ph = window.innerHeight / window.innerWidth;
if (set.width < set.height) {
imgDiv.classList.add('size-portrait');
imgDiv.classList.remove('size-landscape');
}
else {
imgDiv.classList.remove('size-portrait');
imgDiv.classList.add('size-landscape');
}
if (set.height / set.width > ph) {
imgDiv.classList.add('scale-y');
imgDiv.classList.remove('scale-x');
}
else {
imgDiv.classList.add('scale-x');
imgDiv.classList.remove('scale-y');
}
};
this.OnImageLoad = function (e) {
var img = e.currentTarget;
var len = _this.slider.length;
var load;
img.parentElement.classList.remove('blank');
e.currentTarget.removeEventListener('load', _this.OnImageLoad);
_this.createLoadImage(_this.getImages());
var p = (_this.loaded + 1) / len;
var loading = _this.bar.querySelector(".loading");
loading.style.transform = 'scaleX(' + p + ')';
};
this.ShowFromXPoint = function (x) {
if (_this.slider) {
var rect = _this.bar.getBoundingClientRect();
var index = Math.floor(_this.slider.length * (x - rect.left) / rect.width);
_this.slider.showImage(index, false);
}
};
this.OnBarMousedown = function (e) {
e.preventDefault();
if (_this.bar.contains(e.target)) {
var pageX = 0;
if (e instanceof MouseEvent) {
pageX = e.pageX;
}
else {
pageX = e.touches[0].pageX;
}
_this.ShowFromXPoint(pageX);
if (!_this.mousedown) {
_this.mousedown = true;
window.addEventListener(jp.ninesense.ts.devise.pointerEvents.move, _this.OnBarMouseMove);
window.addEventListener(jp.ninesense.ts.devise.pointerEvents.end, _this.OnBarMouseup);
}
}
};
this.OnBarMouseup = function (e) {
window.removeEventListener(jp.ninesense.ts.devise.pointerEvents.move, _this.OnBarMouseMove);
window.removeEventListener(jp.ninesense.ts.devise.pointerEvents.end, _this.OnBarMouseup);
_this.mousedown = false;
//var pageX = 0;
//if (e instanceof TouchEvent) {
// pageX = e.touches[0].pageX;
//}
//else {
// pageX = e.pageX;
//}
//this.ShowFromXPoint(pageX);
};
this.OnBarMouseMove = function (e) {
var pageX = 0;
if (e instanceof MouseEvent) {
pageX = e.pageX;
}
else {
pageX = e.touches[0].pageX;
}
_this.ShowFromXPoint(pageX);
};
this._wheelEnabled = false;
this.onWheel = 0;
this.OnMouseWheel = function (e) {
e.preventDefault();
//if (this.onWheel) return;
//this.WheelCount(e, e.wheelDelta);
if (e.deltaY < 0) {
_this.previous();
}
else {
_this.next();
}
};
//private wheelIndex = 0;
//private wheelDelay = 1000;
//private wheelTimer;
//private WheelCount = (eo:MouseEvent, delta:number) => {
// if (delta === -1) {
// this.wheelEnabled = false;
// console.log('下');
// this.wheelIndex++;
// if (this.wheelIndex >= boxes.length - 1) {
// this.wheelIndex = boxes.length - 1
// }
// changeBox(this.wheelIndex);
// this.wheelTimer = setInterval(allowCount, this.wheelDelay);
// }
// if (delta === 1) {
// this.wheelEnabled = false;
// console.log('上');
// this.wheelIndex--;
// if (this.wheelIndex < 0) {
// this.wheelIndex = 0
// }
// changeBox(this.wheelIndex);
// this.wheelTimer = setInterval(allowCount, this.wheelDelay);
// }
// function allowCount() {
// console.log('go!');
// //ホイールを検知の再登録
// $(document).on("mousewheel", function (eo, delta, deltaX, deltaY) {
// console.log('mousewheel');
// count(eo, delta)
// })
// clearInterval(timer)
// }
//}
this.OnKeydown = function (e) {
switch (e.keyCode) {
case 33: //PAGEUP
_this.setupPage(_this.currentPage - 1, true);
break;
case 34: //PAGEDOWN
_this.setupPage(_this.currentPage + 1);
break;
case 35: //END
_this.slider.showImage(_this.loaded, true);
//this.OnSlided();
break;
case 36: //HOME
_this.slider.showImage(0, true);
//this.OnSlided();
break;
case 37: //←
case 38: //↑
_this.previous();
break;
case 13: //Enter
case 39: //→
case 40: //↓
if (!e.shiftKey) {
_this.next();
}
else {
_this.previous();
}
break;
}
};
this.OnClick = function (e) {
var target = e.target;
switch (true) {
case _this.left === target || _this.left.contains(target):
_this.previous(true);
break;
case _this.right === target || _this.right.contains(target):
_this.next(true);
break;
default:
//if (this.list.contains(target)) {
// var index = parseInt(target.getAttribute(photoSlider.indexAttr));
// if (!isNaN(index)) {
// this.show(index);
// }
//}
}
};
this.next = function (page) {
if (page === void 0) { page = false; }
if (_this.slider) {
if (!_this.slider.isLastIndex) {
_this.slider.next(true);
//this.OnSlided();
}
else if (page) {
_this.setupPage(_this.currentPage + 1);
}
}
};
this.previous = function (page) {
if (page === void 0) { page = false; }
if (_this.slider) {
if (_this.slider.currentIndex > 0) {
_this.slider.previous(true);
//this.OnSlided();
}
else if (page) {
_this.setupPage(_this.currentPage - 1, true);
}
}
};
var frame = document.querySelector(selector);
if (!frame)
return;
this.isMobile = jp.ninesense.ts.devise.isMobile;
this.isMiddle = jp.ninesense.ts.devise.isiPad || jp.ninesense.ts.devise.isAndroidTablet;
var displayRotate = function () {
if (window.innerWidth <= window.innerHeight) {
document.documentElement.classList.remove('landscape');
document.documentElement.classList.add('portrait');
}
else {
document.documentElement.classList.remove('portrai');
document.documentElement.classList.add('landscape');
}
if (_this.slider) {
var cnt = _this.slider.length;
for (var i = 0; i < cnt; i++) {
_this.refreshSizeMethod(i);
}
}
};
displayRotate();
window.addEventListener('resize', displayRotate);
this.mousedown = false;
this.frame = frame;
var folder = decodeURIComponent(frame.getAttribute(photoSlider.folderAttr));
var sorce = decodeURIComponent(frame.getAttribute(photoSlider.imagesAttr));
var images = JSON.parse(sorce);
var cnt = images.length;
this.images = images;
this.folder = folder;
this.setup();
frame.removeAttribute(photoSlider.folderAttr);
frame.removeAttribute(photoSlider.imagesAttr);
if (this.isMobile) {
document.documentElement.classList.add('mobile');
}
if (this.isMiddle) {
document.documentElement.classList.add('middle');
}
this.OnSlided();
}
Object.defineProperty(photoSlider.prototype, "imageSlider", {
get: function () {
return this.slider;
},
enumerable: true,
configurable: true
});
Object.defineProperty(photoSlider.prototype, "index", {
get: function () {
return this.current;
},
enumerable: true,
configurable: true
});
Object.defineProperty(photoSlider.prototype, "pageLength", {
get: function () {
return this.pages.length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(photoSlider.prototype, "pageIndex", {
get: function () {
return this.currentPage;
},
enumerable: true,
configurable: true
});
photoSlider.prototype.getImageInfo = function (page, index, size) {
if (size === void 0) { size = "full"; }
var p = this.pages[page];
var imgs = this.images[p];
var images = imgs[size];
if (!images) {
size = 'full';
images = imgs['full'];
}
var info = images[index];
if (info) {
var dir = '/';
switch (size) {
case 'middle':
case 'mobile':
dir = '/' + size + '/';
}
return { url: this.folder + p + dir + info.url, width: info.width, height: info.height };
}
};
Object.defineProperty(photoSlider.prototype, "useToolSet", {
get: function () {
return this._useToolSet;
},
set: function (value) {
if (this._useToolSet === value)
return;
this._useToolSet = value;
if (value) {
this.constols.appendChild(this.toolSet);
}
else {
this.constols.removeChild(this.toolSet);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(photoSlider.prototype, "wheelEnabled", {
get: function () {
return this._wheelEnabled;
},
set: function (value) {
if (this._wheelEnabled === value)
return;
this._wheelEnabled = value;
if (value) {
this.frame.addEventListener("mousewheel", this.OnMouseWheel);
}
else {
this.frame.removeEventListener("mousewheel", this.OnMouseWheel);
}
},
enumerable: true,
configurable: true
});
photoSlider.folderAttr = 'data-ns-photopanel-folder';
photoSlider.imagesAttr = 'data-ns-photopanel-files';
photoSlider.indexAttr = 'data-ns-photopanel-index';
photoSlider.pageAttr = 'data-ns-photopanel-page';
return photoSlider;
}());
ts.photoSlider = photoSlider;
var loadorder;
(function (loadorder) {
loadorder[loadorder["asc"] = 0] = "asc";
loadorder[loadorder["desc"] = 1] = "desc";
})(loadorder || (loadorder = {}));
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var popupBox = /** @class */ (function () {
function popupBox() {
var _this = this;
this.scroll = 0;
this.stack = [];
this.lock = false;
//public get Dom():HTMLDivElement {
// return this.dom;
//}
this.OnMouseMove = function (e) {
_this.crearTimeout();
};
this.showMessageBox = function (key, message, error, autocloseTime, click) {
if (error === void 0) { error = false; }
if (autocloseTime === void 0) { autocloseTime = -1; }
if (click === void 0) { click = null; }
var content = '';
_this.show(key, content, 'popup-message-box' + ((error) ? ' error-message' : ''), false, function (e) {
var target = e.target;
if (target.id === 'close-popup-message')
return true;
if (click) {
return click(e);
}
return false;
}, autocloseTime);
};
this.show = function (key, content, className, lock, click, autocloseTime) {
if (click === void 0) { click = null; }
if (autocloseTime === void 0) { autocloseTime = -1; }
if (_this.dom.parentElement) {
if (key !== _this.currentID) {
_this.stack.push({ id: key, content: content, className: className, lock: lock, click: click, autocloseTime: autocloseTime });
return false;
}
else {
content = _this.inner.innerHTML + content;
}
}
_this.dom.className = className;
_this.dom.classList.add('wrap');
var style = _this.dom.style;
_this.lock = lock;
if (lock) {
style.top = '0px';
style.left = '0px';
style.right = '0px';
style.bottom = '0px';
style.width = '100vw';
style.height = '100vh';
_this.scroll = (window.pageYOffset !== undefined) ? window.pageYOffset : window.scrollY;
if (_this.body_inner) {
var style_1 = _this.body_inner.style;
style_1.top = '-' + _this.scroll.toString() + 'px';
style_1.position = 'fixed';
style_1.overflow = 'hidden';
style_1.width = '100vw';
}
document.getElementsByTagName('html')[0].style.overflow = 'hidden';
}
else {
style.top = 'auto';
style.left = 'auto';
style.right = '0px';
style.bottom = '0px';
style.width = 'auto';
style.height = 'auto';
}
_this.click = click;
_this.inner.innerHTML = content;
document.body.appendChild(_this.dom);
_this.currentID = key;
if (autocloseTime > 0) {
if (!isNaN(_this.timeout))
clearTimeout(_this.timeout);
_this.entryTimeout(function () {
if (_this.currentID === key) {
_this.dom.classList.add('hide');
_this.entryTimeout(function () {
if (_this.currentID === key) {
_this.next();
}
}, 300);
}
}, autocloseTime - 300);
}
else {
_this.crearTimeout();
}
return true;
};
this.hide = function () {
if (_this.dom.parentElement) {
_this.dom.parentElement.removeChild(_this.dom);
}
if (_this.lock) {
if (_this.body_inner) {
var style = _this.body_inner.style;
style.top = '';
style.position = '';
style.width = '';
window.scrollTo(0, _this.scroll);
}
document.getElementsByTagName('html')[0].style.overflow = '';
}
};
this.next = function () {
_this.hide();
var dt = _this.stack.shift();
if (dt) {
_this.entryTimeout(function () {
var clickCallback;
while (_this.stack[0] && _this.stack[0].id === dt.id && _this.stack[0].className === dt.className && _this.stack[0].lock === dt.lock) {
var ndt = _this.stack.shift();
dt.content += ndt.content;
if (dt.autocloseTime > 0 && ndt.autocloseTime > 0) {
dt.autocloseTime += ndt.autocloseTime;
}
else {
dt.autocloseTime = -1;
}
if (!clickCallback) {
clickCallback = [dt.click];
}
clickCallback.push(ndt.click);
}
if (dt.autocloseTime > 10000)
dt.autocloseTime = 10000;
dt.click = function (e) {
if (clickCallback) {
var len = clickCallback.length;
for (var i = 0; i < len; i++) {
if (!clickCallback[i](e)) {
return false;
}
}
}
return true;
};
_this.show(dt.id, dt.content, dt.className, dt.lock, dt.click, dt.autocloseTime);
}, 1);
}
};
this.timeout = NaN;
this.entryTimeout = function (callStack, timeout) {
if (!isNaN(_this.timeout))
clearTimeout(_this.timeout);
_this.timeout = setTimeout(function () {
_this.timeout = NaN;
callStack();
}, timeout);
};
this.crearTimeout = function () {
if (!isNaN(_this.timeout))
clearTimeout(_this.timeout);
_this.timeout = NaN;
};
this.visible = function () {
if (_this.dom.parentElement) {
return true;
}
else {
return false;
}
};
this.OnClickPopupBox = function (e) {
if (!_this.click || _this.click(e)) {
_this.next();
}
};
var popupBox = document.createElement("div");
var style = popupBox.style;
style.position = 'fixed';
style.minWidth = '100px';
style.minHeight = '70px';
style.zIndex = '999999';
var view = document.createElement('div');
view.classList.add('view');
var inner = document.createElement('div');
inner.classList.add('inner');
view.appendChild(inner);
popupBox.appendChild(view);
view.addEventListener("click", this.OnClickPopupBox);
view.addEventListener("mousemove", this.OnMouseMove);
this.body_inner = document.getElementsByClassName('body-inner')[0];
this.dom = popupBox;
this.inner = inner;
}
popupBox.getInstance = function () {
if (!popupBox.instance) {
popupBox.instance = new popupBox();
}
return popupBox.instance;
};
return popupBox;
}());
ts.popupBox = popupBox;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var scrollBox = /** @class */ (function () {
/**
* 指定コンテンツを囲うデザイン可能なスクロールバーを有するスクロールボックスを作成します
* @param content コンテンツ
* @param classPrefix スクロールボックス各要素に付くカスタムクラス名の先頭に付くプレフィックスを指定します。
* @param boxHeight ボックスの高さを指定します。指定しない場合はCSSで.ns-scrollbox-scrollTargetに高さを指定します
*/
function scrollBox(content, classPrefix, boxHeight) {
var _this = this;
if (classPrefix === void 0) { classPrefix = 'ns'; }
if (boxHeight === void 0) { boxHeight = null; }
this._mouseMoveEnabled = false;
this._mouseEndEnabled = false;
this.OnMouseMove = function (e) {
e.preventDefault();
var my = 0;
if (e instanceof TouchEvent) {
my = e.touches[0].pageY;
}
else {
my = e.pageY;
}
//this.scrollBarTo(y);
var barWrapRect = _this.scrollBox.getBoundingClientRect();
_this.mousedownY = my - barWrapRect.top - window.scrollY;
_this.reflesh();
};
this.OnMouseEnd = function (e) {
_this.mouseMoveEnabled = false;
_this.mouseEndEnabled = false;
};
this.scrollBarTo = function (boxY) {
var h_WP = _this.scrollTarget.getBoundingClientRect().height;
var h_UL = _this.scrollContents.getBoundingClientRect().height;
var rect_SC = _this.scrollBox.getBoundingClientRect();
boxY -= rect_SC.top + window.scrollY;
var h_SC = rect_SC.height;
var p = (h_UL - h_WP) * boxY / h_SC;
_this.scrollTarget.scrollTo({ top: p });
};
this.mousedownY = 0;
this.bardownPositionY = 0;
this.scroll = function (scrollOption) {
_this.scrollTarget.scroll(scrollOption);
};
this.scrollShowRect = function (rect, method) {
if (method === void 0) { method = 'nearly'; }
var listRect = _this.scrollWrap.getBoundingClientRect();
switch (method) {
case 'nearly':
if (listRect.bottom < rect.bottom) {
_this.scroll({ top: (rect.top - (listRect.top - _this.scrollTarget.scrollTop)) - (listRect.height - rect.height) });
}
else if (listRect.top > rect.top) {
_this.scroll({ top: rect.top - (listRect.top - _this.scrollTarget.scrollTop) });
}
break;
case 'center':
_this.scroll({ top: (rect.top - (listRect.top - _this.scrollTarget.scrollTop)) - (listRect.height - rect.height) * 0.5 });
break;
}
};
this.reflesh = function () {
var wrap = _this.scrollTarget;
var ul = _this.scrollContents;
var bar = _this.scrollBox;
var scrollBar = _this.scrollBar;
var boxRect = wrap.getBoundingClientRect();
var contentRect = ul.getBoundingClientRect();
var barRect = bar.getBoundingClientRect();
var mRect = _this.scrollBoxmjur.getBoundingClientRect();
var barWidth = boxRect.width - mRect.width;
if (barWidth < 0)
barWidth = 0;
wrap.style.width = 'calc(100% + ' + barWidth.toString() + 'px)';
var max = contentRect.height - boxRect.height;
if (max <= 0 || barWidth === 0) {
bar.style.opacity = '0';
}
else {
bar.style.opacity = '1';
var barHeight = barRect.height * boxRect.height / wrap.scrollHeight;
scrollBar.style.height = barHeight.toString() + 'px';
if (!_this.mouseMoveEnabled) {
scrollBar.style.transform = 'translateY(' + (wrap.scrollTop * (barRect.height - barHeight) / (wrap.scrollHeight - boxRect.height)).toString() + 'px)';
}
else {
var bardownPositionY = _this.bardownPositionY;
var barPos = _this.mousedownY - bardownPositionY * barHeight;
if (barPos < 0)
barPos = 0;
if (barRect.height - barHeight < barPos)
barPos = barRect.height - barHeight;
scrollBar.style.transform = 'translateY(' + barPos.toString() + 'px)';
wrap.scrollTo({ top: (wrap.scrollHeight - boxRect.height) * barPos / (barRect.height - barHeight) });
}
}
};
var parent = content.parentElement;
var wrap = document.createElement('div');
var mjur = document.createElement('div');
var scrollBox = document.createElement('div');
var scrollTarget = document.createElement('div');
mjur.style.display = 'block';
mjur.style.width = '100%';
scrollTarget.appendChild(mjur);
scrollTarget.appendChild(content);
scrollBox.appendChild(scrollTarget);
wrap.appendChild(scrollBox);
wrap.classList.add('ns-scrollbox-list');
scrollBox.classList.add('ns-scrollbox-scrollBox');
scrollTarget.classList.add('ns-scrollbox-scrollTarget');
wrap.classList.add(classPrefix + '-list');
scrollBox.classList.add(classPrefix + '-scrollBox');
scrollTarget.classList.add(classPrefix + '-scrollTarget');
var scrollWrap = document.createElement('div');
var scrollBox = document.createElement('div');
var scrollBar = document.createElement('div');
scrollWrap.className = 'ns-scrollbox-list-scroll-wrap ' + classPrefix + '-list-scroll-wrap';
scrollBox.className = 'ns-scrollbox-list-scroll-box ' + classPrefix + '-list-scroll-box';
scrollBar.className = 'ns-scrollbox-list-scroll-bar ' + classPrefix + '-list-scroll-bar';
scrollWrap.appendChild(scrollBox);
scrollBox.appendChild(scrollBar);
wrap.appendChild(scrollWrap);
scrollTarget.addEventListener('scroll', function () {
if (_this.mouseMoveEnabled)
return;
_this.reflesh();
});
scrollWrap.addEventListener('wheel', function (e) {
e.preventDefault();
scrollTarget.scrollTo({ top: scrollTarget.scrollTop + e.deltaY });
});
scrollWrap.addEventListener(jp.ninesense.ts.devise.pointerEvents.start, function (e) {
e.preventDefault();
var my = 0;
if (e instanceof TouchEvent) {
my = e.touches[0].pageY;
}
else {
my = e.pageY;
}
var barWrapRect = scrollBox.getBoundingClientRect();
var barRect = scrollBar.getBoundingClientRect();
var barDownPosY = my - barRect.top - window.scrollY;
if (barDownPosY < 0 || barRect.height < barDownPosY) {
var rect_SB = _this.scrollBar.getBoundingClientRect();
var h_SC = rect_SB.height;
_this.scrollBarTo(my);
barDownPosY = my - barRect.top - window.scrollY;
}
_this.bardownPositionY = ts.MathBit.floor(barDownPosY / barRect.height * 100) * 0.01;
_this.mousedownY = my - barWrapRect.top - window.scrollY;
_this.mouseMoveEnabled = true;
_this.mouseEndEnabled = true;
});
this.scrollTarget = scrollTarget;
this.scrollBoxmjur = mjur;
this.scrollContents = content;
this.scrollBox = scrollBox;
this.scrollBar = scrollBar;
this.scrollWrap = wrap;
if (parent) {
parent.appendChild(wrap);
}
this.reflesh();
}
Object.defineProperty(scrollBox.prototype, "mouseMoveEnabled", {
get: function () {
return this._mouseMoveEnabled;
},
set: function (value) {
if (this._mouseMoveEnabled === value)
return;
this._mouseMoveEnabled = value;
if (value) {
window.addEventListener(jp.ninesense.ts.devise.pointerEvents.move, this.OnMouseMove);
}
else {
window.removeEventListener(jp.ninesense.ts.devise.pointerEvents.move, this.OnMouseMove);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(scrollBox.prototype, "mouseEndEnabled", {
get: function () {
return this._mouseEndEnabled;
},
set: function (value) {
if (this._mouseEndEnabled === value)
return;
this._mouseEndEnabled = value;
if (value) {
window.addEventListener(jp.ninesense.ts.devise.pointerEvents.end, this.OnMouseEnd);
}
else {
window.removeEventListener(jp.ninesense.ts.devise.pointerEvents.end, this.OnMouseEnd);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(scrollBox.prototype, "dom", {
//public scrollBarLocal = (y: number) => {
// var h_WP = this.scrollTarget.getBoundingClientRect().height;
// var h_UL = this.scrollContents.getBoundingClientRect().height;
// var rect_SW = this.scrollBox.getBoundingClientRect();
// localY -= rect_SW.top;
// var p = localY
// this.scrollTarget.scrollTo({ top: p });
//}
get: function () {
return this.scrollWrap;
},
enumerable: true,
configurable: true
});
scrollBox.instance = [];
/**
* コンテンツをクエリで指定してデザイン可能なスクロールバーを有するスクロールボックスを作成します
* @param content コンテンツを指定するためのCSSクエリ
* @param classPrefix スクロールボックス各要素に付くカスタムクラス名の先頭に付くプレフィックスを指定します。
* @param boxHeight ボックスの高さを指定します。指定しない場合はCSSで.ns-scrollbox-scrollTargetに高さを指定します
*/
scrollBox.init = function (selector, classPrefix, boxHeight) {
if (classPrefix === void 0) { classPrefix = 'ns'; }
if (boxHeight === void 0) { boxHeight = null; }
var contents = document.querySelectorAll(selector);
var len = contents.length;
for (var i = 0; i < len; i++) {
new scrollBox(contents[i], classPrefix, boxHeight);
}
};
return scrollBox;
}());
ts.scrollBox = scrollBox;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var switchBox = /** @class */ (function () {
function switchBox(selector) {
var _this = this;
this.switchGroup = {};
this._length = 0;
this.Setup = function () {
var switchElements = document.querySelectorAll(_this.selector);
var len = switchElements.length;
_this._length = len;
for (var i = 0; i < len; i++) {
var element = switchElements[i];
var group = element.getAttribute(switchBox.GROUP_ID);
if (_this.switchGroup[group]) {
_this.switchGroup[group].push(element);
}
else {
_this.switchGroup[group] = [element];
}
element.draggable = true;
element.addEventListener('dragstart', _this.OnDragStert);
element.addEventListener('dragend', _this.OnDragEnd);
element.addEventListener('dragenter', _this.OnDragEnter);
element.addEventListener('dragleave', _this.OnDragLeave);
element.addEventListener('dragover', _this.OnDragOver);
element.addEventListener('drop', _this.OnDrop);
element.setAttribute(switchBox.STYLE_ID, element.style.border);
element.style.cursor = 'move';
}
};
this.Clear = function () {
var oldGroupList = _this.switchGroup;
for (var group in oldGroupList) {
var elements = oldGroupList[group];
var len = elements.length;
for (var i = 0; i < len; i++) {
var element = elements[i];
if (_this.switchGroup[group]) {
_this.switchGroup[group].push(element);
}
else {
_this.switchGroup[group] = [element];
}
element.draggable = false;
element.removeEventListener('dragstart', _this.OnDragStert);
element.removeEventListener('dragend', _this.OnDragEnd);
element.removeEventListener('dragenter', _this.OnDragEnter);
element.removeEventListener('dragleave', _this.OnDragLeave);
element.removeEventListener('dragover', _this.OnDragOver);
element.removeEventListener('drop', _this.OnDrop);
element.setAttribute(switchBox.STYLE_ID, '');
element.style.cursor = 'auto';
}
}
_this.switchGroup = {};
_this._length = 0;
};
this.Refresh = function () {
_this.Clear();
_this.Setup();
};
this.OnDragStert = function (e) {
var element = e.currentTarget;
element.style.border = '1px dashed rgba(0,0,0,0.3)';
_this.current = element;
_this.currentGroupID = element.getAttribute(switchBox.GROUP_ID);
_this.dispatchEvent(new DragEvent(e.type, { dataTransfer: e.dataTransfer }));
};
this.OnDrop = function (e) {
var element = e.currentTarget;
element.style.border = element.getAttribute(switchBox.STYLE_ID);
var current = _this.current;
current.style.border = _this.current.getAttribute(switchBox.STYLE_ID);
var en = element.nextElementSibling;
var ep = element.parentElement;
var cn = current.nextElementSibling;
var cp = current.parentElement;
if (en)
ep.insertBefore(_this.current, en);
else
ep.appendChild(_this.current);
if (cn)
cp.insertBefore(element, cn);
else
cp.appendChild(element);
var eno = element.getAttribute(switchBox.ELEMENT_NO);
var cno = current.getAttribute(switchBox.ELEMENT_NO);
current.setAttribute(switchBox.ELEMENT_NO, eno);
element.setAttribute(switchBox.ELEMENT_NO, cno);
_this.droptarget = element;
_this.dispatchEvent(new DragEvent(e.type, { dataTransfer: e.dataTransfer }));
_this.droptarget = null;
_this.current = null;
};
this.OnDragEnd = function (e) {
var element = e.currentTarget;
element.style.border = element.getAttribute(switchBox.STYLE_ID);
_this.dispatchEvent(new DragEvent(e.type, { dataTransfer: e.dataTransfer }));
};
this.OnDragEnter = function (e) {
var element = e.currentTarget;
var related = _this.current;
if (!related || !element)
return;
if (_this.current === element)
return;
//window.console.log(e.currentTarget);
if (related.getAttribute(switchBox.GROUP_ID) !== element.getAttribute(switchBox.GROUP_ID)) {
e.preventDefault();
return;
}
element.style.border = '1px dashed rgba(255,0,0,0.3)';
_this.dispatchEvent(new DragEvent(e.type, { dataTransfer: e.dataTransfer }));
};
this.OnDragLeave = function (e) {
var element = e.currentTarget;
if (element === _this.current)
return;
element.style.border = element.getAttribute(switchBox.STYLE_ID);
_this.dispatchEvent(new DragEvent(e.type, { dataTransfer: e.dataTransfer }));
};
this.OnDragOver = function (e) {
if (e.preventDefault) {
e.preventDefault(); // Necessary. Allows us to drop.
}
var element = e.currentTarget;
e.dataTransfer.dropEffect = 'none'; // See the section on the DataTransfer object.
if (!_this.current || !element)
return;
if (_this.current === element)
return;
if (_this.current.getAttribute(switchBox.GROUP_ID) !== element.getAttribute(switchBox.GROUP_ID)) {
e.preventDefault();
return;
}
e.dataTransfer.dropEffect = 'move'; // See the section on the DataTransfer object.
_this.dispatchEvent(new DragEvent(e.type, { dataTransfer: e.dataTransfer }));
return false;
};
this.selector = selector;
try {
this.target = new EventTarget();
}
catch (ex) {
window.console.log('switchBox : EventTargetのコンストラクタを実装していません。');
this.target = window;
}
this.Setup();
}
Object.defineProperty(switchBox.prototype, "length", {
get: function () {
return this._length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(switchBox.prototype, "DragTarget", {
get: function () {
return this.current;
},
enumerable: true,
configurable: true
});
Object.defineProperty(switchBox.prototype, "DropTarget", {
get: function () {
return this.droptarget;
},
enumerable: true,
configurable: true
});
Object.defineProperty(switchBox.prototype, "CurrentTargets", {
get: function () {
return this.switchGroup[this.currentGroupID];
},
enumerable: true,
configurable: true
});
Object.defineProperty(switchBox.prototype, "CurrentGroupID", {
get: function () {
return this.currentGroupID;
},
enumerable: true,
configurable: true
});
switchBox.prototype.addEventListener = function (type, listener, options) {
this.target.addEventListener(type, listener, options);
};
switchBox.prototype.dispatchEvent = function (evt) {
return this.target.dispatchEvent(evt);
};
switchBox.prototype.removeEventListener = function (type, listener, options) {
this.target.removeEventListener(type, listener, options);
};
switchBox.GROUP_ID = 'data-ns-switchbox';
switchBox.ELEMENT_NO = 'data-ns-switchbox-no';
switchBox.STYLE_ID = 'data-ns-switchbox-style';
return switchBox;
}());
ts.switchBox = switchBox;
})(ts = ninesense.ts || (ninesense.ts = {}));
})(ninesense = jp.ninesense || (jp.ninesense = {}));
})(jp || (jp = {}));
var headAttr;
var jp;
(function (jp) {
var ninesense;
(function (ninesense) {
var ts;
(function (ts) {
var template;
(function (template_1) {
var dom = /** @class */ (function () {
function dom() {
}
dom.createTableExFrame = function (title, inner, toggle, dismiss, editorPrefix) {
if (toggle === void 0) { toggle = true; }
if (dismiss === void 0) { dismiss = true; }
if (editorPrefix === void 0) { editorPrefix = 'card'; }
var dom = document.createElement('section');
dom.classList.add('ns-table-frame');
dom.classList.add(editorPrefix);
var header = document.createElement('header');
header.classList.add(editorPrefix + '-header');
var action = document.createElement('div');
action.classList.add(editorPrefix + '-actions');
header.appendChild(action);
if (dismiss) {
var action_a = document.createElement('a');
action_a.href = '#';
action_a.className = editorPrefix + '-action ' + editorPrefix + '-action-dismiss';
action_a.setAttribute('data-' + editorPrefix + '-toggle', '');
action.appendChild(action_a);
}
if (toggle) {
var action_a = document.createElement('a');
action_a.href = '#';
action_a.className = editorPrefix + '-action ' + editorPrefix + '-action-toggle';
action_a.setAttribute('data-' + editorPrefix + '-toggle', '');
action.appendChild(action_a);
}
var h2 = document.createElement('h2');
h2.className = editorPrefix + '-title';
h2.innerHTML = title;
header.appendChild(h2);
var body = document.createElement('div');
body.className = editorPrefix + "-body advanced";
var caption = document.createElement('div');
caption.className = "row " + editorPrefix + "-caption";
body.appendChild(caption);
inner.classList.add(editorPrefix + "-body-inner");
body.appendChild(inner);
dom.appendChild(header);
dom.appendChild(body);
return dom;
};
dom.createTableExBase = function (tableID, header, data) {
var wrap = document.createElement('div');
wrap.className = "table-advanced";
var table = document.createElement('table');
table.className = "table table-bordered table-striped mb-none";
table.id = tableID;
var thead = document.createElement('thead');
var len = header.length;
if (len > 0) {
for (var i = 0; i < len; i++) {
var headData = header[i];
var recode = document.createElement('tr');
for (var field in headData) {
var text = headData[field];
var th = document.createElement('th');
th.classList.add('h-' + field);
th.classList.add('h-title');
if (typeof (text) === 'string') {
th.innerHTML = text;
}
else {
th.innerHTML = text.title;
if (text.rspan)
th.rowSpan = text.rspan;
if (text.cspan)
th.colSpan = text.cspan;
if (text.class)
th.classList.add(text.class);
}
recode.appendChild(th);
}
thead.appendChild(recode);
}
}
table.appendChild(thead);
var recodeWrap;
if (len === 1) {
recodeWrap = document.createElement('tbody');
table.appendChild(recodeWrap);
}
else {
recodeWrap = table;
}
if (!data['{temp}']) {
data['{temp}'] = {};
}
for (var id in data) {
var recodeData = data[id];
var recode_1 = void 0;
if (len === 1) {
recode_1 = document.createElement('tr');
}
else {
recode_1 = document.createElement('tbody');
}
recode_1.id = "id-" + id;
recode_1.classList.add('ns-recode');
for (var i = 0; i < len; i++) {
var headData = header[i];
var row;
if (len === 1) {
row = recode_1;
}
else {
row = document.createElement('tr');
recode_1.appendChild(row);
}
for (var field in headData) {
var text_1 = recodeData[field];
if (!text_1) {
text_1 = ' ';
}
var td = document.createElement('td');
td.classList.add('c-' + field);
td.setAttribute('data-ns-search', text_1);
var c_title = document.createElement('span');
var c_body = document.createElement('div');
var c_ui = document.createElement('span');
c_title.className = 'c-title';
var template = headData[field];
if (typeof (template) === 'string') {
c_title.innerHTML = template;
}
else {
c_title.innerHTML = template.title;
if (template.rspan)
td.rowSpan = template.rspan;
if (template.cspan)
td.colSpan = template.cspan;
if (template.class)
td.classList.add(template.class);
}
c_body.className = 'c-body';
c_body.innerHTML = text_1;
c_ui.className = 'c-ui';
td.appendChild(c_title);
td.appendChild(c_body);
td.appendChild(c_ui);
row.appendChild(td);
}
}
if (id !== '{temp}') {
recodeWrap.appendChild(recode_1);
}
else {
var tmpTBody = document.createElement('tbody');
tmpTBody.appendChild(recode_1);
thead.setAttribute('data-ns-row-temp', tmpTBody.innerHTML);
}
}
wrap.appendChild(table);
return wrap;
};
dom.createSVG = function (viewBox, attr) {
if (viewBox === void 0) { viewBox = '0 0 100 100'; }
if (attr === void 0) { attr = { x: "0px", y: "0px" }; }
var mySvg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); //