Commit 3bfbc7fc authored by Martin Lees's avatar Martin Lees
Browse files

Rework of the workflow to use iframes instead

parent d316a498
......@@ -116,11 +116,7 @@ class Steempress_sp_Public {
$permlink = get_post_meta($id, "steempress_sp_permlink");
$tag = get_post_meta($id, "steempress_sp_tag");
$payout = "";
$data = "";
$comments = "";
$front_page = "";
if (sizeof($username) == 1 and sizeof($permlink) == 1 and sizeof($tag) == 1) {
$username = $username[0];
......@@ -131,16 +127,13 @@ class Steempress_sp_Public {
$data .= "<div name=\"steempress_sp_permlink\" style=\"display: none;\">" . $permlink . "</div>";
$data .= "<div name=\"steempress_sp_tag\" style=\"display: none;\">" . $tag . "</div>";
$payout = "<div name='steempress_sp_price'>0.000$</div> <a href='#'>Upvote</a> ";
$sign_in = "<a style=\"cursor:pointer\" onclick=\" window.open('http://localhost:8002/sc','',' scrollbars=yes,menubar=no,width=500,height=600, resizable=yes,toolbar=no,location=no,status=no')\">Sign in</a>
";
if (!is_front_page())
$comments = "<br/><div name='steempress_sp_comments'></div>";
if (is_front_page())
$steempress = "<iframe sandbox='allow-popups allow-scripts allow-same-origin' src=\"http://localhost:8002/".$tag."/".$username."/".$permlink."/false\" style=\"border: 0; width: 100%; max-height: 500px;\"></iframe>";
else
$steempress = "<iframe sandbox='allow-popups allow-scripts allow-same-origin' src=\"http://localhost:8002/".$tag."/".$username."/".$permlink."/true\" style=\"border: 0; width: 100%; max-height: 500px\"></iframe>";
}
return $content . $data . $payout .$sign_in. $comments.$front_page;
return $content . $data . $steempress;
} else
return $content;
......
......@@ -87,9 +87,11 @@ function steempress_sp_receiveToken(event)
if (event.origin !== "http://localhost:8002")
return;
var username = event.data[0];
var token = event.data[1];
var token = event.data;
var now = new Date();
now.setTime(now.getTime() + 604800000);
document.cookie = "steempress_token="+token+"; expires=" + now.toUTCString();
}
window.addEventListener("message", steempress_sp_receiveToken, false);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment