This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Displaying Modal to Enlarge Image | |
$$(document).on('click', '.enlarge-image', function () { | |
const newCommentBtn = document.querySelector('#new-comment'); | |
const modal = document.querySelector('#enlarge-image'); | |
const modalImage = document.querySelector('#modal-image'); | |
const span = document.getElementsByClassName('close')[0]; | |
newCommentBtn.classList.add('display'); | |
modal.style.display = "block"; | |
modalImage.src = this.src; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Display Text When There Is No Thread/Comment Added | |
const noContent = (title, text) => { | |
return ` | |
<div class="card-content card-content-padding"> | |
<div class="item-subtitle">${title}</div> | |
<p class="date" id="text">${text}</p> | |
</div> | |
`; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setting Up The Thread Details | |
const setUpThreadDetails = (id) => { | |
db.collection('threads') | |
.where(firebase.firestore.FieldPath.documentId(), "==", id) | |
.get() | |
.then((snapshot) => { | |
snapshot.docs.forEach((doc) => { | |
const thread = doc.data(); | |
document.getElementById("thread-title").innerText = thread.title; | |
document.getElementById("thread-description").innerText = thread.description; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.material-icons.md-18 { | |
font-size: 18px; | |
} | |
.size-18 { | |
font-size: 18px | |
} | |
.material-icons.md-15 { | |
font-size: 15px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const $$ = Dom7; | |
const app = new Framework7({ | |
root: '#app', // App Root Element | |
name: 'framework7-core-tab-view', // App Name | |
theme: 'auto', // Automatic Theme Detection | |
data: function () { | |
return { | |
// App Root Data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const threadsList = document.querySelector('.threads'); | |
const signedInLinks = document.querySelectorAll('.signed-in'); | |
const signedOutLinks = document.querySelectorAll('.signed-out'); | |
const setUpUI = (user) => { | |
if (user) { | |
// Toggle UI Elements | |
signedInLinks.forEach(item => item.style.display = 'inline'); | |
signedOutLinks.forEach(item => item.style.display = 'none'); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Display Thread/Comment Image | |
const displayImage = (folder, id, element, background) => { | |
const ref = firebase.storage().ref(folder); | |
const name = id + '.jpg'; | |
ref.child(name) | |
.getDownloadURL() | |
.then(url => { | |
(background) | |
? document.getElementById(element).style.backgroundImage = 'url(' + url + ')' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Delete Thread/Comment Image | |
const deleteImage = (folder, id) => { | |
const ref = firebase.storage().ref(folder).child(id + '.jpg'); | |
// Delete the file | |
ref.delete(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
return { | |
on: { | |
pageInit: function (e, page) { | |
const newCommentBtn = document.querySelector('#new-comment'); | |
// Toggle UI Element | |
auth.onAuthStateChanged(user => { | |
(user) | |
? newCommentBtn.classList.remove('display') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
return { | |
on: { | |
pageInit: function (e, page) { | |
signUp(); | |
} | |
} | |
} | |
</script> |