PageSourceSearch

https://member.acti.com/corpweb/Public/Scripts/ContactUsPopup/ContactUsPopup.js

js acti.com collected 2026-09-25 15:25:23 UTC 10,854 bytes, 263 lines download raw bytes

1$(document).ready(function() {
2    $('head').first().append('\
3        <style type="text/css">\
4            #ContactUsDialog.ContactUsDialog #CU_SalesArea table.SALES_BOX {\
5                max-width: 600px;\
6                width: 100%;\
7                background-color: white;\
8                border: #C9C9C9 solid 1px;\
9                margin-bottom: 15px;\
10            }\
11            #ContactUsDialog.ContactUsDialog #CU_SalesArea table.SALES_BOX td {\
12                padding: 5px 20px;\
13            }\
14            #ContactUsDialog.ContactUsDialog #CU_SalesArea table.SALES_BOX td.f16blackbold {\
15                font-size: 16px;\
16                color: #000000;\
17                font-weight: bold;\
18            }\
19            #ContactUsDialog.ContactUsDialog #CU_SalesArea table.SALES_BOX td.f13black {\
20                font-size: 13px;\
21                color: #000000;\
22                LINE-HEIGHT: 16px;\
23                font-family: "Arial";\
24                LETTER-SPACING: 0px;\
25            }\
26            #ContactUsDialog.ContactUsDialog #CU_SalesArea a.word-break {\
27                word-break: break-all;\
28                line-height: initial;\
29                font-size: 13px;\
30                text-decoration: none;\
31                color: #0078a0;\
32            }\
33            #ContactUsDialog.ContactUsDialog #CU_SalesArea td.BG_WHITE {\
34                background-color: #FFFFFF;\
35            }\
36            .ui-span-ContactUsTrigger {\
37                color: rgb(138, 168, 189);\
38                font-family: "Helvetica Neue", Helvetica, Helvetica, Arial, sans-serif;\
39                cursor: pointer;\
40                font-size: 14px;\
41                font-weight: bold;\
42                line-height: 14px;\
43            }\
44        </style>');
45
46    // 取得ContactUs資料
47    var domain = document.domain.toLowerCase().indexOf('test.') == 0 ? 'test.www.acti.com' : 'cdn-www.acti.com';
48
49    $.ajax({
50        url: "https://" + domain + "/corpweb/Public/Scripts/ContactUsPopup/GetContactUsData.ashx",
51        type: 'POST',
52        async: true,
53        cache: false,
54        dataType: "jsonp",
55        jsonp: "CallBack",
56        jsonpCallback: "GetData",
57        crossDomain: true,
58        xhrFields: {
59            withCredentials: true
60        },
61        data: {
62            LandId: $ContactUsPopup.GetCookie("ACTiCorpLang")
63        },
64        success: function(result) {
65            var salesData = JSON.parse(decodeURIComponent(result.Data));
66            if (salesData != null && salesData.Visible) {
67                $('.ContactUsTrigger').each(function() {
68                    $(this).ContactUsTrigger({
69                        EnvirUrl: salesData.EnvirUrl, // dfault: ''
70                        LangCode: 'en',    // LangCode,  default: en
71                        Multiple: false,   // 是否可以多開, default: false
72                        ClickOutsideToClose: false,  // 是否可以點擊Popup以外的區域來關閉Popup, default: true  (若Multiple為true, 則ClickOutsideToClose強制為false)
73                        Position: 'Center',
74                        SalesList: salesData.SalesList
75                    });
76                });
77
78
79            }
80        },
81        error: function() {
82
83        }
84    });
85});
86
87$.fn.ContactUsTrigger = function(inputOptions) {
88    var options = {
89        EnvirUrl: '',
90        Multiple: false,
91        LangCode: 'en',
92        Create: null,
93        AfterOpen: null,
94        BeforeClose: null,
95        AfterClose: null,
96        ClickOutsideToClose: false,
97        Target: $(this),
98        Position: 'Center'   // or 'Target'
99    };
100
101    options.Target[0].TargetName = 'ContactUsTrigger';
102
103    if (inputOptions) {
104        for (var key in inputOptions) {
105            options[key] = inputOptions[key];
106        }
107    }
108
109    options.Target.show();
110    options.Target.click(function() {
111        $ContactUsPopup.open(options);
112    });
113};
114
115var $ContactUsPopup = {
116    init: function() {
117
118    },
119    open: function(options) {
120        var thisDialog = $('#ContactUsDialog.ContactUsDialog');
121
122        if ($('#ContactUsDialog.ContactUsDialog').length > 0) {
123            // 若Dialog已開啟則不做任何動作
124            if (thisDialog.hasClass('ui-dialog-content') && thisDialog.dialog("isOpen")) {
125                return;
126            } else {
127                thisDialog.dialog('open');
128                return;
129            }
130
131            // 檢查多開的情況
132            //if (options.Multiple) {
133            //    options.ClickOutsideToClose = false;
134            //    $('.ContactUsDialog[brandid=' + options.BrandId + ']').dialog('destroy').remove();
135            //} else {
136            //    $('.ContactUsDialog.ui-brand-info').each(function() {
137            //        $(this).dialog('destroy').remove();
138            //    });
139            //}
140        } else {
141            thisDialog = $('\
142                <div id="ContactUsDialog" class="ContactUsDialog" style="display: none;">\
143                    <div id="CU_SalesArea">\
144                    </div>\
145                </div>');
146        }
147
148        thisDialog[0].Options = options;
149
150        // Load data
151        if (options.SalesList) {
152            var salesList = options.SalesList,
153                salesArea = thisDialog.find('#CU_SalesArea');
154            for (var i = 0; i < salesList.length; i++) {
155                if (salesList[i].JobFunction) {
156                    var jobFuncItem = '<div style="padding-bottom: 3px;"><b>' + salesList[i].JobFunction + '</b></div>';
157                    salesArea.append(jobFuncItem);
158                }
159
160                var imgUrl = salesList[i].ImageId == 'DetailLogo.png' ? 'https://download.acti.com/corpweb/DownloadCenter/Ajax/MakeThumbImage.ashx?id=17219' : 'https://www.acti.com/corpweb/UploadFile/A0000000029/' + salesList[i].ImageId;
161                var salesItem = '\
162                    <table class="SALES_BOX">\
163                        <tr>\
164                            <td rowspan="2" style="width: 20%;">\
165                                <img src="' + imgUrl + '" style="max-width: 70px; max-height: 80px; min-width: 70px; min-height: 80px;">\
166                            </td>\
167                            <td class="f16blackbold">' + salesList[i].Name + '</td>\
168                        </tr>\
169                        <tr>\
170                            <td class="f13black">
170' + salesList[i].ExternalTitle + '<br>Email: <a class="word-break" href="mailto:' + salesList[i].Account + '">' + salesList[i].Account + '</a><br>Tel: ' + salesList[i].Tel + '<br>Fax: ' + salesList[i].Fax + '<br>Tech Support: ' + salesList[i].TechSupport + '</td>\
171                        </tr>\
172                    </table>';
173                salesArea.append(salesItem);
174            }
175        }
176
177        // 建立Dialog
178        thisDialog.dialog({
179            title: "Contact Us",
180            width: $(window).width() < 610 ? $(window).width() - 60 : 550,
181            modal: false,
182            autoOpen: false,
183            resizable: false,
184            create: function() {
185                $(this).parent().find(".ui-dialog-titlebar").removeClass("ui-widget-header");
186
187                $('body').bind('click', function(e) {
188                    if (options.ClickOutsideToClose && e.target.TargetName != options.Target[0].TargetName && thisDialog.dialog('isOpen') && !jQuery(e.target).is('.ui-dialog, a') && !jQuery(e.target).closest('.ui-dialog').length) {
189                        thisDialog.dialog('close');
190                    }
191                });
192
193                // resize
194                $(window).resize(function() {
195                    thisDialog.dialog("option", "width", $(window).width() < 610 ? $(window).width() - 10 : 600);
196                    $ContactUsPopup.resetPosition(thisDialog, thisDialog[0].Options.Target, thisDialog[0].Options.Position, true);
197                });
198
199                thisDialog.dialog('open');
200            },
201            open: function() {
202                // cancel focus
203                thisDialog.find('a, select, input, textarea, button').first().blur();
204
205                thisDialog.dialog('option', 'width', ($(window).width() < 610 ? $(window).width() - 60 : 550));
206
207                $ContactUsPopup.resetPosition(thisDialog, options.Target, options.Position);
208
209                thisDialog.dialog('widget').animate({
210                    width: "+=50",
211                    left: "-=25"
212                }, 100);
213            },
214            close: function() {
215                //$(this).dialog('destroy').remove();
216                //thisDialog = null;
217            }
218        });
219    },
220    resetPosition: function(dialog, target, position, isResize) {
221        if (target && position.toLowerCase() == 'target') {
222            //var topDx = target.offset().top - ($(window).height() / 2) + (dialog.parent().height() / 2);
223            //topDx = topDx > 0 ? "-" + topDx : ("" + topDx).replace('-', '+');
224
225            if (target.offset().left + target.width() + 605 < $(window).width()) {
226                dialog.dialog('option', 'position', { my: "left top", at: "right+" + (isResize ? 10 : 35) + " top-35", of: target });
227            } else if (target.offset().left > 615) {
228                dialog.dialog('option', 'position', { my: "right top", at: "left-" + (isResize ? 10 : 35) + " top-35", of: target });
229            } else {
230                dialog.dialog('option', 'position', { my: "center center", at: "center center", of: window });
231            }
232        } else {
233            dialog.dialog('option', 'position', { my: "center center", at: "center center", of: window });
234        }
235    },
236    getImageUrl: function(id, envirUrl) {
237        return 'https://' + envirUrl + 'download.acti.com/corpweb/DownloadCenter/Ajax/MakeThumbImage.ashx?id=' + id + '&toExt=png&maxHeight=80';
238    },
239    //讀取cookie
240    GetCookie: function(cookieName) //讀取Cookie的原始值
241    {
242        var arg = cookieName + "=";
243        var alen = arg.length;
244        var clen = document.cookie.length;
245        var i = 0;
246        while (i < clen) {
247            var j = i + alen;
248            if (document.cookie.substring(i, j) == arg)
249            //return GetCookieVal(j);
250                return $ContactUsPopup.GetCookieVal(j);
251            i = document.cookie.indexOf(" ", i) + 1;
252            if (i == 0) break;
253        }
254        return null;
255    },
256    //獲得Cookie解码后的值
257    GetCookieVal: function(offset) {
258        var endstr = document.cookie.indexOf(";", offset);
259        if (endstr == -1)
260            endstr = document.cookie.length;
261        return unescape(document.cookie.substring(offset, endstr));
262    }
263};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.