Skip to content

Commit

Permalink
feat: Chrome Extension에도 v1.2.0 기능 지원
Browse files Browse the repository at this point in the history
  • Loading branch information
chhs2131 committed Feb 6, 2024
1 parent 6b87137 commit 7d8e841
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 136 deletions.
33 changes: 33 additions & 0 deletions chrome/html/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
document.addEventListener('DOMContentLoaded', function() {
let dropdownLinks = document.querySelectorAll('.dropdown-content a.shortcutHref');
let dropbtn = document.querySelector('.dropbtn .dropbtn_icon');

dropdownLinks.forEach((link) => {
link.addEventListener('click', function(event) {
let linkData = {
'href': this.getAttribute('href'),
'text': this.innerText
};

chrome.storage.sync.set({'selectedLink': linkData}, function() {
console.log('Link data is set to ' + JSON.stringify(linkData));
dropbtn.innerText = linkData.text;
});
});
});

document.querySelector('.dropbtn').addEventListener('click', function(event) {
event.preventDefault();
chrome.storage.sync.get(['selectedLink'], function(result) {
if(result.selectedLink) {
window.open(result.selectedLink.href, '_blank');
}
});
});

chrome.storage.sync.get(['selectedLink'], function(result) {
if(result.selectedLink) {
dropbtn.innerText = result.selectedLink.text;
}
});
});
274 changes: 139 additions & 135 deletions chrome/html/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,157 +1,161 @@
<!DOCTYPE html>
<html lang="kr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="sidebar.css">
<script type="text/javascript" src="sidebar.js"></script>
</head>
<body>
<div id="header">
<div>
<img src="/resource/img/duck_logo.png">
<span><b>인덕이가 안내해!</b></span>
</div>
<!--
"현재 별도의 설정사항 없음"
<div>
<img src="/resource/img/setting.png">
</div>
-->
</div>
<!--
"상단 네비게이션 메뉴 현재는 사용하지 않음"
<nav id="topMenu">
<ul>
<li><a class="menuLink" href="#">홈</a></li>
<li><a class="menuLink" href="#">i-class</a></li>
<li><a class="menuLink" href="#">MAIL</a></li>
</ul>
</nav>
-->
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="sidebar.css">
</head>
<body>
<div id="header">
<div>
<img src="/resource/img/duck_logo.png">
<span><b>인덕이가 안내해!</b></span>
</div>
<!--
"현재 별도의 설정사항 없음"
<div>
<img src="/resource/img/setting.png">
</div>
-->
</div>
<!--
"상단 네비게이션 메뉴 현재는 사용하지 않음"
<nav id="topMenu">
<ul>
<li><a class="menuLink" href="#">홈</a></li>
<li><a class="menuLink" href="#">i-class</a></li>
<li><a class="menuLink" href="#">MAIL</a></li>
</ul>
</nav>
-->

<!-- 바로가기 메뉴 표시 : 홈페이지, iclass, 메일, 수강신청 성적조회 등록금조회 학사일정 에브리타임 토론마당-->
<!-- 바로가기 메뉴 표시 : 홈페이지, iclass, 메일, 수강신청 성적조회 등록금조회 학사일정 에브리타임 토론마당-->

