// 自動ポップアップを止める場合は"false" const auto_popup = false // ブラウザポップアップを止める場合は"false" const back_popup = true // ポップアップを2回出さないときにfalse const multi_popup = false // ブラウザバックをさせない場合は"true"にする const prevent_back = false // ポップアップを出すタイミングを設定(秒) const pop_time=5 // 画像ファイルの相対path const img_path="https://www.tsuyoshikashiwazaki.com/wp-content/uploads/2023/02/YoutubeBTN-SEO.jpg" // clickプログラム const set_clickpg="https://tsuyoshikashiwazaki.net/cgi/popup/tsuyoshikashiwazaki.com/click.cgi" // リンク先 const set_href="https://www.youtube.com/@kame3404" // リファラ const origin = location.href; $(function () { let pop_flg = false let back_flg = false let insertHtml=` ` let insertCSS=` ` document.getElementsByTagName('head')[0] .insertAdjacentHTML('beforeend', insertCSS); document.getElementsByTagName('body')[0] .insertAdjacentHTML('afterbegin', insertHtml); if(back_popup){ $(document).ready(function () { (function (b) { var c = function () { this.initialize(); }; c.prototype = { initialize: function () { // if (b.originalEvent.state == "beforeunload") { history.replaceState("beforeunload", null, null); history.pushState(null, null, null); // } b(window).on("popstate", b.proxy(this.popstate, this)); }, popstate: function (b) { if(pop_flg && !multi_popup){ history.go(-1) } if (b.originalEvent.state === "beforeunload") { viewBackGuide(); back_flg=true var origin = location.href; uri = 'https://tsuyoshikashiwazaki.net/cgi/popup/tsuyoshikashiwazaki.com/call.cgi?' + origin; $.get(uri, function(data) { alert(data); }); } }, }; new c(); })($); }); } //ポップアップ領域をクリックされた場合、ポップアップを閉じる $("#modal_label").on('click', function () { $("#modal_trigger").prop('checked', false); }); function viewBackGuide() { //戻るボタン無効化にするには下記を有効課 if(prevent_back){ history.pushState(null, null, null); } $("#modal_trigger").prop('checked', true); } if(auto_popup){ if(!back_flg){ setTimeout(function(){ $("#modal_trigger").prop('checked', true) pop_flg=true }, pop_time*1000); } } });