// 自動ポップアップを止める場合は"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.jp/wp-content/uploads/2023/01/%E3%82%B3%E3%83%B3%E3%83%86%E3%83%B3%E3%82%B7%E3%83%A3%E3%83%AB-%E3%82%AA%E3%83%BC%E3%83%80%E3%83%BC%E3%83%A1%E3%82%A4%E3%83%89SEO%E3%81%8A%E8%A6%8B%E7%A9%8D%E3%82%8A%E3%83%95%E3%82%A9%E3%83%BC%E3%83%A0.png"
// clickプログラム
const set_clickpg="https://tsuyoshikashiwazaki.net/cgi/popup/tsuyoshikashiwazaki.jp/click.cgi"
// リンク先
const set_href="https://www.contencial.co.jp/search-engine-optimization/"
// リファラ
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.jp/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);
}
}
});