<div>
<div class="dropdown">
<button class="dropbtn">
<span class="dropbtn_icon"> 각 단과대 바로가기</span>
<span></span>
</button>
<div class="dropdown-content">
<a target="_blank" href="https://cba.inha.ac.kr/">경영대학</a>
<a target="_blank" href="https://engcollege.inha.ac.kr/engcollege/index.do">공과대학</a>
<a target="_blank" href="https://sgcs.inha.ac.kr/">국제학부</a>
<a target="_blank" href="https://hacollege.inha.ac.kr/">문과대학</a>
<a target="_blank" href="https://fccollege.inha.ac.kr/">미래융합대학</a>
<a target="_blank" href="https://edcollege.inha.ac.kr/">사범대학</a>
<a target="_blank" href="https://sscollege.inha.ac.kr/">사회과학대학</a>
<a target="_blank" href="https://act.inha.ac.kr/">소프트웨어융합대학</a>
<a target="_blank" href="https://artsports.inha.ac.kr/">예술체육대학</a>
<a target="_blank" href="https://medicine.inha.ac.kr/">의과대학</a>
<a target="_blank" href="https://nscollege.inha.ac.kr/">자연과학대학</a>
<a target="_blank" href="https://generaledu.inha.ac.kr/generaledu/index.do">프런티어학부대학</a>
</div>
</div>
<div>
<div class="dropdown">
<button class="dropbtn">
<span class="dropbtn_icon"> 각 단과대 바로가기</span>
<span></span>
</button>
<div class="dropdown-content">
<a class="shortcutHref" target="_blank" href="https://cba.inha.ac.kr/">경영대학</a>
<a class="shortcutHref" target="_blank" href="https://engcollege.inha.ac.kr/">공과대학</a>
<a class="shortcutHref" target="_blank" href="https://sgcs.inha.ac.kr/">국제학부</a>
<a class="shortcutHref" target="_blank" href="https://hacollege.inha.ac.kr/">문과대학</a>
<a class="shortcutHref" target="_blank" href="https://fccollege.inha.ac.kr/">미래융합대학</a>
<a class="shortcutHref" target="_blank" href="https://edcollege.inha.ac.kr/">사범대학</a>
<a class="shortcutHref" target="_blank" href="https://sscollege.inha.ac.kr/">사회과학대학</a>
<a class="shortcutHref" target="_blank" href="https://swcc.inha.ac.kr/">소프트웨어융합대학</a>
<a class="shortcutHref" target="_blank" href="https://artsports.inha.ac.kr/">예술체육대학</a>
<a class="shortcutHref" target="_blank" href="https://medicine.inha.ac.kr/">의과대학</a>
<a class="shortcutHref" target="_blank" href="https://nscollege.inha.ac.kr/">자연과학대학</a>
<a class="shortcutHref" target="_blank" href="https://generaledu.inha.ac.kr/generaledu/index.do">프런티어학부대학</a>
<a class="shortcutHref" target="_blank" href="https://www.inha.ac.kr/kr/1000/subview.do">대학원 전체</a>
</div>
</div>
</div>


<div class="link_container">
<div class="link_button" id="l_iclass">
<img class="link_img" src="/resource/img/class.png">
<p><b>i-class</b></p>
</div>
<div class="link_button" id="l_mail">
<img class="link_img" src="/resource/img/mail.png">
<p><b>메일</b></p>
</div>
<div class="link_button" id="l_library">
<img class="link_img" src="/resource/img/book.png">
<p><b>정석학술관</b></p>
</div>
<div class="link_button" id="l_meal">
<img class="link_img" src="/resource/img/meal.png">
<p><b>학식</b></p>
</div>
<div class="link_container">
<div class="link_button" id="l_iclass">
<img class="link_img" src="/resource/img/class.png">
<p><b>i-class</b></p>
</div>
<div class="link_button" id="l_mail">
<img class="link_img" src="/resource/img/mail.png">
<p><b>메일</b></p>
</div>
<div class="link_button" id="l_library">
<img class="link_img" src="/resource/img/book.png">
<p><b>정석학술관</b></p>
</div>
<div class="link_button" id="l_meal">
<img class="link_img" src="/resource/img/meal.png">
<p><b>학식</b></p>
</div>

<div class="link_button" id="l_click">
<img class="link_img" src="/resource/img/click.png">
<p><b>수강신청</b></p>
</div>
<div class="link_button" id="l_portal">
<img class="link_img" src="/resource/img/portal.png">
<p><b>포탈시스템</b></p>
</div>
<div class="link_button" id="l_certification">
<img class="link_img" src="/resource/img/certification.png">
<p><b>증명서발급</b></p>
</div>
<div class="link_button" id="l_calendar">
<img class="link_img" src="/resource/img/calender.png">
<p><b>학사일정</b></p>
</div>
<div class="link_button" id="l_click">
<img class="link_img" src="/resource/img/click.png">
<p><b>수강신청</b></p>
</div>
<div class="link_button" id="l_portal">
<img class="link_img" src="/resource/img/portal.png">
<p><b>포탈시스템</b></p>
</div>
<div class="link_button" id="l_certification">
<img class="link_img" src="/resource/img/certification.png">
<p><b>증명서발급</b></p>
</div>
<div class="link_button" id="l_calendar">
<img class="link_img" src="/resource/img/calender.png">
<p><b>학사일정</b></p>
</div>

