function escapeVfId(vfId) {
|
return '#' + vfId.replace(/(:|\.)/g,'\\$1');
|
}
|
|
function scrollbarWidth() {
|
var $inner = jQuery('<div style="width: 100%; height:200px;">test</div>'),
|
$outer = jQuery('<div style="width:200px;height:150px; position: absolute; top: 0; left: 0; visibility: hidden; overflow:hidden;"></div>').append($inner),
|
inner = $inner[0],
|
outer = $outer[0];
|
|
jQuery('body').append(outer);
|
var width1 = inner.offsetWidth;
|
$outer.css('overflow', 'scroll');
|
var width2 = outer.clientWidth;
|
$outer.remove();
|
|
return (width1 - width2);
|
}
|
|
function setButtonDisable(object, status){
|
if(!(object.id == 'idGetActive' || object.id == 'Page:mainForm:idDayEdit:idReportDate')) {
|
object.disabled = status;
|
}
|
if(object.id != 'idGetActive' && object.tagName.toLowerCase() == "input" && (object.type.toLowerCase() == "button" || object.type.toLowerCase() == "submit")) {
|
if(status == true) {
|
object.style.cursor = "default";
|
object.style.backgroundPosition = "0 -90px";
|
object.style.borderColor = "#C4C4C4";
|
object.style.color = "#909090";
|
|
} else {
|
object.style.backgroundPosition = "";
|
object.style.color = "";
|
object.style.cursor = "pointer";
|
object.style.borderColor = "#B5B5B5 #B5B5B5 #7F7F7F";
|
}
|
}
|
}
|
|
function setButtonsDisable(jObj, status){
|
jObj.each(function(index) {
|
setButtonDisable(this, status);
|
});
|
}
|
|
function number_format_common (number, decimals, dec_point, thousands_sep) {
|
number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
|
var n = !isFinite(+number) ? 0 : +number,
|
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
|
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
|
dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
|
s = '',
|
toFixedFix = function (n, prec) {
|
var k = Math.pow(10, prec);
|
return '' + Math.round(n * k) / k;
|
};
|
// Fix for IE parseFloat(0.55).toFixed(0) = 0;
|
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
|
if (s[0].length > 3) {
|
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
|
}
|
if ((s[1] || '').length < prec) {
|
s[1] = s[1] || '';
|
s[1] += new Array(prec - s[1].length + 1).join('0');
|
}
|
return ( s.join(dec));
|
}
|
function toNum( input) {
|
return number_format_common( input, 2, ".", "");
|
}
|
function toNumComma( input) {
|
return number_format_common( input, 2, ".", ",");
|
}
|
|
function localParseFloat( input) {
|
input += "";
|
input = input.split(" ");
|
if (input.length > 1) {
|
input = input[1];
|
} else {
|
input = input[0];
|
}
|
input = input.replace(/,/g, "");
|
input = input.replace(/ /g, "");
|
// IEの場合、\sが効かない、一旦parseの後再度isNaNをチェック
|
//input = input.replace(/^\s+/, '').replace(/\s+$/, '');
|
if ( input == '' || isNaN( input)) {
|
input = 0.00;
|
}
|
input = parseFloat(input);
|
if (isNaN( input)) input = 0.00;
|
return input;
|
}
|
function localParseInt( input) {
|
input += "";
|
input = input.split(" ");
|
if (input.length > 1) {
|
input = input[1];
|
} else {
|
input = input[0];
|
}
|
input = input.replace(/,/g, "");
|
input = input.replace(/ /g, "");
|
// IEの場合、\sが効かない、一旦parseの後再度isNaNをチェック
|
//input = input.replace(/^\s+/, '').replace(/\s+$/, '');
|
if ( input == '' || isNaN( input)) {
|
input = 0;
|
}
|
input = parseInt(input);
|
if (isNaN( input)) input = 0.00;
|
return input;
|
}
|
|
/*************************************************
|
* prototypeを拡張
|
*************************************************/
|
(function($) {
|
/**
|
* TODO 値セットのところも対応
|
* fromのvalueを取得、radioの場合書き方が違うため、吸収します
|
* valueが取れない場合、空文字を返す
|
*/
|
$.fn.value = function() {
|
var jQueryObj = this;
|
var rtn = [];
|
jQueryObj.each(function(i) {
|
if (this.tagName.toLowerCase() == "input"
|
|| this.tagName.toLowerCase() == "textarea"
|
|| this.tagName.toLowerCase() == "select") {
|
if (this.type.toLowerCase() == "radio" || this.type.toLowerCase() == "checkbox") {
|
if (this.checked) {
|
rtn.push(this.value);
|
}
|
} else {
|
rtn.push($(this).val());
|
}
|
}
|
else if (this.tagName.toLowerCase() == "span" || this.tagName.toLowerCase() == "label") {
|
rtn.push($(this).text());
|
}
|
});
|
if (rtn.length == 0) {
|
rtn = '';
|
}
|
else if (rtn.length == 1) {
|
rtn = rtn[0];
|
}
|
return rtn;
|
};
|
})(jQuery);
|
|
j$ = jQuery.noConflict();
|
|
function blockme(){
|
j$("body").prepend("<div id='sbArea'><div id='sbArea_contentsArea'><div id='sbArea_contentsArea_msg'>Please wait...</div></div><div id='sbArea_backArea'></div></div>");
|
j$("#sbArea_contentsArea").css({"opacity":"0"}).fadeTo(500, 0.8);
|
j$("#sbArea_backArea").css({"opacity":"0"}).fadeTo(500, 0.4);
|
resizeShadowBox();
|
}
|
|
function blockme_dark(){
|
j$("body").prepend("<div id='sbArea'><div id='sbArea_contentsArea'><div id='sbArea_contentsArea_msg'>Please wait...</div></div><div id='sbArea_backArea'></div></div>");
|
j$("#sbArea_contentsArea").css({"opacity":"0"}).fadeTo(500, 0.9);
|
j$("#sbArea_backArea").css({"opacity":"0"}).fadeTo(500, 0.8);
|
resizeShadowBox();
|
}
|
|
//ウィンドのサイズにあわせて位置を調整
|
function resizeShadowBox(){
|
var h = j$(document);
|
var winH = j$(window).height();
|
var winW = j$(window).width();
|
var screanWidth = window.screen.width;
|
if (screanWidth < winW) {
|
winH = winH * winW / screanWidth;
|
winW = winW * winW / screanWidth;
|
}
|
var contents = j$("#sbArea_contentsArea")
|
contents.css({"width":"auto","height":"auto"});
|
var iSaBoxH = contents.outerHeight();
|
var iSaBoxW = contents.outerWidth();
|
|
if(winH >= iSaBoxH+10*2){
|
var innerT = (winH-iSaBoxH)/2;
|
}else{
|
var innerT = 10;
|
iSaBoxH = winH-10*2;
|
iSaBoxW += 20;
|
}
|
if(winW >= iSaBoxW+10*2){
|
var innerL = (winW-iSaBoxW)/2;
|
}else{
|
var innerL =10;
|
iSaBoxW = winW-10*2;
|
}
|
var sbTop = h.scrollTop()
|
|
var IE6browser = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
|
if(!IE6browser){
|
j$("#sbArea").css({"width":winW+"px","height":winH+"px","position":"fixed"});
|
}else{
|
j$("#sbArea").css({"width":winW+"px","height":winH+"px","top":h.scrollTop()+"px","left":h.scrollLeft()+"px"});
|
}
|
j$("#sbArea_contentsArea").css({"left":innerL+"px","top":innerT+"px","height":iSaBoxH+"px","width":iSaBoxW+"px"});
|
j$("#sbArea_backArea").css({"width":winW+"px","height":winH+"px"});
|
}
|
|
function unblockUI(){
|
j$("#sbArea").fadeOut(500, function(){
|
j$("#sbArea").remove();
|
});
|
}
|