VueJS Stack Overflow Feed

Developer
Size
2,784 Kb
Views
18,216

How do I make an vuejs stack overflow feed?

What is a vuejs stack overflow feed? How do you make a vuejs stack overflow feed? This script and codes were developed by AppleCrazy on 23 September 2022, Friday.

VueJS Stack Overflow Feed Previews

VueJS Stack Overflow Feed - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>VueJS Stack Overflow Feed</title> <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Roboto:400,500'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Stack Overflow: Latest Questions</h1>
<h4>A live feed of Stack Overflow, powered by Vue.js.</h4>
<div id="app"> <input type="range" min="1000" max="60000" step="1000" v-model="delay" @input="updateDelay" id="delayR" /> <h5>Refreshes every {{ delay / 1000 }} seconds. Displaying {{ newQuestions.length }} new questions. <br /><br /><button onclick="stackScape.getQuestions()">Refresh Now</button></h5> <div v-for="question in newQuestions" class="q"> <h2><a v-bind:href="question.link" target="new">{{ question.title }}</a></h2> <p><strong>{{ question.votes | pluralify-votes }}</strong> &mdash; posted {{ question.asktime }} &mdash; {{ question.answers | pluralify-answers }}</p> <p>{{ question.blurb }}</p> </div>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.1/vue.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

VueJS Stack Overflow Feed - Script Codes CSS Codes

body { font-family: Roboto, Helvetica, Arial, sans-serif;
}
h1 { text-align: center;
}
h2 a { text-decoration: none; color: #2962FF;
}
h4, h5 { text-align: center;
}
input[type=range] { width: 50vw; margin-left: 25vw;
}

VueJS Stack Overflow Feed - Script Codes JS Codes

Vue.filter('pluralify', function (val) { if (Math.abs(val) == 1) { return val + " vote"; } else { return val + " votes"; }
});
Vue.filter('pluralify-answers', function (val) { if (val == 1) { return val + " answer"; } else { return val + " answers"; }
});
var app = new Vue({ el: '#app', data: { newQuestions: [], delay: 30000 }
});
function updateDelay() { app.delay = $('#delayR').val(); //console.log(app.delay); window.clearInterval(interval); interval = window.setInterval(stackScape.getQuestions, app.delay);
}
var stackScape = { getQuestions: function() { // console.log("Loading page..."); $.get("https://cors-anywhere.herokuapp.com/http://stackoverflow.com/questions?pagesize=50&sort=newest") .done(function(data) { var questions = $.makeArray($(data).find("div.question-summary")); var questionData = []; questions.forEach(function(el) { el = $(el); questionData.push({ votes: parseInt(el.find('span.vote-count-post')[0].innerText), answers: parseInt(el.find('div.status > strong')[0].innerText.replace(/\s+/g, " ")), title: el.find('a.question-hyperlink')[0].innerText, link: "https://stackoverflow.com/questions/" + el.find('a.question-hyperlink')[0].href.split('/questions/')[1], blurb: el.find('div.excerpt')[0].innerText.replace(/\s+/g, " "), asktime: el.find('span.relativetime')[0].innerText.replace(/\s+/g, " ") }); }); stackScape.displayResults(questionData); }); }, displayResults: function(data) { // console.log("Processed data."); app.newQuestions = data; }
};
stackScape.getQuestions();
var interval = window.setInterval(stackScape.getQuestions, app.delay);
VueJS Stack Overflow Feed - Script Codes
VueJS Stack Overflow Feed - Script Codes
Home Page Home
Developer AppleCrazy
Username applecrazy
Uploaded September 23, 2022
Rating 3
Size 2,784 Kb
Views 18,216
Do you need developer help for VueJS Stack Overflow Feed?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

AppleCrazy (applecrazy) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!