We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
  • 3
removed
Topic Started: Feb 22 2014, 11:27 PM (5,556 Views)
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
removed
Edited by Ferby, Sep 13 2017, 06:33 AM.
Offline Profile Quote Post Goto Top
 
Replies:
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
You have used an apostrophe in your Award's name which is causing the script not to work. I tried to find a way around it but the system doesn't like it (even when I place a backwards slash before it). Remove the apostrophe and it'll work.
Offline Profile Quote Post Goto Top
 
Kankuro
Member Avatar
かんくろ
[ *  *  *  *  * ]
Ferby
Mar 8 2014, 08:12 PM
You have used an apostrophe in your Award's name which is causing the script not to work. I tried to find a way around it but the system doesn't like it (even when I place a backwards slash before it). Remove the apostrophe and it'll work.
Oh, I feel dumb now...
Could you add that name hover back though?
Edited by Kankuro, Mar 8 2014, 08:25 PM.
Offline Profile Quote Post Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
Code:
 
<script type="text/javascript">
function addBadge(uid, name, desc, image, date) {
var sysName = "Badges",
maxHeight = "40px";
if ($('dl.user_info:nth-of-type(1) dd[name="badge-' + uid + '"]').length === 0) {
if ((location.href.indexOf('/topic/') || location.href.indexOf('/single/')) !== -1) {
$("td.c_username a[href*=/" + uid + "/]").parent().parent().next().find('dl.user_info:nth-of-type(1)').append("<dt>" + sysName + ":</dt><dd name='badge-" + uid + "' style='max-height:" + maxHeight + "; overflow:auto;'></dd>");
} else if (location.href.indexOf('/profile/' + uid) !== -1) {
$('dl.user_info:nth-of-type(1)').append("<dt>" + sysName + ":</dt><dd name='badge-" + uid + "' style='max-height:" + maxHeight + "; overflow:auto;'></dd>");
}
}
$("dl.user_info dd[name=badge-" + uid + "]").prepend("<a href='#' onmousedown=\"badgePopup('" + name + "','" + desc + "','" + image + "','" + date + "')\" title='"+name+"'><img src='" + image + "' alt='Badge' style='height:20px;width:20px' /></a>");
}
function badgePopup(n, d, img, da) {
$("body").append("<div class='FpopupBG'><div class='Fpopup'><table><tr><th colspan='2' style='text-align:center'>" + n + "</th></tr><tr><td colspan='2' style='text-align:center'><img src='" + img + "' style='max-height:200px;max-width:200px' /></td></tr><tr><td>Name:</td><td>" + n + "</td></tr><tr><td>Description:</td><td>" + d + "</td></tr><tr><td>Date:</td><td>" + da + "</td></tr><tr><td colspan='2' style='text-align:center;'><a href='#' onmousedown='closeBadgePopup()'>Close</a></td></tr></table></div></div>");
}
function closeBadgePopup() {
$(".FpopupBG, .Fpopup").remove();
}
</script>


<script type="text/javascript">
addBadge(3793724,"Award's Name Here","Description Goes Here","http://z5.ifrm.com/30294/18/0/f5260827/Nav.png","0/0/00");
</script>
Edited by Ferby, Mar 8 2014, 09:23 PM.
Offline Profile Quote Post Goto Top
 
Kankuro
Member Avatar
かんくろ
[ *  *  *  *  * ]
Ferby
Mar 8 2014, 09:23 PM
Code:
 
<script type="text/javascript">
function addBadge(uid, name, desc, image, date) {
var sysName = "Badges",
maxHeight = "40px";
if ($('dl.user_info:nth-of-type(1) dd[name="badge-' + uid + '"]').length === 0) {
if ((location.href.indexOf('/topic/') || location.href.indexOf('/single/')) !== -1) {
$("td.c_username a[href*=/" + uid + "/]").parent().parent().next().find('dl.user_info:nth-of-type(1)').append("<dt>" + sysName + ":</dt><dd name='badge-" + uid + "' style='max-height:" + maxHeight + "; overflow:auto;'></dd>");
} else if (location.href.indexOf('/profile/' + uid) !== -1) {
$('dl.user_info:nth-of-type(1)').append("<dt>" + sysName + ":</dt><dd name='badge-" + uid + "' style='max-height:" + maxHeight + "; overflow:auto;'></dd>");
}
}
$("dl.user_info dd[name=badge-" + uid + "]").prepend("<a href='#' onmousedown=\"badgePopup('" + name + "','" + desc + "','" + image + "','" + date + "')\" title='"+name+"'><img src='" + image + "' alt='Badge' style='height:20px;width:20px' /></a>");
}
function badgePopup(n, d, img, da) {
$("body").append("<div class='FpopupBG'><div class='Fpopup'><table><tr><th colspan='2' style='text-align:center'>" + n + "</th></tr><tr><td colspan='2' style='text-align:center'><img src='" + img + "' style='max-height:200px;max-width:200px' /></td></tr><tr><td>Name:</td><td>" + n + "</td></tr><tr><td>Description:</td><td>" + d + "</td></tr><tr><td>Date:</td><td>" + da + "</td></tr><tr><td colspan='2' style='text-align:center;'><a href='#' onmousedown='closeBadgePopup()'>Close</a></td></tr></table></div></div>");
}
function closeBadgePopup() {
$(".FpopupBG, .Fpopup").remove();
}
</script>


