Commit 5d37fc98 authored by Martin Lees's avatar Martin Lees
Browse files

Removal of useless js/css

parent 3bfbc7fc
......@@ -128,9 +128,9 @@ class Steempress_sp_Public {
$data .= "<div name=\"steempress_sp_tag\" style=\"display: none;\">" . $tag . "</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>";
$steempress = "<iframe sandbox='allow-popups allow-scripts allow-same-origin' src=\"http://localhost:8002/?tag=".$tag."&author=".$username."&permlink=".$permlink."&display_comment=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>";
$steempress = "<iframe sandbox='allow-popups allow-scripts allow-same-origin' src=\"http://localhost:8002/?tag=".$tag."&author=".$username."&permlink=".$permlink."&display_comment=true\" style=\"border: 0; width: 100%; max-height: 500px\"></iframe>";
}
return $content . $data . $steempress;
......
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
#steempress_sp_price {
text-align: right;
}
#steempress_sp_cmmnt img { border: 0; max-width: 100%; height: 55px;}
/* page layout structure */
#w { display: block; width: 700px; margin: 0 auto; padding-top: 35px; }
#steempress_sp_comment_container {
display: block;
width: 100%;
font-size: 62.5%;
line-height: 1;
font-family: Arial, sans-serif;
}
.steempress_sp_comment_text {
font-family: Arial, Geneva, Verdana, sans-serif; font-size: 1.6em; line-height: 1.42em; margin-bottom: 12px; font-weight: normal; color: #656565;
}
/* steempress_sp_comments area */
#steempress_sp_comments { display: block; }
#steempress_sp_comments .steempress_sp_cmmnt, ul .steempress_sp_cmmnt, ul ul .steempress_sp_cmmnt { display: block; position: relative; padding-left: 65px; border-top: 1px solid #ddd; }
#steempress_sp_comments .steempress_sp_cmmnt .avatar { position: absolute; top: 8px; left: 0; }
#steempress_sp_comments .steempress_sp_cmmnt .avatar img {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.44);
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.44);
box-shadow: 1px 1px 2px rgba(0,0,0,0.44);
-webkit-transition: all 0.4s linear;
-moz-transition: all 0.4s linear;
-ms-transition: all 0.4s linear;
-o-transition: all 0.4s linear;
transition: all 0.4s linear;
}
#steempress_sp_comments .steempress_sp_cmmnt .avatar a:hover img { opacity: 0.77; }
#steempress_sp_comments .steempress_sp_cmmnt .steempress_sp_cmmnt-content { padding: 0px 3px; padding-bottom: 12px; padding-top: 8px; }
#steempress_sp_comments .steempress_sp_cmmnt .steempress_sp_cmmnt-content header { font-size: 1.3em; display: block; margin-bottom: 8px; }
#steempress_sp_comments .steempress_sp_cmmnt .steempress_sp_cmmnt-content header .pubdate { color: #777; }
#steempress_sp_comments .steempress_sp_cmmnt .steempress_sp_cmmnt-content header .userlink { font-weight: bold; }
#steempress_sp_comments .steempress_sp_cmmnt .replies { margin-bottom: 7px; }
......@@ -2,96 +2,7 @@
(function( $ ) {
'use strict';
// Create the XHR object.
function createCORSRequest() {
var url = "http://localhost:8002"
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
// XHR for Chrome/Firefox/Opera/Safari.
xhr.open("POST", url, true);
} else if (typeof XDomainRequest != "undefined") {
// XDomainRequest for IE.
xhr = new XDomainRequest();
xhr.open("POST", url);
} else {
// CORS not supported.
xhr = null;
}
return xhr;
}
function post_request(username, permlink, tag, steempress_sp_price, steempress_sp_comment)
{
var xhr = createCORSRequest();
if (steempress_sp_comment === null)
var params = "username=" + username + "&permlink=" + permlink + "&tag=" + tag + "&display_comment=false";
else
var params = "username=" + username + "&permlink=" + permlink + "&tag=" + tag + "&display_comment=true";
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
if (!xhr) {
return;
}
xhr.steempress_sp_price = steempress_sp_price;
xhr.steempress_sp_comment = steempress_sp_comment;
xhr.username = username;
xhr.permlink = permlink;
// Response handlers.
xhr.onload = function () {
var data = JSON.parse(xhr.responseText);
this.steempress_sp_price.innerHTML = data.payout;
if (this.steempress_sp_comment !== null)
this.steempress_sp_comment.innerHTML = data.comments;
};
xhr.send(params);
}
function load_steem_capabilities() {
const usernames = document.getElementsByName("steempress_sp_username");
const permlinks = document.getElementsByName("steempress_sp_permlink");
const tags = document.getElementsByName("steempress_sp_tag");
const front_page = (document.getElementsByName("steempress_sp_comments").length === 0);
var steempress_sp_prices = document.getElementsByName("steempress_sp_price");
var steempress_sp_comments = document.getElementsByName("steempress_sp_comments");
for (var i = 0; i < usernames.length; i++) {
var username = usernames[i].innerText;
var permlink = permlinks[i].innerText;
var tag = tags[i].innerText;
var steempress_sp_price = steempress_sp_prices[i];
var steempress_sp_comment = (!front_page ? steempress_sp_comments[i] : null);
post_request(username, permlink, tag, steempress_sp_price, steempress_sp_comment);
}
}
$(window).load(load_steem_capabilities)
})( jQuery );
function steempress_sp_receiveToken(event)
{
if (event.origin !== "http://localhost:8002")
return;
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