nnmrts / badges Goto Github PK
View Code? Open in Web Editor NEWbadges for everyone
Home Page: http://pumpn.net/badges/
License: MIT License
badges for everyone
Home Page: http://pumpn.net/badges/
License: MIT License
self-explaining
self-explaining
when generating the embed code, i just have:
if (starbadge1 != "undefined") {
urlarray.push(starbadge1.firstChild.src.slice(0, starbadge1.firstChild.src.indexOf("500px")) + "170px.png");
}
if (starbadge2 != "undefined") {
urlarray.push(starbadge2.firstChild.src.slice(0, starbadge2.firstChild.src.indexOf("500px")) + "170px.png");
}
if (starbadge3 != "undefined") {
urlarray.push(starbadge3.firstChild.src.slice(0, starbadge3.firstChild.src.indexOf("500px")) + "170px.png");
}
if (rolebadge1 != "undefined") {
urlarray.push(rolebadge1.firstChild.src.slice(0, rolebadge1.firstChild.src.indexOf("500px")) + "170px.png");
}
if (verifiedartistbadge != "undefined") {
urlarray.push(verifiedartistbadge.firstChild.src.slice(0, verifiedartistbadge.firstChild.src.indexOf("500px")) + "170px.png");
}
adding rolebadge2 would fix it
also, I don’t think it words for duel users who are both med and ed, it’s only showing me as an editor
current code for chosing the role badge:
findrole_for_display = function() {
role_for_display = geniussource.responseJSON.response.user.role_for_display;
};
findroles_for_display = function() {
roles_for_display = geniussource.responseJSON.response.user.roles_for_display;
};
role2id = function(role) {
roleloop = function() {
if (role_for_display === null) {
badgeid = 0;
}
else {
if (is.startWith(role, 'co') === true) {
badgeid = 1;
}
else {
if (is.startWith(role, 'me') === true) {
badgeid = 2;
}
else {
if (is.startWith(role, 'ed') === true) {
badgeid = 3;
}
else {
if (is.startWith(role, 'mo') === true) {
badgeid = 4;
}
else {
if (is.startWith(role, 're') === true) {
badgeid = 5;
}
else {
if (is.startWith(role, 've') === true) {
role = roles_for_display[1];
roleloop();
}
}
}
}
}
}
}
};
roleloop();
};
rolebadgenamechooser = function(badgeid) {
badgenames = [{0: ""}, {1: "contributor"}, {2: "mediator"}, {3: "editor"}, {4: "moderator"}, {5: "staff"}];
badgename = badgenames[badgeid][badgeid];
};
rolebadgechooser = function(role, count) {
role2id(role);
rolebadgenamechooser(badgeid);
if (badgeid > 0) {
badgebox = document.createElement("div");
badgebox.setAttribute("class", "badgebox");
badgebox.setAttribute("id", "004-" + zeroFill(badgeid, 3) + badgename);
badge = document.createElement("img");
badge.setAttribute("src", "badges/004%20Role%20Badges/genius-004-" + zeroFill(badgeid, 3) + badgename + "500px.png?time=" + jQuery.now());
badge.setAttribute("class", "badge");
badgebox.appendChild(badge);
window["rolebadge" + count] = badgebox;
}
else {
window["rolebadge" + count] = "undefined";
}
};
rolebadgechooser(role_for_display, 1);
if (rolebadge1 !== "undefined") {
html_badgescontainer.appendChild(rolebadge1);
}
this is sick! but the stars won’t embed on my profile? or i guess that’s by design? anyway, great work!
current code for the embed code:
function htmlEntities(str) {
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
}
$(document).ready(function() {
$("#profile").click(function() {
if (userhere === 0) {}
else {
if (html_profile.innerHTML == "CLOSE THAT") {
$("#profiletext").animate({
opacity: 0
}, 500, function() {});
$("#generatedtext").animate({
opacity: 0
}, 500, function() {});
$("#profilebox").animate({
marginTop: 0,
marginBottom: 0,
height: 0
}, 1000, function() {
html_profile.innerHTML = "ADD THEM TO YOUR PROFILE";
});
}
else {
urlarray = [];
if (starbadge1 != "undefined") {
urlarray.push(starbadge1.firstChild.src.slice(0, starbadge1.firstChild.src.indexOf("500px")) + "170px.png");
}
if (starbadge2 != "undefined") {
urlarray.push(starbadge2.firstChild.src.slice(0, starbadge2.firstChild.src.indexOf("500px")) + "170px.png");
}
if (starbadge3 != "undefined") {
urlarray.push(starbadge3.firstChild.src.slice(0, starbadge3.firstChild.src.indexOf("500px")) + "170px.png");
}
if (rolebadge1 != "undefined") {
urlarray.push(rolebadge1.firstChild.src.slice(0, rolebadge1.firstChild.src.indexOf("500px")) + "170px.png");
}
if (verifiedartistbadge != "undefined") {
urlarray.push(verifiedartistbadge.firstChild.src.slice(0, verifiedartistbadge.firstChild.src.indexOf("500px")) + "170px.png");
}
realstart = "<table><tbody>";
littlestart = "<tr>";
itemstart = "<td><img src='";
itemend = "'></td>";
littleend = "</tr>";
realend = "</tbody></table>";
if (urlarray.length === 0) {
gentexthtml = "This user has no badges. :(";
}
if (urlarray.length == 1) {
gentexthtml = realstart + littlestart;
gentexthtml += itemstart + urlarray[0] + itemend;
gentexthtml += littleend + realend;
}
if (urlarray.length == 2) {
gentexthtml = realstart + littlestart;
gentexthtml += itemstart + urlarray[0] + itemend;
gentexthtml += itemstart + urlarray[1] + itemend;
gentexthtml += littleend + realend;
}
if (urlarray.length == 3) {
gentexthtml = realstart + littlestart;
gentexthtml += itemstart + urlarray[0] + itemend;
gentexthtml += itemstart + urlarray[1] + itemend;
gentexthtml += littleend;
gentexthtml += littlestart;
gentexthtml += itemstart + urlarray[2] + itemend;
gentexthtml += littleend + realend;
}
if (urlarray.length == 4) {
gentexthtml = realstart + littlestart;
gentexthtml += itemstart + urlarray[0] + itemend;
gentexthtml += itemstart + urlarray[1] + itemend;
gentexthtml += littleend;
gentexthtml += littlestart;
gentexthtml += itemstart + urlarray[2] + itemend;
gentexthtml += itemstart + urlarray[3] + itemend;
gentexthtml += littleend + realend;
}
if (urlarray.length == 5) {
gentexthtml = realstart + littlestart;
gentexthtml += itemstart + urlarray[0] + itemend;
gentexthtml += itemstart + urlarray[1] + itemend;
gentexthtml += littleend;
gentexthtml += littlestart;
gentexthtml += itemstart + urlarray[2] + itemend;
gentexthtml += itemstart + urlarray[3] + itemend;
gentexthtml += littleend;
gentexthtml += littlestart;
gentexthtml += itemstart + urlarray[4] + itemend;
gentexthtml += littleend + realend;
}
gentext = htmlEntities(gentexthtml);
html_generatedtext.innerHTML = gentext;
html_profiletext.innerHTML = "You are " + name + "? Just copy-paste this text to your profile bio:";
$("#profilebox").animate({
marginTop: "-41px",
marginBottom: "41px",
height: "200px"
}, 1000, function() {
$("#profiletext").animate({
opacity: 1
}, 500, function() {
// Animation complete.
});
$("#generatedtext").animate({
opacity: 1
}, 500, function() {});
html_profile.innerHTML = "CLOSE THAT";
});
}
}
});
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.