Fakultas Ilmu Komputer UI

Commit 0d277118 authored by wajdifarid's avatar wajdifarid
Browse files

Add dynamic popup.html feature based on content script

parent 1344f04e
......@@ -4,7 +4,7 @@ chrome.runtime.onInstalled.addListener(function() {
// With a new rule ...
chrome.declarativeContent.onPageChanged.addRules([
{
// That fires when a page's URL contains a 'g' ...
// That fires when a page's URL contains a 'scele' ...
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: { urlContains: 'scele' },
......@@ -15,4 +15,4 @@ chrome.runtime.onInstalled.addListener(function() {
}
]);
});
});
\ No newline at end of file
});
......@@ -37,3 +37,9 @@ for (var key in coursePerSemester) {
}
var courseFooter = myCoursesDiv.getElementsByClassName("footer")[0];
myCoursesContent.insertBefore(newCourseList, courseFooter);
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
sendResponse({
message: "Ini pesan dari content script untuk popup"
});
});
......@@ -9,3 +9,11 @@ function toggleIcon(e) {
}
$('.panel-group').on('hidden.bs.collapse', toggleIcon);
$('.panel-group').on('shown.bs.collapse', toggleIcon);
// Tell content script that our pop up is ready
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {message: "ready"}, function(response) {
// update popup.html
document.getElementById("cetakSini").innerHTML = response.message
});
});
......@@ -56,5 +56,7 @@
<script src="js/jquery-3.3.1.slim.min.js"></script>
<script src="js/popper.min.js" ></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/popup.js"></script>
<h1 id="cetakSini"></h1>
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment