Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated to latest version of StackTack and switched to a separate sty…

…lesheet for StackTack.
  • Loading branch information...
commit 1d05b5eba64aab28267be4f0732bbcae448c012a 1 parent 44ed529
@nathan-osman authored
View
1  css/stacktack.min.css
@@ -0,0 +1 @@
+.stacktack-container { background-color: white; border-radius: 8px; box-shadow: 0px 0px 10px #777; font-family: arial, helvetica, sans; font-size: 10pt; margin: 10px; padding: 10px; } .stacktack-container a { color: #58c; text-decoration: none; } .stacktack-container a:hover { color: #79e; } .stacktack-container .branding { float: right; font-size: 12pt; font-weight: bold; color: #aaa; margin-left: 10px; } .stacktack-container .branding span { color: #ccc; } .stacktack-container .heading { display: block; font-size: 14pt; font-weight: bold; } .stacktack-container .hr { background-color: #ccc; height: 1px; margin: 2px 0px; } .stacktack-container p { margin: 10px 0px; } .stacktack-container pre { background-color: #e7e7e7; overflow-x: auto; padding: 4px 10px; } .stacktack-container p.tip { color: #999; padding: 0px 20px; } .stacktack-container .tags { margin: 6px 0px; text-align: right; } .stacktack-container .tags div { background-color: #e7e7ff; border-bottom: 1px solid #bbf; border-right: 1px solid #bbf; display: inline-block; margin-right: 6px; padding: 2px 6px; } .stacktack-container .answer-count { color: #999; margin: 4px 0px; } .stacktack-container .answer-count span { color: #7b7; }
View
2  js/stacktack.init.js
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
$(document).ready(function() {
- $('.stacktack').stacktack();
+ $('.stacktack').stacktack({ 'width': 580 });
});
View
9 js/stacktack.min.js
@@ -1,5 +1,4 @@
-(function(b){function h(a){if("undefined"!=typeof a.dataset)return a.dataset;var e={};b.each(a.attributes,function(b,f){null!==f.name.match(/^data-/)&&(e[f.name.replace(/^data-/,"")]=f.value)});return e}function j(a,e,d,f,c,k){d=(a.secure?"https://":"http://")+"api.stackexchange.com/2.0"+d;f.key=a.key;f.site=e;f.filter=a.filter;b.ajax({url:d,data:f,dataType:"jsonp",success:function(b){"undefined"!=typeof b.error_message?k(b.error_message):c(b.items)}})}function l(a,e){var d={};b.each(e,function(b,
-c){d[c.question_id]=c});b.each(a,function(f,c){var a=d[c.id],e=b(c.element);e.addClass("stacktack-container");e.css("width",c.width+"px");var g;g='<div class="branding">Stack<span>Tack</span></div>'+('<a href="'+a.link+'" target="_blank" class="heading">'+a.title+'</a><div class="hr" />');g+=a.body+'<div class="hr" />';if(a.answer_count){a.answers.sort(function(b,a){return a.score-b.score});var i=[];b.each(a.answers,function(b,a){i.push('<div class="heading answer-count">'+a.score+" votes</div>"+
-a.body)});g+=i.join('<div class="hr" />')}else g+='<p class="tip">There are currently no answers.</p>';e.html(g)})}b("head").append("<style>.stacktack-container { background-color: white; border-radius: 8px; box-shadow: 0px 0px 10px #777; font-family: arial, helvetica, sans; margin: 20px 10px; padding: 10px; } .stacktack-container a { color: #58c; text-decoration: none; } .stacktack-container a:hover { color: #79e; } .stacktack-container .branding { float: right; font-size: 12pt; font-weight: bold; color: #aaa; margin-left: 10px; } .stacktack-container .branding span { color: #ccc; } .stacktack-container .heading { display: block; font-size: 14pt; font-weight: bold; } .stacktack-container .hr { background-color: #ccc; height: 1px; } .stacktack-container p, .stacktack-container ol, .stacktack-container ul { font-size: 10pt; } .stacktack-container pre { background-color: #e7e7e7; overflow-x: auto; padding: 4px 10px; } .stacktack-container p.tip { color: #999; padding: 0px 20px; } .stacktack-container .answer-count { color: #999; margin: 4px 0px; }</style>");
-b.fn.stacktack=function(a){var e=b.extend({},b.fn.stacktack.defaults,a),d={};this.each(function(){var a=b.extend({},e,h(this),{element:this});if("undefined"!=typeof a.id){var c=a.site.replace(/\.com$/,"");"undefined"==typeof d[c]&&(d[c]=[]);d[c].push(a)}});b.each(d,function(a,c){var d=[];b.each(c,function(a,b){d.push(b.id)});var h=b.unique(d).join(";");j(e,a,"/questions/"+h,{},function(a){l(c,a)},function(){})})};b.fn.stacktack.defaults={key:"CRspH1WAlZKCeCinkGOLHw((",filter:"!-)dQB3E8g_ab",secure:!1,
-site:"stackoverflow",width:580}})(jQuery);
+(function(){(function(b){function h(a){if("undefined"!=typeof a.dataset)return a.dataset;var d={};b.each(a.attributes,function(b,c){null!==c.name.match(/^data-/)&&(d[c.name.replace(/^data-/,"")]=c.value)});return d}function j(a,d,e,c,f,k){e=(a.secure?"https://":"http://")+"api.stackexchange.com/2.0"+e;c.key=a.key;c.site=d;c.filter=a.filter;b.ajax({url:e,data:c,dataType:"jsonp",success:function(c){"undefined"!=typeof c.error_message?k(c.error_message):f(c.items)}})}function l(a){var d='<div class="tags">';
+b.each(a,function(b,c){d+="<div>"+c+"</div>"});return d+"</div>"}function m(a,d){var e={};b.each(d,function(c,b){e[b.question_id]=b});b.each(a,function(c,f){var a=e[f.id],d=b(f.element);d.addClass("stacktack-container");d.css("width",f.width+"px");var g;g='<div class="branding">Stack<span>Tack</span></div>'+('<a href="'+a.link+'" target="_blank" class="heading">'+a.title+'</a><div class="hr" />'+a.body);f.tags&&(g+=l(a.tags));g+='<div class="hr" />';if(a.answer_count){a.answers.sort(function(c,a){return a.score-
+c.score});var i=[];b.each(a.answers,function(c,a){if(!f.acceptedonly||a.is_accepted)i.push('<div class="heading answer-count">'+a.score+" votes"+(a.is_accepted?" - <span>Accepted</span>":"")+"</div>"+a.body)});g+=i.join('<div class="hr" />')}else g+='<p class="tip">There are currently no answers.</p>';d.html(g)})}b.fn.stacktack=function(a){var d=b.extend({},b.fn.stacktack.defaults,a),e={};this.each(function(){var a=b.extend({},d,h(this),{element:this});if("undefined"!=typeof a.id){var f=a.site.replace(/\.com$/,
+"");"undefined"==typeof e[f]&&(e[f]=[]);e[f].push(a)}});b.each(e,function(a,f){var e=[];b.each(f,function(a,b){e.push(b.id)});var h=b.unique(e).join(";");j(d,a,"/questions/"+h,{},function(a){m(f,a)},function(){})})};b.fn.stacktack.defaults={acceptedonly:!0,key:"CRspH1WAlZKCeCinkGOLHw((",filter:"!-)dQB3E8g_ab",secure:!1,site:"stackoverflow",tags:!0,width:600}})(jQuery)})();
View
5 stacktack.php
@@ -165,10 +165,15 @@ function stacktack_shortcode($atts)
function stacktack_enqueuescripts()
{
+ // Enqueue the scripts
wp_register_script('stacktack', plugins_url('js/stacktack.min.js', __FILE__), array('jquery'), false, true);
wp_register_script('stacktack_init', plugins_url('js/stacktack.init.js', __FILE__), array('jquery', 'stacktack'), false, true);
wp_enqueue_script('stacktack_init');
+
+ // Enqueue the stylesheet
+ wp_register_style('stacktack', plugins_url('css/stacktack.min.css', __FILE__));
+ wp_enqueue_style('stacktack');
}
// Enqueue the scripts
Please sign in to comment.
Something went wrong with that request. Please try again.