PageSourceSearch

https://cdn2.ettoday.net/events/dmpfastvote/js/dmpfastvote-common.js

js ettoday.net collected 2026-10-01 10:14:17 UTC 1,991 bytes, 63 lines download raw bytes

1//模組:快問快答 開始====================
2//放在dfp-gpt.js裡面,讓它引用
3//提供iframe控制高度、關閉用
4//★★請勿使用document.write★★
5
6$(function(){
7
8  if($('.et_survey_box').length > 0){	        
9        
10		let etSurveyBox = document.querySelector('.et_survey_box');
11		let iframe = document.getElementById('if_et_survey');
12		// var iframeOrigin = 'https://beta-www.ettoday.net'; //來源網域
13    let iframeOrigin = 'https://www.ettoday.net'; //來源網域
14
15    // 監聽 iframe 下載
16    let iframeUrl = $('#if_et_survey').attr('src');
17    let tempIframe = document.createElement('iframe');
18    tempIframe.src = iframeUrl;
19    tempIframe.style.display = 'none';
20    tempIframe.onload = function() {
21        document.body.removeAttribute(tempIframe);
22        //初始 iframe 高度
23        setIframe();
24    }
25    document.body.appendChild(tempIframe);
26
27		$('.et_survey_box .inner').scrollTop(0); 
28      $('.et_survey_box .inner').on('scroll', function(){
29          $(this).addClass('scrolling');
30      });
31
32		function iframeHandle(e){
33      if(e.data.toString().indexOf('IframeStatus') !== -1 && e.origin === iframeOrigin){
34          
35        var value = e.data.split(',');
36        iframe.height = value[1];//設高度
37        console.log('et_survey iframe.height: ', iframe.height);
38				
39				//關閉問卷
40				if(value[2] === 'true'){
41					etSurveyBox.remove();
42				}
43			}
44		}
45		window.addEventListener('message', iframeHandle, false);
46
47		//傳訊息給子 要高度&是否關閉問卷====
48		function setIframe(){
49			iframe.contentWindow.postMessage('IframeStatus', iframeOrigin + '/');
50		}
51	
52		window.addEventListener("resize", setIframe, false);
53
54    $('.et_survey-btn_close, .et_survey-overlay').on('click', function(){
55      etSurveyBox.remove();
56      window.removeEventListener('message', iframeHandle, false);
57      window.removeEventListener("resize", setIframe, false);
58    });
59	}
60
61
62});
63//模組:快問快答 結束====================

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.