Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix widget loading #72

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions landing_page/mainpage/static/js/widgets/advance_widget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
document.addEventListener("DOMContentLoaded", function() {
var script = document.getElementById('f5be3bcced9b8d99a4cc095aadcc152acc1c0aa02');

var par = script.parentNode;
script.parentNode.style.overflow = 'hidden';

var iframe = document.createElement('iframe');
iframe.src = 'https://learnpythonru.getcourse.ru/pl/lite/widget/widget'
+ "?" + window.location.search.substring(1)
+ "&id=1151238"
+ "&ref=" + encodeURIComponent(document.referrer)
+ "&loc=" + encodeURIComponent(document.location.href);
iframe.style.width = '100%';
iframe.style.height = '0px';
iframe.style.border = 'none';
iframe.style.overflow = 'hidden';
iframe.setAttribute('allowfullscreen', 'allowfullscreen');
iframe.className = '511';
iframe.id = 'c6b45c08ef83f13b64a41560165b2147de61cf2a' + '_' + iframe.className;
// name можно получить изнутри iframe
iframe.name = iframe.className;

var iframeId = iframe.id;

var gcEmbedOnMessage = function(e) {
var insertedIframe = document.getElementById(iframeId);
if (!insertedIframe) {
return;
}

if (e.data.uniqName == 'f5be3bcced9b8d99a4cc095aadcc152acc1c0aa0') {
if (e.data.height) {
if (e.data.iframeName) {
if (e.data.iframeName == iframe.name) {
par.style.height = ( e.data.height ) + "px";
insertedIframe.style.height = (e.data.height) + "px";
}
} else {
par.style.height = ( e.data.height ) + "px";
insertedIframe.style.height = (e.data.height) + "px";
}
}
}
};

if (window.addEventListener) {
window.addEventListener("message", gcEmbedOnMessage, false);
} else if (window.attachEvent) {
window.attachEvent('onmessage', gcEmbedOnMessage)
} else {
window['onmessage'] = gcEmbedOnMessage
}

script.parentNode.insertBefore(iframe, script);
par.removeChild( script )
});

var getLocation = function(href) {
var l = document.createElement("a");
l.href = href;
return l;
};

var currentScript = document.currentScript || (function() {
var scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
})();

var domain = ( (getLocation( currentScript.src )).hostname );
69 changes: 69 additions & 0 deletions landing_page/mainpage/static/js/widgets/advance_widget_bottom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
document.addEventListener("DOMContentLoaded", function() {
var script = document.getElementById('f5be3bcced9b8d99a4cc095aadcc152acc1c0aa0');

var par = script.parentNode;
script.parentNode.style.overflow = 'hidden';

var iframe = document.createElement('iframe');
iframe.src = 'https://learnpythonru.getcourse.ru/pl/lite/widget/widget'
+ "?" + window.location.search.substring(1)
+ "&id=1151238"
+ "&ref=" + encodeURIComponent(document.referrer)
+ "&loc=" + encodeURIComponent(document.location.href);
iframe.style.width = '100%';
iframe.style.height = '0px';
iframe.style.border = 'none';
iframe.style.overflow = 'hidden';
iframe.setAttribute('allowfullscreen', 'allowfullscreen');
iframe.className = '51';
iframe.id = 'c6b45c08ef83f13b64a41560165b2147de61cf2a' + '_' + iframe.className;
// name можно получить изнутри iframe
iframe.name = iframe.className;

var iframeId = iframe.id;

var gcEmbedOnMessage = function(e) {
var insertedIframe = document.getElementById(iframeId);
if (!insertedIframe) {
return;
}

if (e.data.uniqName == 'f5be3bcced9b8d99a4cc095aadcc152acc1c0aa0') {
if (e.data.height) {
if (e.data.iframeName) {
if (e.data.iframeName == iframe.name) {
par.style.height = ( e.data.height ) + "px";
insertedIframe.style.height = (e.data.height) + "px";
}
} else {
par.style.height = ( e.data.height ) + "px";
insertedIframe.style.height = (e.data.height) + "px";
}
}
}
};

if (window.addEventListener) {
window.addEventListener("message", gcEmbedOnMessage, false);
} else if (window.attachEvent) {
window.attachEvent('onmessage', gcEmbedOnMessage)
} else {
window['onmessage'] = gcEmbedOnMessage
}

script.parentNode.insertBefore(iframe, script);
par.removeChild( script )
});