<script type="text/javascript">
addBadge(3793724,"Award's Name Here","Description Goes Here","http://z5.ifrm.com/30294/18/0/f5260827/Nav.png","0/0/00");
</script>
Why thank you kind sir :)

Offline Profile Quote Post Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
You're more than welcome :)
Offline Profile Quote Post Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
I have updated the original code to use the most latest version and an easier installation process :)
Offline Profile Quote Post Goto Top
 
Kankuro
Member Avatar
かんくろ
[ *  *  *  *  * ]
Ferby
Mar 26 2014, 06:46 PM
I have updated the original code to use the most latest version and an easier installation process :)
You're supposed to be on leave mister :oy:

Nice update. I can't use it for mine though since mine has been modified to have 2 "badge areas"
Offline Profile Quote Post Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
kankuro865
Mar 26 2014, 06:50 PM
You're supposed to be on leave mister :oy:
I am and it's helping :D Coding is a hobby of mine which I do to unwind and get my brain thinking. I love keeping my hands busy.
Offline Profile Quote Post Goto Top
 
KhaosKarma
Member Avatar
Member
[ *  * ]
Its not working. I removed the apostrophes, still doesn't work.

Code:
 
<script type="text/javascript">
$(function() {
var system_name = "Badges";
$.getScript("http://z1.ifrm.com/0/1/0/p409922/badgeSystem_latest.js");
//
addBadge(5, Overseer, Member is a current or former administrator, http://i.imgur.com/EO02Y9P.png, 31/03/14);
});
</script>


Nothing shows up. Its like I made no change to the board template.

On another note, adding a preview (showing us what the code looks like in action) would be beneficial.
Edited by KhaosKarma, Mar 31 2014, 08:43 PM.
Offline Profile Quote Post Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
Sorry about the preview, I must've forgot to add it back when I rewrote the topic :)

As for your code, you removed the quotation marks, not the apostrophes.
Code:
 
<script type="text/javascript">
$(function() {
var system_name = "Badges";
$.getScript("http://z1.ifrm.com/0/1/0/p409922/badgeSystem_latest.js");
//
addBadge(5, "Overseer", "Member is a current or former administrator", "http://i.imgur.com/EO02Y9P.png", "31/03/14");
});
</script>


I've also noticed you're using the member number instead of the member ID. Refer to this if you need help with getting a member's ID.

Ferby
Feb 22 2014, 11:27 PM

uid: This is the user id of who you want to give the badge to. It can be found on their profile page URL like so: http://thenerddomain.com/profile/3714108/ - Those last few digits (3714108) are their user id.

Update: There appears to be an error in the code which stops it from functioning. I apologise for this, I'll get right onto fixing it :)
Update: I've updated the original code to fix the issue. I've also included a feature which will notify admins of your forum (staff with ACP access) of any updates to the system that you may want to install. Sorry if the code downtime affected you. Users who have installed the old code should have a notice on their boards asking them to install the new version :)
Edited by Ferby, Apr 2 2014, 06:44 PM.
Offline Profile Quote Post Goto Top
 
wodrum
Member Avatar
Member
[ * ]
Nevermind fixed my own problem.

Great code by the way.
Edited by wodrum, Jun 12 2014, 09:48 PM.
Offline Profile Quote Post Goto Top
 
RockingRitu
Member Avatar
Member
[ *  * ]
Quote:
 
image: This is the image URL of the actual badge. I recommend uploading the image to your forum rather than a third party image provider such as Imgur. That way if Imgur goes through maintenance, your board won't be affected.


how to upload it form my forum?
Offline Profile Quote Post Goto Top
 
Joe Bobs
Member
[ * ]
Hi Ferby,

Just want to say thankyou for this great piece of code, I'm using it on a forum to great effect, everyone is loving it.

One question, I'm potentially going to be adding hundreds of badges as each player (around 50) could be having 20 or so each, and I'm thinking this is going to leave a long script in the Bottom of the Board and may max out. Is there a way to host the script on a webpage on the board so I can host the list of addbadges there?

Thankyou.
Offline Profile Quote Post Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Joe Bobs
Jul 22 2014, 01:11 PM
Hi Ferby,

Just want to say thankyou for this great piece of code, I'm using it on a forum to great effect, everyone is loving it.

One question, I'm potentially going to be adding hundreds of badges as each player (around 50) could be having 20 or so each, and I'm thinking this is going to leave a long script in the Bottom of the Board and may max out. Is there a way to host the script on a webpage on the board so I can host the list of addbadges there?

Thankyou.
Hey Joe. To host a code you can take the contents from <script> to </script>, non-inclusive, place it in Notepad (or on Mac, TextEdit), and then save it as .js file (just add the .js ending in). After that, upload the file to a topic on your board (usually I upload to a staff-only forum). To use the code, the format is as follows:
Code:
 
<script type="text/javascript" src="URL_OF_HOSTED_CODE"></script>
Where URL_OF_HOSTED_CODE is replaced accordingly.
Offline Profile Quote Post Goto Top
 
Joe Bobs
Member
[ * ]
Great, thankyou for the help!
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply
  • Pages:
  • 1
  • 3