20-Jul-2021, 08:02 PM
Hello Steve.
Glad you are still there.
BTW: Is this where I'm supposed to reply each time? I don't se any way to format or attach anything.
Anyway.
The setup of the page where articles are loaded is exactly the same locally and remotely.
I have used window.location to make that possible.
Yes, of course, I have made sure that the identifier and reference are correct in the dev tools. And they definitely are.
But just to make sure, I have deleted those 2 articles and reposted them.
Now, when I refresh the page or click on a link I get the iframe for a first comment, so far so good.
So I enter a comment for two articles only: Awakening and Egoic Mind; I leave the article “Yoga” without comments.
Each time I get an email saying that I have successfully posted a comment.
At the Back end:
There are two articles posted:
1. Awakening: identifier: awakening; reference: Awakening; url: https://yimind.org/comtest.html#awakening; (form enabled; all permissions ok, approved)
2. Egoic Mind: identifier: egoic-mind; reference: Egoic Mind; url: https://yimind.org/comtest.html#egoic-mind; (form enabled; all permissions ok, approved)
To me, this all seems very good.
Yet, whether I refresh the page or load a different article, no iframe, except when there are no comments (in this case for the article “Yoga”).
Again, locally, this all works fine.
Would you please go to: yimind.org/comtest.html and check that out for yourself. I am probably missing something but I just can’t figure it out. I have written some logs to produce each time the identifier and reference.
By the way, I have tried the same code for one of my official commented pages, and the exact same issue is repeated there as well: works locally, not remotely.
Here is my code (slightly altered since the last time).
======================================
<script>
var defaultArticle = localStorage.getItem('defaultArticle');
defaultArticle = defaultArticle === null || defaultArticle === '' || defaultArticle === 'undefined' ? 'egoic-mind' : defaultArticle;
$('#textContainer').load('text/articles/' + defaultArticle + '.htm', function() {
loadComments();
});
/* ************************** */
// NOTE: load article from clicking on link
function loadNewArticle(ident) {
$('#textContainer').load('text/articles/' + ident + '.htm');
// $('#commentics iframe').hide(); // NOTE: was here by my mistake; no longer
}
/* ************************** */
var wl_protocol = window.location.protocol;
var wl_host = window.location.host;
var wl_path = window.location.pathname;
var wl_address = wl_protocol + '//' + wl_host + wl_path;
var wl_localfolder = wl_host.match('^localhost') ? '/YIMind-dev' : '';
var wl_start = wl_protocol + '//' + wl_host + wl_localfolder;
var ident, refer, url, iFrame;
// NOTE: load comments based on default article in localStorage
//function loadComments() {
var loadComments = function() {
ident = $('#post_id').val();
refer = $('#post_id').attr('title');
iFrame = document.getElementById('cmtx_iframe');
url = wl_start + '/commentics/iframe.php?identifier=' + encodeURIComponent(ident) + '&reference=' + encodeURIComponent(refer) + '&url=' + wl_address + '#' + encodeURIComponent(ident);// + '%3Fb%3Darticles%26f%3D%26s%3D%26d%3D' + encodeURIComponent(ident);
console.log('loading IDENTIFIER: ' + ident + ' | loading REFERENCE: ' + refer);
console.log('URL: ' + url);
iFrame.src = url;
$('#commentics iframe').delay(300).fadeIn(600);
};
function updateComments(ident, refer) {
iFrame = document.getElementById('cmtx_iframe');
console.log('>>> IFRAME from UPDATE: ' + iFrame);
url = wl_start + '/commentics/iframe.php?identifier=' + encodeURIComponent(ident) + '&reference=' + encodeURIComponent(refer) + '&url=' + wl_address + '#' + encodeURIComponent(ident);// + '%3Fb%3Darticles%26f%3D%26s%3D%26d%3D' + encodeURIComponent(ident);
console.log('URL: ' + url);
iFrame.src = url;
$('#commentics iframe').delay(300).fadeIn(600);
console.log('>>> updated (link) IDENTIFIER: ' + ident + ' | updated (link) REFERENCE: ' + refer);
// NOTE: update default article in localStorage
localStorage.setItem('defaultArticle', ident);
}
</script>
Thank you.
Glad you are still there.
BTW: Is this where I'm supposed to reply each time? I don't se any way to format or attach anything.
Anyway.
The setup of the page where articles are loaded is exactly the same locally and remotely.
I have used window.location to make that possible.
Yes, of course, I have made sure that the identifier and reference are correct in the dev tools. And they definitely are.
But just to make sure, I have deleted those 2 articles and reposted them.
Now, when I refresh the page or click on a link I get the iframe for a first comment, so far so good.
So I enter a comment for two articles only: Awakening and Egoic Mind; I leave the article “Yoga” without comments.
Each time I get an email saying that I have successfully posted a comment.
At the Back end:
There are two articles posted:
1. Awakening: identifier: awakening; reference: Awakening; url: https://yimind.org/comtest.html#awakening; (form enabled; all permissions ok, approved)
2. Egoic Mind: identifier: egoic-mind; reference: Egoic Mind; url: https://yimind.org/comtest.html#egoic-mind; (form enabled; all permissions ok, approved)
To me, this all seems very good.
Yet, whether I refresh the page or load a different article, no iframe, except when there are no comments (in this case for the article “Yoga”).
Again, locally, this all works fine.
Would you please go to: yimind.org/comtest.html and check that out for yourself. I am probably missing something but I just can’t figure it out. I have written some logs to produce each time the identifier and reference.
By the way, I have tried the same code for one of my official commented pages, and the exact same issue is repeated there as well: works locally, not remotely.
Here is my code (slightly altered since the last time).
======================================
<script>
var defaultArticle = localStorage.getItem('defaultArticle');
defaultArticle = defaultArticle === null || defaultArticle === '' || defaultArticle === 'undefined' ? 'egoic-mind' : defaultArticle;
$('#textContainer').load('text/articles/' + defaultArticle + '.htm', function() {
loadComments();
});
/* ************************** */
// NOTE: load article from clicking on link
function loadNewArticle(ident) {
$('#textContainer').load('text/articles/' + ident + '.htm');
// $('#commentics iframe').hide(); // NOTE: was here by my mistake; no longer
}
/* ************************** */
var wl_protocol = window.location.protocol;
var wl_host = window.location.host;
var wl_path = window.location.pathname;
var wl_address = wl_protocol + '//' + wl_host + wl_path;
var wl_localfolder = wl_host.match('^localhost') ? '/YIMind-dev' : '';
var wl_start = wl_protocol + '//' + wl_host + wl_localfolder;
var ident, refer, url, iFrame;
// NOTE: load comments based on default article in localStorage
//function loadComments() {
var loadComments = function() {
ident = $('#post_id').val();
refer = $('#post_id').attr('title');
iFrame = document.getElementById('cmtx_iframe');
url = wl_start + '/commentics/iframe.php?identifier=' + encodeURIComponent(ident) + '&reference=' + encodeURIComponent(refer) + '&url=' + wl_address + '#' + encodeURIComponent(ident);// + '%3Fb%3Darticles%26f%3D%26s%3D%26d%3D' + encodeURIComponent(ident);
console.log('loading IDENTIFIER: ' + ident + ' | loading REFERENCE: ' + refer);
console.log('URL: ' + url);
iFrame.src = url;
$('#commentics iframe').delay(300).fadeIn(600);
};
function updateComments(ident, refer) {
iFrame = document.getElementById('cmtx_iframe');
console.log('>>> IFRAME from UPDATE: ' + iFrame);
url = wl_start + '/commentics/iframe.php?identifier=' + encodeURIComponent(ident) + '&reference=' + encodeURIComponent(refer) + '&url=' + wl_address + '#' + encodeURIComponent(ident);// + '%3Fb%3Darticles%26f%3D%26s%3D%26d%3D' + encodeURIComponent(ident);
console.log('URL: ' + url);
iFrame.src = url;
$('#commentics iframe').delay(300).fadeIn(600);
console.log('>>> updated (link) IDENTIFIER: ' + ident + ' | updated (link) REFERENCE: ' + refer);
// NOTE: update default article in localStorage
localStorage.setItem('defaultArticle', ident);
}
</script>
Thank you.