buli
2023-06-05 175a084533497c67daa3527bce4807fb70ec8793
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
var url = document.URL;
 
String.prototype.endsWith = function(suffix) {
    return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
// main.jsのなかのものをoverrideした。
DatePicker.prototype.position=function(){
    for(var a=0,c=0,b=this.myElement;null!=b&&b!=this.calendarDiv.offsetParent;)
        a+=b.offsetLeft-b.scrollLeft,
        c+=b.offsetTop-b.scrollTop,
        b=b.offsetParent;
    c=getObjY(this.myElement)+this.calendarDiv.offsetHeight>Sfdc.Window.getScrollY()+Sfdc.Window.getWindowHeight()?c-(this.calendarDiv.offsetHeight+1):c+(this.myElement.offsetHeight+1);
    b="left";
    if (a + 225 > Sfdc.Window.getWindowWidth()) {
        a = Sfdc.Window.getWindowWidth() - 225;
    }
    LC.isRtlPage()&&(b="right",a=this.calendarDiv.offsetParent.offsetWidth-a-this.myElement.offsetWidth);
    this.shim.setStyle(b,a+"px");
    this.shim.setStyle("top",c+"px")
};
 
function searchOppJs() {
    blockme();
    searchOpp();
}
 
 
 
 
 
function sortTableJs(key) {
    if (typeof event.stopPropagation != "undefined") {
        event.stopPropagation();
    } else {
        event.cancelBubble = true;
    }
    blockme();
 
    sortTable(key);
}
 
// list の headerRow の tdに toggleWidth() を追加
function bindTdToggleWidth() {
    var i = 0;
    j$('body .pbBody table#tableHeader tr.headerRow td').each(function() {
        var colClass = getColClassName(this);
        if (colClass != 'col_Scroll') {
            listColClassWidthMap[colClass] = j$('body .pbBody table.list tr.headerRow td.' + colClass).width();
            if (colClass in listColClassMap) {
                j$(this).addClass("colViewing");
                j$(this).addClass(listColClassMap[colClass]);
            } else {
                j$(this).addClass("colViewing");
            }
            rerenderColWidth(colClass, true);
            j$(this).click(function() {
                j$(this).toggleClass("colUnHideIcon");
                rerenderColWidth(colClass, false);
            });
        }
    });
    windowResize();
    // スクロール連動
    j$('div#in_Div').scroll(function() {
        j$('div#out_Div').scrollLeft(j$(this).scrollLeft());
        j$('div#in_Div_L').scrollTop(j$(this).scrollTop());
    });
    j$('div#out_Div').scroll(function() {
        j$('div#in_Div').scrollLeft(j$(this).scrollLeft());
    });
    j$('div#in_Div_L').scroll(function() {
        j$('div#in_Div').scrollTop(j$(this).scrollTop());
    });
}
function windowResize() {
    blockHeight = j$(window).innerHeight() - j$(escapeVfId('allPage:allForm:searchBlock')).height() - heightAjustment;
    sbwidth = scrollbarWidth();
    blockWidth = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#in_Div_L').width() - widthAjustment - sbwidth;
    j$(escapeVfId('allPage:allForm:oppBlock')).css('height', blockHeight + 78 + 'px');
    j$('div#in_Div').css('width', blockWidth + 'px');
    j$('div#out_Div').css('width', blockWidth + 'px');
    j$('div#in_Div').css('height', blockHeight + 'px');
    j$('div#in_Div_L').css('height', blockHeight + 'px');
 
    // Table tr の height をあわせる
    var tbl = document.getElementById('tableData_L');
    var tbl2 = document.getElementById('tableData');
    for (var i = 0; i < tbl2.rows.length; i++) {
        var ht1 = j$(tbl.rows[i]).height();
        var ht2 = j$(tbl2.rows[i]).height();
        if (ht2 < ht1) {
            j$(tbl2.rows[i]).css('height', ht1 + 'px');
        } else {
            j$(tbl.rows[i]).css('height', ht2 + 'px');
        }
    }
 
    if (j$('table#tableData').height() > j$('div#in_Div').height()) {
        j$('div#in_Div').css('width', (blockWidth + sbwidth ) + 'px');
    } else {
       blockWidth = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#in_Div_L').width() - widthAjustment - sbwidth - j$('div#out_Div_L').width();
       j$('div#out_Div').css('width', (blockWidth + sbwidth + j$('div#in_Div_L').width()) + 'px');
       j$('div#in_Div').css('width', (blockWidth + sbwidth +
       j$('div#in_Div_L').width()) + 'px');
       j$('div#in_Div_L').css('width', (j$('div#out_Div_L').width()) + 'px');
    }
    if (j$('table#tableData').width() > j$('div#in_Div').width()) {
        j$('div#in_Div').css('height', (blockHeight + sbwidth) +'px');
    }
}
 
function expandAll(){
    // list の headerRow の tdに toggleWidth() を追加
    var i = 0;
    j$('body .pbBody table.list tr.headerRow td').each(function() {
        var colClass = getColClassName(this);
        if(j$(this).hasClass("colUnHideIcon")){
            j$(this).toggleClass("colUnHideIcon");
            rerenderColWidth(colClass, false);
        }
    });
    windowResize();
}
// 見た目用の classレベル 変数
var listColClassMap = {};          // colclass ==> colUnHideIcon or colViewing
var listColClassWidthMap = {};     // colclass ==> classのwidth
var blockHeight = 0;
var sbwidth = 0;
window.onresize = windowResize;
 
function rerenderColWidth(colClass, isFirst) {
    var tableWidth = j$('body .pbBody table#tableHeader').width();
    var headerCol = j$('body .pbBody table.list tr.headerRow td.' + colClass);
    if (headerCol.hasClass("colUnHideIcon")) {
        listColClassMap[colClass] = "colUnHideIcon";
        tableWidth -= headerCol.width();
        // 全部最小化する
        j$('body .pbBody table.list td.' + colClass).children().hide();
        j$('body .pbBody table.list td.' + colClass).width(7).css("font-size", "0");
    } else {
        listColClassMap[colClass] = "colViewing";
        if (isFirst == false) {
            var hiddenWidth = headerCol.width();
            j$('body .pbBody table.list td.' + colClass).width("").css("font-size", "");
            j$('body .pbBody table.list td.' + colClass).children().show();
            tableWidth += listColClassWidthMap[colClass] + 2 - hiddenWidth;    // 2 is border
        }
    }
    
    j$('table#tableData').css('width', (tableWidth + 2) + 'px');
    j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
}
function getColClassName(pObj) {
    var classList = j$(pObj).attr("class").split(' ');
    var rtn = "";
    if (classList.length > 0) {
        for (var i = 0; i < classList.length; i++) {
            if (classList[i].indexOf("col_") >= 0) {
                rtn = classList[i];
                break;
            }
        }
    }
    return rtn;
}