';
html += '
';
html += preview;
html += '';
var broadcast_title = "Broadcast";
if (b.title != "" && b.title != undefined) {
broadcast_title = check_plain(b.title);
} else {
broadcast_title += " by " + check_plain(b.username);
show_owner = false;
}
html += '
'; /* end of broadcast-information */
html += '
';
return '
' + html + '';
}
}
$(document).ready(function() {
$("#archive-canvas").on('click', ".load-more", function() {
var $target = $("#broadcast-list");
b_archive.load_broadcasts($target);
});
$('#archive-canvas').on({
mouseenter: function() {
$(this).parent().addClass('hover');
$(this).parent().find(".m-play-icon").css("visibility", "visible");
},
mouseout: function() {
$(this).parent().removeClass('hover');
$(this).parent().find(".m-play-icon").css("visibility", "hidden");
}
}, '.preview > img');
// Load broadcasts.
b_archive.init();
});
Share clip
Embed this broadcast
';
form += '';
// Alter message.
follow_message += "type in your e-mail address below.";
$("#follow-form").html(form);
$("#follow-message").html(follow_message);
// Focus manager
$('#follow-input-field').focus(function() {
if ($(this).val() == placeholder) {
$(this).val("");
}
});
$('#follow-input-field').blur(function() {
if ($(this).val() == "") {
$(this).val(placeholder);
}
});
},
follow: function ($target) {
if ($target == undefined) {
$target = $("#follow-status");
}
$target.find("#follow-alert").hide();
var params = new Object();
var button = $target.find("#follow-button");
var action = button.attr("title");
var api_action = "subscribe";
var username = "Inkwellarts";
var follower_mail = $("#follow-input-field").val();
if (follower_mail != undefined) {
params.follower_mail = follower_mail;
}
if (action == "unfollow") {
api_action = "unsubscribe";
if (!confirm("Do you really want to stop following " + username + "?")) {
return false;
}
}
button.fadeTo("slow", 0.33);
var site_url = $("#site-url").attr("title");
// Handle follow request.
b_api("follower/" + encodeURIComponent(username) + "/" + api_action, params,
function(response) {
if (api_action == "subscribe") {
var message = 'You are now following
' + check_plain(username) + '.';
// If user followed by entering a mail address unfollow action is not possible.
if (follower_mail === undefined) {
button.attr("title", "unfollow");
button.attr("class", "red-button b-button-mid");
button.find("a").text('Unfollow');
$target.find("#follow-message").html(message);
$("#follow > .header").html("Unfollow " + check_plain(username));
} else {
message += " Notifications will be sent to " + check_plain(follower_mail);
$target.find("#follow-alert").css("color", "green");
$target.find("#follow-alert").html(message);
$target.find("#follow-alert").show();
}
} else {
$("#follow > .header").html("Follow " + check_plain(username));
button.attr("title", "follow");
button.attr("class", "green-button b-button-mid");
button.find("a").text('Follow');
$target.find("#follow-message").html('You stopped following
' + check_plain(username) + '. We will not send you updates from this account anymore.');
}
},
function(error_response) {
$target.find("#follow-alert").css("color", "red");
$target.find("#follow-alert").show();
if (error_response.data.error.message) {
$target.find("#follow-alert").html(error_response.data.error.message);
} else {
$target.find("#follow-alert").html("Your " + action + " request could not be performed. Please try again later.");
}
}
);
button.fadeTo("fast", 1);
return false;
}
}
$(document).ready(function() {
b_follow.init();
$("#follow-canvas #follow-button").click(function(e) {
var $target = $("#follow-status");
b_follow.follow($target);
});
$('#follow-input-field').on('keydown', function(event) {
if (event.which == 13) { // Enter
event.preventDefault();
var $target = $("#follow-status");
b_follow.follow($target);
}
});
});