var getLocation = function(href) {
var l = document.createElement("a");
l.href = href;
return l;
};

var currentScript = document.currentScript || (function() {
var scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
})();

var domain = ( (getLocation( currentScript.src )).hostname );
71 changes: 71 additions & 0 deletions landing_page/mainpage/static/js/widgets/widget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
console.log('in file')

document.addEventListener("DOMContentLoaded", function() {
var script = document.getElementById('3e6321862d90cf3a72c6198927067b35e82b0b822');
// var script = document.currentScript;
var par = script.parentNode;
script.parentNode.style.overflow = 'hidden';

var iframe = document.createElement('iframe');
iframe.src = 'https://learnpythonru.getcourse.ru/pl/lite/widget/widget'
+ "?" + window.location.search.substring(1)
+ "&id=1139675"
+ "&ref=" + encodeURIComponent(document.referrer)
+ "&loc=" + encodeURIComponent(document.location.href);
iframe.style.width = '100%';
iframe.style.height = '0px';
iframe.style.border = 'none';
iframe.style.overflow = 'hidden';
iframe.setAttribute('allowfullscreen', 'allowfullscreen');
iframe.className = '941';
iframe.id = 'cc9d55a8a649fc463bf0a580d1c0567f6542b153' + '_' + iframe.className;
// name можно получить изнутри iframe
iframe.name = iframe.className;

var iframeId = iframe.id;

var gcEmbedOnMessage = function(e) {
var insertedIframe = document.getElementById(iframeId);
if (!insertedIframe) {
return;
}

if (e.data.uniqName == '3e6321862d90cf3a72c6198927067b35e82b0b82') {
if (e.data.height) {
if (e.data.iframeName) {
if (e.data.iframeName == iframe.name) {
par.style.height = ( e.data.height ) + "px";
insertedIframe.style.height = (e.data.height) + "px";
}
} else {
par.style.height = ( e.data.height ) + "px";
insertedIframe.style.height = (e.data.height) + "px";
}
}
}
};

if (window.addEventListener) {
window.addEventListener("message", gcEmbedOnMessage, false);
} else if (window.attachEvent) {
window.attachEvent('onmessage', gcEmbedOnMessage)
} else {
window['onmessage'] = gcEmbedOnMessage
}

script.parentNode.insertBefore(iframe, script);
par.removeChild( script )
});

var getLocation = function(href) {
var l = document.createElement("a");
l.href = href;
return l;
};

var currentScript = document.currentScript || (function() {
var scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
})();

var domain = ( (getLocation( currentScript.src )).hostname );
71 changes: 71 additions & 0 deletions landing_page/mainpage/static/js/widgets/widget_bottom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
console.log('in file')

document.addEventListener("DOMContentLoaded", function() {
var script = document.getElementById('3e6321862d90cf3a72c6198927067b35e82b0b82');
// var script = document.currentScript;
var par = script.parentNode;
script.parentNode.style.overflow = 'hidden';

var iframe = document.createElement('iframe');
iframe.src = 'https://learnpythonru.getcourse.ru/pl/lite/widget/widget'
+ "?" + window.location.search.substring(1)
+ "&id=1139675"
+ "&ref=" + encodeURIComponent(document.referrer)
+ "&loc=" + encodeURIComponent(document.location.href);
iframe.style.width = '100%';
iframe.style.height = '0px';
iframe.style.border = 'none';
iframe.style.overflow = 'hidden';
iframe.setAttribute('allowfullscreen', 'allowfullscreen');
iframe.className = '940';
iframe.id = 'cc9d55a8a649fc463bf0a580d1c0567f6542b153' + '_' + iframe.className;
// name можно получить изнутри iframe
iframe.name = iframe.className;

var iframeId = iframe.id;

var gcEmbedOnMessage = function(e) {
var insertedIframe = document.getElementById(iframeId);
if (!insertedIframe) {
return;
}

if (e.data.uniqName == '3e6321862d90cf3a72c6198927067b35e82b0b82') {
if (e.data.height) {
if (e.data.iframeName) {
if (e.data.iframeName == iframe.name) {
par.style.height = ( e.data.height ) + "px";
insertedIframe.style.height = (e.data.height) + "px";
}
} else {
par.style.height = ( e.data.height ) + "px";
insertedIframe.style.height = (e.data.height) + "px";
}
}
}
};

if (window.addEventListener) {
window.addEventListener("message", gcEmbedOnMessage, false);
} else if (window.attachEvent) {
window.attachEvent('onmessage', gcEmbedOnMessage)
} else {
window['onmessage'] = gcEmbedOnMessage
}

script.parentNode.insertBefore(iframe, script);
par.removeChild( script )
});

