Commits

zamtools  committed 6527438

minified javascript

  • Participants
  • Parent commits ac64073

Comments (0)

Files changed (1)

File jquery.stacktack.min.js

-(function(a){a.fn.stacktack=function(d){var b=a.extend(a.fn.stacktack.defaults,d);var e=["width","onlyshowacceptedanswer","answerlimit","filteranswers","showtags"];if(b.stylesheet){if(a('link[href="'+b.stylesheet+'"]').length===0){if(document.createStyleSheet){document.createStyleSheet(b.stylesheet)}else{a('<link rel="stylesheet" type="text/css" href="'+b.stylesheet+'" />').appendTo("head")}}}function c(f){var g=(f.email_hash)?f.email_hash:"";return'<div class="stacktack-profile"><img src="http://www.gravatar.com/avatar/'+f.email_hash+'?d=identicon&s=32" class="stacktack-gravatar" /><a href="http://www.'+b.site+"/users/"+f.user_id+'" target="_blank">'+f.display_name+"</a><br/>"+f.reputation+"</div>"}return this.each(function(){var f=a(this);f.filter("[id^=stacktack], [class^=stacktack]").add(f.find("[id^=stacktack], [class^=stacktack]")).each(function(m,p){var q=a(p);var g="";if(p.id){var l=/\d+$/.exec(p.id);if(l.length>0){g=l[0]}}var s=a.extend({},b);if(q.attr("class").length){classes=q.attr("class").split(" ");for(var k=0;k<classes.length;k++){clas=classes[k];classTokens=clas.split("-");if(classTokens.length>1){if(classTokens[0].toLowerCase()=="stacktack"){g=classTokens[1];continue}for(var h=1;h<classTokens.length;h++){classToken=classTokens[h].toLowerCase();if(classToken==="true"||classToken==="false"){classTokens[h]==Boolean(classToken);continue}classTokens[h]=classToken.replace(/percent/i,"%")}if(a.inArray(classTokens[0].toLowerCase(),e)>-1){if(classTokens.length>2||classTokens[0].toLowerCase()=="filteranswers"){s[classTokens[0]]=classTokens.slice(1)}else{s[classTokens[0]]=classTokens[1]}}}}}var r=a('<div class="stacktack-container"></div>');if(s.width){r.css("width",s.width)}var o=a('<div class="stacktack-content"><a href="http://www.stacktack.com/" target="_blank" title="StackTack" class="stacktack-logo"><h2>StackTack</h2></a></div>');r.append(o);var n=a('<p class="stacktack-loading">Loading Question ID '+g+"</p>");o.append(n);a.ajax({dataType:"jsonp",data:{apikey:"kz4oNmbazUGoJIUyUbSaLg",answers:"true",body:"true"},url:"http://api."+b.site+"/"+b.apiVersion+"/questions/"+g+"?jsonp=?",success:function(A){n.remove();var w=A.questions[0];var y=a('<div class="stacktack-question"> <div class="stacktack-question-header clearfix">'+c(w.owner)+'<h3><a href="http://www.'+b.site+"/questions/"+w.question_id+'" target="_blank">'+w.title+'</a></h3><div class="stacktack-votes">'+w.score+' Votes</div></div><div class="stacktack-question-body">'+w.body+"</div></div>");o.append(y);if(s.showTags){var x=a('<ul class="stacktack-tags"></ul>');for(var B=0;B<w.tags.length;B++){var t=a("<li>"+w.tags[B]+"</li>");x.append(t)}y.append(x)}var z=a('<div class="stacktack-answers"></div>');o.append(z);var j=[];if(w.answers.length>0){if(s.onlyShowAcceptedAnswer){for(var B=0;B<w.answers.length;B++){if(w.answers[B].accepted){j.push(B)}}}else{if(s.filterAnswers.length>0){for(var B=0;B<w.answers.length;B++){if(a.inArray(w.answers[B].answer_id.toString(),s.filterAnswers)>-1){j.push(B)}}}else{if(s.answerLimit>0){for(var B=0;B<s.answerLimit;B++){j.push(B)}}}}}for(var B=0;B<w.answers.length;B++){var C=w.answers[B];var v=a('<div class="stacktack-answer"><div class="stacktack-answer-header clearfix">'+c(C.owner)+'<h4><a href="http://www.'+b.site+"/questions/"+w.question_id+"#"+C.answer_id+'" target="_blank">Answer '+(B+1)+'</a></h4><div class="stacktack-votes">'+C.score+' Votes</div></div><div class="stacktack-answer-body">'+C.body+"</div></div>");if(C.accepted){v.addClass("stacktack-answer-accepted");v.find(".stacktack-answer-header h4").prepend('<span alt="Accepted" title="Accepted" class="stacktack-answer-check"></span>');v.find(".stacktack-votes").append(" | Accepted")}if(j.length>0){if(a.inArray(B,j)==-1){v.hide()}}z.append(v)}r.find("a").attr("target","_blank");if(j.length>0){var u=a('<a href="#" class="stacktack-answers-more">+ More Answers</a>"');u.click(function(){a(this).hide();z.find(".stacktack-answer:hidden").slideDown("fast");return false});z.append(u)}}});q.append(r)})})};a.fn.stacktack.defaults={site:"stackoverflow.com",apiVersion:"1.0",stylesheet:"http://app.stacktack.com/stacktack.min.css",answerLimit:0,onlyShowAcceptedAnswer:false,filterAnswers:[],showTags:true,width:null}})(jQuery);
+(function(a){a.fn.stacktack=function(d){var b=a.extend(a.fn.stacktack.defaults,d);var e=["width","onlyshowacceptedanswer","answerlimit","filteranswers","showtags"];if(b.stylesheet){if(a('link[href="'+b.stylesheet+'"]').length===0){if(document.createStyleSheet){document.createStyleSheet(b.stylesheet)}else{a('<link rel="stylesheet" type="text/css" href="'+b.stylesheet+'" />').appendTo("head")}}}function c(f){var g=(f.email_hash)?f.email_hash:"";return'<div class="stacktack-profile"><img src="http://www.gravatar.com/avatar/'+g+'?d=identicon&s=32" class="stacktack-gravatar" /><a href="http://www.'+b.site+"/users/"+f.user_id+'" target="_blank">'+f.display_name+"</a><br/>"+f.reputation+"</div>"}return this.each(function(){var f=a(this);f.filter("[id^=stacktack], [class^=stacktack]").add(f.find("[id^=stacktack], [class^=stacktack]")).each(function(m,p){var q=a(p);var g="";if(p.id){var l=/\d+$/.exec(p.id);if(l.length>0){g=l[0]}}var s=a.extend({},b);if(q.attr("class").length){classes=q.attr("class").split(" ");for(var k=0;k<classes.length;k++){clas=classes[k];classTokens=clas.split("-");if(classTokens.length>1){if(classTokens[0].toLowerCase()=="stacktack"){g=classTokens[1];continue}for(var h=1;h<classTokens.length;h++){classToken=classTokens[h].toLowerCase();if(classToken==="true"||classToken==="false"){classTokens[h]==Boolean(classToken);continue}classTokens[h]=classToken.replace(/percent/i,"%")}if(a.inArray(classTokens[0].toLowerCase(),e)>-1){if(classTokens.length>2||classTokens[0].toLowerCase()=="filteranswers"){s[classTokens[0]]=classTokens.slice(1)}else{s[classTokens[0]]=classTokens[1]}}}}}var r=a('<div class="stacktack-container"></div>');if(s.width){r.css("width",s.width)}var o=a('<div class="stacktack-content"><a href="http://www.stacktack.com/" target="_blank" title="StackTack" class="stacktack-logo"><h2>StackTack</h2></a></div>');r.append(o);var n=a('<p class="stacktack-loading">Loading Question ID '+g+"</p>");o.append(n);a.ajax({dataType:"jsonp",data:{apikey:"kz4oNmbazUGoJIUyUbSaLg",answers:"true",body:"true"},url:"http://api."+b.site+"/"+b.apiVersion+"/questions/"+g+"?jsonp=?",success:function(A){n.remove();var w=A.questions[0];var y=a('<div class="stacktack-question"> <div class="stacktack-question-header clearfix">'+c(w.owner)+'<h3><a href="http://www.'+b.site+"/questions/"+w.question_id+'" target="_blank">'+w.title+'</a></h3><div class="stacktack-votes">'+w.score+' Votes</div></div><div class="stacktack-question-body">'+w.body+"</div></div>");o.append(y);if(s.showTags){var x=a('<ul class="stacktack-tags"></ul>');for(var B=0;B<w.tags.length;B++){var t=a("<li>"+w.tags[B]+"</li>");x.append(t)}y.append(x)}var z=a('<div class="stacktack-answers"></div>');o.append(z);var j=[];if(w.answers.length>0){if(s.onlyShowAcceptedAnswer){for(var B=0;B<w.answers.length;B++){if(w.answers[B].accepted){j.push(B)}}}else{if(s.filterAnswers.length>0){for(var B=0;B<w.answers.length;B++){if(a.inArray(w.answers[B].answer_id.toString(),s.filterAnswers)>-1){j.push(B)}}}else{if(s.answerLimit>0){for(var B=0;B<s.answerLimit;B++){j.push(B)}}}}}for(var B=0;B<w.answers.length;B++){var C=w.answers[B];var v=a('<div class="stacktack-answer"><div class="stacktack-answer-header clearfix">'+c(C.owner)+'<h4><a href="http://www.'+b.site+"/questions/"+w.question_id+"#"+C.answer_id+'" target="_blank">Answer '+(B+1)+'</a></h4><div class="stacktack-votes">'+C.score+' Votes</div></div><div class="stacktack-answer-body">'+C.body+"</div></div>");if(C.accepted){v.addClass("stacktack-answer-accepted");v.find(".stacktack-answer-header h4").prepend('<span alt="Accepted" title="Accepted" class="stacktack-answer-check"></span>');v.find(".stacktack-votes").append(" | Accepted")}if(j.length>0){if(a.inArray(B,j)==-1){v.hide()}}z.append(v)}r.find("a").attr("target","_blank");if(j.length>0){var u=a('<a href="#" class="stacktack-answers-more">+ More Answers</a>"');u.click(function(){a(this).hide();z.find(".stacktack-answer:hidden").slideDown("fast");return false});z.append(u)}}});q.append(r)})})};a.fn.stacktack.defaults={site:"stackoverflow.com",apiVersion:"1.0",stylesheet:"http://app.stacktack.com/stacktack.min.css",answerLimit:0,onlyShowAcceptedAnswer:false,filterAnswers:[],showTags:true,width:null}})(jQuery);