mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added button for generating channelname in frontpage
This commit is contained in:
@@ -17,6 +17,17 @@ function remove_from_array(array, element){
|
||||
}
|
||||
}
|
||||
|
||||
function generate_channel_name(res) {
|
||||
var trying_id = uniqid.time().toLowerCase();
|
||||
db.collection("frontpage_lists").find({frontpage: {$exists: true }, "_id": trying_id }, {"_id": 1}, function(err, docs){
|
||||
if(docs.length == 0) {
|
||||
res.send(trying_id);
|
||||
return;
|
||||
}
|
||||
generate_channel_name(res);
|
||||
});
|
||||
}
|
||||
|
||||
function get_short_id(socket) {
|
||||
var new_short_id = uniqid.time().toLowerCase();
|
||||
|
||||
@@ -125,6 +136,7 @@ function hash_pass(adminpass) {
|
||||
return crypto.createHash('sha256').update(adminpass).digest('base64');
|
||||
}
|
||||
|
||||
module.exports.generate_channel_name = generate_channel_name;
|
||||
module.exports.remove_unique_id = remove_unique_id;
|
||||
module.exports.remove_name_from_db = remove_name_from_db;
|
||||
module.exports.remove_from_array = remove_from_array;
|
||||
|
||||
@@ -466,6 +466,15 @@ li.disabled span {
|
||||
/*transition: 1s;*/
|
||||
}
|
||||
|
||||
.generate-channel-name {
|
||||
margin-left: -24px;
|
||||
padding-right: 5px;
|
||||
height: 46px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#frontpage_player{
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
|
||||
@@ -303,6 +303,7 @@ var Frontpage = {
|
||||
$("#main-container").css("background-color", "#2d2d2d");
|
||||
if(!Helper.mobilecheck()) {
|
||||
$("#frontpage-viewer-counter").tooltip("remove");
|
||||
$(".generate-channel-name").tooltip("remove");
|
||||
$("#offline-mode").tooltip("remove");
|
||||
}
|
||||
currently_showing_channels = 1;
|
||||
@@ -437,6 +438,11 @@ var Frontpage = {
|
||||
position: "bottom",
|
||||
tooltip: "Total Viewers"
|
||||
});
|
||||
$(".generate-channel-name").tooltip({
|
||||
delay: 5,
|
||||
position: "bottom",
|
||||
tooltip: "Generate name"
|
||||
});
|
||||
}
|
||||
Frontpage.get_frontpage_lists();
|
||||
|
||||
|
||||
@@ -1139,6 +1139,18 @@ $(document).on("click", "#player_bottom_overlay", function(e){
|
||||
Frontpage.to_channel(chan.toLowerCase(), false);
|
||||
});
|
||||
|
||||
$(document).on("click", ".generate-channel-name", function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api/generate_name",
|
||||
success: function(response) {
|
||||
$(".room_namer").val("");
|
||||
$(".room-namer").val(response);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(document).keydown(function(event) {
|
||||
if(window.location.pathname != "/"){
|
||||
if(event.keyCode == 91 || event.keyCode == 17){
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
spellcheck="false"
|
||||
maxlength="18"
|
||||
/>
|
||||
<a href="#" class="generate-channel-name white-text">
|
||||
<i class="material-icons">autorenew</i>
|
||||
</a>
|
||||
<label for="autocomplete-input" class="noselect label-for-mobile-frontpage">Find or create radio channel</label>
|
||||
<button class="listen-button btn waves-effect waves-light white-text col s2">Listen</button>
|
||||
</div>
|
||||
|
||||
@@ -15,6 +15,10 @@ router.route('/api/frontpages').get(function(req, res) {
|
||||
});
|
||||
});
|
||||
|
||||
router.route('/api/generate_name').get(function(req, res) {
|
||||
Functions.generate_channel_name(res);
|
||||
});
|
||||
|
||||
router.route('/api/list/:channel_name').get(function(req, res) {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
||||
|
||||
Reference in New Issue
Block a user