var getLocation = function(href) {
var l = document.createElement("a");
l.href = href;
return l;
};

var currentScript = document.currentScript || (function() {
var scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
})();

var domain = ( (getLocation( currentScript.src )).hostname );
2 changes: 1 addition & 1 deletion landing_page/mainpage/templates/mainpage/advanced.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ <h2>Записаться</h2>
<h3 class="text-center d-none d-lg-block">онлайн курс</h3>
<div class="priceList">
<div class="price-list-item" style="padding: 10px; background-color: #ffffff;">
<script id="f5be3bcced9b8d99a4cc095aadcc152acc1c0aa0" src="https://learnpythonru.getcourse.ru/pl/lite/widget/script?id=1151238"></script>
<script id="f5be3bcced9b8d99a4cc095aadcc152acc1c0aa0" src="{% static 'js/widgets/advance_widget_bottom.js' %}"></script>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% load static %}

<section id="hero" class="hero show1">
<div class="container">
<div class="row">
Expand Down Expand Up @@ -51,7 +53,7 @@ <h4 class="curs-place col-12 col-md-8 col-xl-12">
<div class="card-body d-flex flex-column justify-content-between">
<h3 class="card-heading brackets brackets-yellow">Учитесь онлайн</h3>
<div class="price-list">
<script id="f5be3bcced9b8d99a4cc095aadcc152acc1c0aa0" src="https://learnpythonru.getcourse.ru/pl/lite/widget/script?id=1151238"></script>
<script id="f5be3bcced9b8d99a4cc095aadcc152acc1c0aa02" src="{% static 'js/widgets/advance_widget.js' %}"></script>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% load static %}

<section id="hero" class="hero show1">
<div class="container">
<div class="row">
Expand Down Expand Up @@ -51,7 +53,7 @@ <h4 class="curs-place col-12 col-md-8 col-xl-12">
<div class="card-body d-flex flex-column justify-content-between">
<h3 class="card-heading brackets brackets-yellow">Учитесь онлайн</h3>
<div class="price-list">
<script id="3e6321862d90cf3a72c6198927067b35e82b0b82" src="https://learnpythonru.getcourse.ru/pl/lite/widget/script?id=1139675"></script>
<script id="3e6321862d90cf3a72c6198927067b35e82b0b822" src="{% static 'js/widgets/widget.js' %}"></script>
</div>
</div>
</div>
Expand Down
12 changes: 2 additions & 10 deletions landing_page/mainpage/templates/mainpage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,12 @@ <h2>Записаться</h2>
</div>
<div class="container m-hide">
<div class="price-second-container row justify-content-center">
<div class="col-12 d-lg-none ">
<div class="tab-holder bg-yellow">
<div class="button-holder">
<a data-target=".online-tab" class="custom-tab active">онлайн</a>
<a class="custom-tab" data-target=".offline-tab">оффлайн</a>
</div>
</div>
</div>
<div class="col-12 col-lg-10 col-xl-6 online-tab active">
<div class="price-second bg-yellow">
<h3 class="text-center d-none d-lg-block">онлайн курс</h3>
<h3 class="text-center">онлайн курс</h3>
<div class="priceList">
<div class="price-list-item" style="padding: 10px; background-color: #ffffff;">
<script id="3e6321862d90cf3a72c6198927067b35e82b0b82" src="https://learnpythonru.getcourse.ru/pl/lite/widget/script?id=1139675"></script>
<script id="3e6321862d90cf3a72c6198927067b35e82b0b82" src="{% static 'js/widgets/widget_bottom.js' %}"></script>
</div>
</div>
</div>
Expand Down
Loading