PageSourceSearch

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

js acti.com collected 2026-10-03 20:54:30 UTC 10,277 bytes, 255 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    $.ajax({
48        url: "https://member.acti.com/corpweb/Public/Scripts/ContactUsPopup/GetContactUsData.ashx",
49        type: 'POST',
50        async: true,
51        cache: false,
52        dataType: "jsonp",
53        jsonp: "CallBack",
54        jsonpCallback: "GetData",
55        crossDomain: true,
56        xhrFields: {
57            withCredentials: true
58        },
59        data: {
60            LandId: $ContactUsPopup.GetCookie("ACTiCorpLang")
61        },
62        success: function(result) {
63            var salesData = JSON.parse(decodeURIComponent(result.Data));
64            if (salesData.Visible) {
65                $('.ContactUsTrigger').each(function() {
66                    $(this).ContactUsTrigger({
67                        EnvirUrl: salesData.EnvirUrl, // dfault: ''
68                        LangCode: 'en',    // LangCode,  default: en
69                        Multiple: false,   // 是否可以多開, default: false
70                        ClickOutsideToClose: false,  // 是否可以點擊Popup以外的區域來關閉Popup, default: true  (若Multiple為true, 則ClickOutsideToClose強制為false)
71                        Position: 'Center',
72                        SalesList: salesData.SalesList
73                    });
74                });
75
76
77            }
78        },
79        error: function() {
80
81        }
82    });
83});
84
85$.fn.ContactUsTrigger = function(inputOptions) {
86    var options = {
87        EnvirUrl: '',
88        Multiple: false,
89        LangCode: 'en',
90        Create: null,
91        AfterOpen: null,
92        BeforeClose: null,
93        AfterClose: null,
94        ClickOutsideToClose: false,
95        Target: $(this),
96        Position: 'Center'   // or 'Target'
97    };
98
99    options.Target[0].TargetName = 'ContactUsTrigger';
100
101    if (inputOptions) {
102        for (var key in inputOptions) {
103            options[key] = inputOptions[key];
104        }
105    }
106
107    options.Target.show();
108    options.Target.click(function() {
109        $ContactUsPopup.open(options);
110    });
111};
112
113var $ContactUsPopup = {
114    init: function() {
115        
116    },
117    open: function(options) {
118        var thisDialog = $('#ContactUsDialog.ContactUsDialog');
119
120        if ($('#ContactUsDialog.ContactUsDialog').length > 0) {
121            // 若Dialog已開啟則不做任何動作
122            if (thisDialog.hasClass('ui-dialog-content') && thisDialog.dialog("isOpen")) {
123                return;
124            } else {
125                thisDialog.dialog('open');
126                return;
127            }
128
129            // 檢查多開的情況
130            //if (options.Multiple) {
131            //    options.ClickOutsideToClose = false;
132            //    $('.ContactUsDialog[brandid=' + options.BrandId + ']').dialog('destroy').remove();
133            //} else {
134            //    $('.ContactUsDialog.ui-brand-info').each(function() {
135            //        $(this).dialog('destroy').remove();
136            //    });
137            //}
138        } else {
139            thisDialog = $('\
140                <div id="ContactUsDialog" class="ContactUsDialog" style="display: none;">\
141                    <div id="CU_SalesArea">\
142                    </div>\
143                </div>');
144        }
145
146        thisDialog[0].Options = options;
147
148        // Load data
149        if (options.SalesList) {
150            var salesList = options.SalesList,
151                salesArea = thisDialog.find('#CU_SalesArea');
152            for (var i = 0; i < salesList.length; i++) {
153                var salesItem = '\
154                    <table class="SALES_BOX">\
155                        <tr>\
156                            <td rowspan="2" style="width: 20%;">\
157                                <img src="http://www.acti.com/corpweb/UploadFile/A0000000029/' + salesList[i].ImageId + '" style="max-width: 70px; max-height: 80px; min-width: 70px; min-height: 80px;">\
158                            </td>\
159                            <td class="f16blackbold">' + salesList[i].Name + '</td>\
160                        </tr>\
161                        <tr>\
162                            <td class="f13black">
162' + 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 + '</td>\
163                        </tr>\
164                    </table>';
165                salesArea.append(salesItem);
166            }
167        }
168
169        // 建立Dialog
170        thisDialog.dialog({
171            title: "Contact Us",
172            width: $(window).width() < 610 ? $(window).width() - 60 : 550,
173            modal: false,
174            autoOpen: false,
175            resizable: false,
176            create: function() {
177                $(this).parent().find(".ui-dialog-titlebar").removeClass("ui-widget-header");
178
179                $('body').bind('click', function(e) {
180                    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) {
181                        thisDialog.dialog('close');
182                    }
183                });
184
185                // resize
186                $(window).resize(function() {
187                    thisDialog.dialog("option", "width", $(window).width() < 610 ? $(window).width() - 10 : 600);
188                    $ContactUsPopup.resetPosition(thisDialog, thisDialog[0].Options.Target, thisDialog[0].Options.Position, true);
189                });
190
191                thisDialog.dialog('open');
192            },
193            open: function() {
194                // cancel focus
195                thisDialog.find('a, select, input, textarea, button').first().blur();
196                
197                thisDialog.dialog('option', 'width', ($(window).width() < 610 ? $(window).width() - 60 : 550));
198
199                $ContactUsPopup.resetPosition(thisDialog, options.Target, options.Position);
200
201                thisDialog.dialog('widget').animate({
202                    width: "+=50",
203                    left: "-=25"
204                }, 100);
205            },
206            close: function() {
207                //$(this).dialog('destroy').remove();
208                //thisDialog = null;
209            }
210        });
211    },
212    resetPosition: function(dialog, target, position, isResize) {
213        if (target && position.toLowerCase() == 'target') {
214            //var topDx = target.offset().top - ($(window).height() / 2) + (dialog.parent().height() / 2);
215            //topDx = topDx > 0 ? "-" + topDx : ("" + topDx).replace('-', '+');
216
217            if (target.offset().left + target.width() + 605 < $(window).width()) {
218                dialog.dialog('option', 'position', { my: "left top", at: "right+" + (isResize ? 10 : 35) + " top-35", of: target });
219            } else if (target.offset().left > 615) {
220                dialog.dialog('option', 'position', { my: "right top", at: "left-" + (isResize ? 10 : 35) + " top-35", of: target });
221            } else {
222                dialog.dialog('option', 'position', { my: "center center", at: "center center", of: window });
223            }
224        } else {
225            dialog.dialog('option', 'position', { my: "center center", at: "center center", of: window });
226        }
227    },
228    getImageUrl: function(id, envirUrl) {
229        return 'http://' + envirUrl + 'download.acti.com/corpweb/DownloadCenter/Ajax/MakeThumbImage.ashx?id=' + id + '&toExt=png&maxHeight=80';
230    },
231    //讀取cookie
232    GetCookie: function(cookieName) //讀取Cookie的原始值
233    {
234        var arg = cookieName + "=";
235        var alen = arg.length;
236        var clen = document.cookie.length;
237        var i = 0;
238        while (i < clen) {
239            var j = i + alen;
240            if (document.cookie.substring(i, j) == arg)
241                //return GetCookieVal(j);
242                return $ContactUsPopup.GetCookieVal(j);
243            i = document.cookie.indexOf(" ", i) + 1;
244            if (i == 0) break;
245        }
246        return null;
247    },
248    //獲得Cookie解码后的值
249    GetCookieVal: function(offset) {
250        var endstr = document.cookie.indexOf(";", offset);
251        if (endstr == -1)
252            endstr = document.cookie.length;
253        return unescape(document.cookie.substring(offset, endstr));
254    }
255};

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.