Skip to content
This repository has been archived by the owner on Aug 19, 2019. It is now read-only.

Commit

Permalink
Pindah domain
Browse files Browse the repository at this point in the history
Pindah dari sim.stts.edu ke old.sim.stts.edu
  • Loading branch information
Smankusors committed Jul 6, 2018
1 parent 1e6abff commit 2ad5df4
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 20 deletions.
9 changes: 6 additions & 3 deletions js/checkLogin.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
chrome.storage.local.get(['loggedOn','user', 'pass', 'disableMat'], function(data) {
$(document).ready(function(){
if ((data.loggedOn == true) && (!document.documentElement.innerHTML.includes("Selamat Datang,"))) {
$.post( "http://sim.stts.edu/cek_login.php", {user: data.user, pass: data.pass}, function(result){
if ((data.loggedOn) && (!document.documentElement.innerHTML.includes("Selamat Datang,"))) {
$.post( "https://old.sim.stts.edu/cek_login.php", {user: data.user, pass: data.pass}, function(result){
if (result == "<script>window.location='index.php'</script>") window.location.replace("index.php");
else {
chrome.storage.local.set({'loggedOn':false});
}
});
}
if (!data.disableMat) $('body').append('<script src="' + chrome.runtime.getURL('js/materialize.js') + '" />');
if (!data.disableMat) {
console.log("material!");
$('body').append('<script src="' + chrome.runtime.getURL('js/materialize.js') + '" />');
}
});
if (!data.disableMat) $('head').append('<link rel="stylesheet" type="text/css" href="' + chrome.runtime.getURL("css/materialize.css") + '" />');
});
2 changes: 1 addition & 1 deletion js/checkNews.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ chrome.alarms.create("Sman.CheckNews",{delayInMinutes:5,periodInMinutes:5});
chrome.alarms.onAlarm.addListener(function(alarm) {
if (alarm.name === "Sman.CheckNews") {
chrome.storage.local.get(['newsSIM','newsLab'], function(data) {
$.get("http://sim.stts.edu/pengumuman_data.php",function(result) {
$.get("https://old.sim.stts.edu/pengumuman_data.php",function(result) {
if (data.newsSIM != parsePengumumanSIM(result)) {
chrome.browserAction.setBadgeBackgroundColor({color:[102,0,0,255]});
chrome.browserAction.setBadgeText({text:"SIM"});
Expand Down
4 changes: 2 additions & 2 deletions js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ function doLogin() {
var userID = $('#user').val();
var userPass = $("#pass").val();
$('#login').fadeTo(200, 0);
$.post("http://sim.stts.edu/cek_login.php",{user:userID,pass:userPass},function(result){
$.post("https://old.sim.stts.edu/cek_login.php",{user:userID,pass:userPass},function(result){
if (result == "<script>window.location='index.php'</script>") {
$.get("http://sim.stts.edu/index.php", function(carinama){
$.get("https://old.sim.stts.edu/index.php", function(carinama){
var nama = parseNama(carinama);
chrome.storage.local.set({'user':userID,'pass':userPass,'loggedOn':true,'nama':nama});
$('html').fadeOut(100);
Expand Down
14 changes: 7 additions & 7 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var loggedOn = false, disableMat = false;
function bacaPengumumanSIM() {
$.get("http://sim.stts.edu/pengumuman_data.php", function(result) {
$.get("https://old.sim.stts.edu/pengumuman_data.php", function(result) {
if ($('#mNewsSIM').attr('class') == "selected") {
var parsed = parsePengumumanSIM(result);
$("#content").html(parsed);
Expand All @@ -10,7 +10,7 @@ function bacaPengumumanSIM() {
});
}
$('#logout').click(function (){
$.post("http://sim.stts.edu/logout.php",{},function(){
$.post("https://old.sim.stts.edu/logout.php",{},function(){
loggedOn = false;
chrome.storage.local.set({'loggedOn':false});
$(".logout").hide();
Expand Down Expand Up @@ -77,9 +77,9 @@ $("#mSched").click(function() {
$("#content").fadeIn(100);
}
});
$.get("http://sim.stts.edu/jadwal_kul.php", function(kul) {
$.get("http://sim.stts.edu/jadwal_ujian.php", function(ujian){
$.get("http://sim.stts.edu/jadwal_prakecc.php", function(prakecc){
$.get("https://old.sim.stts.edu/jadwal_kul.php", function(kul) {
$.get("https://old.sim.stts.edu/jadwal_ujian.php", function(ujian){
$.get("https://old.sim.stts.edu/jadwal_prakecc.php", function(prakecc){
if ($('#mSched').attr('class') == "selected") {
var hasil = parseJadwal(kul, ujian, prakecc);
$("#content").html(hasil);
Expand Down Expand Up @@ -121,9 +121,9 @@ chrome.storage.local.get(['newsSIM','loggedOn','user', 'pass', 'nama', 'disableM
loggedOn = true;
$(".login").hide();
if (data.nama) $("#nama").html(data.nama);
$.get( "http://sim.stts.edu/index.php", function(result){
$.get( "https://old.sim.stts.edu/index.php", function(result){
if (!result.includes("Selamat Datang,")) {
$.post( "http://sim.stts.edu/cek_login.php", { user: data.user, pass: data.pass }, function(result){
$.post( "https://old.sim.stts.edu/cek_login.php", { user: data.user, pass: data.pass }, function(result){
if (result != "<script>window.location='index.php'</script>") {
chrome.storage.local.set({'loggedOn':false});
loggedOn = false;
Expand Down
2 changes: 1 addition & 1 deletion js/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function parseNama(s) {
}
function parsePengumumanSIM(s) {
s = s.replace(/\/p>\r\n/g, '/p>').replace(/B\r\n.*<\/a/g, 'B</a');
s = s.replace(/<a href="#"(.*)<a href="(.+?)".*<\/a>/g, '<a href="http://sim.stts.edu/$2"$1');
s = s.replace(/<a href="#"(.*)<a href="(.+?)".*<\/a>/g, '<a href="https://old.sim.stts.edu/$2"$1');
return s.replace(/Ditambahkan oleh /g, '');
}
function parsePengumumanLab(s) {
Expand Down
2 changes: 1 addition & 1 deletion main.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" href="css/main.css" />
</head><body>
<div class="header">
<div class="title"><a href="http://sim.stts.edu" target="_blank"><img src="img/icon_white.png" style="width:16px; vertical-align: middle; margin-top: -2px;" /> Sistem Informasi Mahasiswa</a></div>
<div class="title"><a href="https://old.sim.stts.edu" target="_blank"><img src="img/icon_white.png" style="width:16px; vertical-align: middle; margin-top: -2px;" /> Sistem Informasi Mahasiswa</a></div>
<div class="right-title login"><a href="#" id="login">Log in</a></div>
<div class="right-title logout"><span id="nama"></span> | <a href="#" id="logout">Log out</a></div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"manifest_version": 2,
"name": "iSTTS Helper",
"description": "A browser extension to help iSTTS students with the provided information systems.",
"version": "0.5.96",
"version": "0.5.97",
"author": "Smankusors (Antony Kurniawan)",
"homepage_url": "http://sim.stts.edu",
"homepage_url": "https://old.sim.stts.edu",
"icons": {
"16" : "img/icon_16.png",
"24" : "img/icon_24.png",
Expand All @@ -25,7 +25,7 @@
"default_popup": "main.html"
},
"content_scripts": [{
"matches": ["http://sim.stts.edu/index.*","http://sim.stts.edu/","https://sim.stts.edu/index.*","https://sim.stts.edu/"],
"matches": ["http://old.sim.stts.edu/index.*","http://old.sim.stts.edu/","https://old.sim.stts.edu/index.*","https://old.sim.stts.edu/"],
"js": ["js/jquery.js","js/checkLogin.js"]
}],
"background": {
Expand All @@ -36,8 +36,8 @@
"activeTab",
"storage",
"alarms",
"http://sim.stts.edu/",
"https://sim.stts.edu/",
"http://old.sim.stts.edu/",
"https://old.sim.stts.edu/",
"http://lkomp.stts.edu/"
],
"web_accessible_resources": [
Expand Down
6 changes: 6 additions & 0 deletions options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html><head><title>Pengaturan iSTTSHelper</title></head>
<body>
<input type="checkbox" name="enableMat"> Materialize sim.stts.edu<br>
</body>
</html>

0 comments on commit 2ad5df4

Please sign in to comment.