<div class="link_button" id="l_hire">
<img class="link_img" src="/resource/img/hire.png">
<p><b>진로설계</b></p>
</div>
<div class="link_button" id="l_map">
<img class="link_img" src="/resource/img/map.png">
<p><b>건물안내</b></p>
</div>
<div class="link_button" id="l_temple">
<img class="link_img" src="/resource/img/temple.png">
<p><b>인하광장</b></p>
</div>
<div class="link_button" id="l_everytime">
<img class="link_img" src="/resource/img/everytime.png">
<p><b>에브리타임</b></p>
</div>
<div class="link_button" id="l_hire">
<img class="link_img" src="/resource/img/hire.png">
<p><b>진로설계</b></p>
</div>
<div class="link_button" id="l_map">
<img class="link_img" src="/resource/img/map.png">
<p><b>건물안내</b></p>
</div>
<div class="link_button" id="l_temple">
<img class="link_img" src="/resource/img/temple.png">
<p><b>인하광장</b></p>
</div>
<div class="link_button" id="l_everytime">
<img class="link_img" src="/resource/img/everytime.png">
<p><b>에브리타임</b></p>
</div>

<!--
"사용되지 않는 메뉴"
<div class="link_button" id="l_grade">
<img class="link_img" src="/resource/img/grade.png">
<b>성적조회</b>
</div>
<div class="link_button" id="l_money">
<img class="link_img" src="/resource/img/money.png">
<b>등록금조회</b>
</div>
-->
</div>
<!--
"사용되지 않는 메뉴"
<div class="link_button" id="l_grade">
<img class="link_img" src="/resource/img/grade.png">
<b>성적조회</b>
</div>
<div class="link_button" id="l_money">
<img class="link_img" src="/resource/img/money.png">
<b>등록금조회</b>
</div>
-->
</div>

<div id="middle">
<a href="https://learn.inha.ac.kr/">
<div class="link_button direct_link_button">
<b>여기서! I-CLASS 열기 (Beta)</b>
</div>
</a>
<br/>
<div id="middle">
<a href="https://learn.inha.ac.kr/">
<div class="link_button direct_link_button">
<b>여기서! I-CLASS 열기 (Beta)</b>
</div>
</a>
<br/>

<a href="https://www.inha.ac.kr/kr/966/subview.do">
<div class="link_button direct_link_button">
<b>여기서! 교내 전화번호 찾기</b>
</div>
</a>
<br/>
<a href="https://www.inha.ac.kr/kr/966/subview.do">
<div class="link_button direct_link_button">
<b>여기서! 교내 전화번호 찾기</b>
</div>
</a>
<br/>

<a href="https://chhs2131.github.io/induck-guide-me/information_officewindow.html">
<div class="link_button direct_link_button">
<b>여기서! Office, Window 받기</b>
</div>
</a>
<br/>
<a href="https://chhs2131.github.io/induck-guide-me/information_officewindow.html">
<div class="link_button direct_link_button">
<b>여기서! Office, Window 받기</b>
</div>
</a>
<br/>
</div>

<div id="footer">
<span>
<div id="footer">
<br/>
<span>
<div>
Ver 1.1.1 -
Ver 1.2.0 -
<a href="https://github.com/chhs2131">chhs2131 github</a>
/
Icons from <a href="https://www.flaticon.com/" title="Flaticon">Flaticon</a>
</div>
</span>
</div>
</body>
</div>

<script type="text/javascript" src="sidebar.js"></script>
<script type="text/javascript" src="popup.js"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"type": "module"
},
"permissions": [
"tabs"
"tabs",
"storage"
]
}

0 comments on commit 7d8e841

Please sign in to comment.