Skip to content

Commit

Permalink
Merge pull request #246 from sanemat/chore/remove-jquery-from-options
Browse files Browse the repository at this point in the history
Remove jquery from options
  • Loading branch information
sanemat authored Oct 30, 2019
2 parents 3d1ae71 + c94c358 commit 037a4f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
9 changes: 4 additions & 5 deletions app/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html>
<head>
<link href="styles/options.css" rel="stylesheet">
<script src="bower_components/jQuery/dist/jquery.js"></script>
<script src="scripts/options.js"></script>
</head>
<body>
Expand All @@ -13,10 +12,10 @@ <h1 class="title">Do Not Merge WIP for GitHub</h1>
<div class="content">
<form action="" class="options">
<div class="option">
<label for="protected_branch">Protected Branch <span class="weak">(Regular Expression)</span></label>
<input type="text" id="protected_branch" name="protected_branch" placeholder="e.g. deployment/*" /><br />
<label for="button_message">Button Message <span class="weak">(String)</span></label>
<input type="text" id="button_message" name="button_message" placeholder="WIP! You can't merge!" />
<label for="protectedBranch">Protected Branch <span class="weak">(Regular Expression)</span></label>
<input type="text" id="protectedBranch" name="protectedBranch" placeholder="e.g. deployment/*" /><br />
<label for="buttonMessage">Button Message <span class="weak">(String)</span></label>
<input type="text" id="buttonMessage" name="buttonMessage" placeholder="WIP! You can't merge!" />
</div>
<div class="buttons">
<button id="save_btn" class="button">Save</button>
Expand Down
18 changes: 9 additions & 9 deletions app/scripts/options.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
'use strict';
(() => {
'use strict';

(function($){
$(function(){
$('#protected_branch').val(localStorage.protectedBranch);
$('#button_message').val(localStorage.buttonMessage);
window.addEventListener('DOMContentLoaded', () => {
document.getElementById('protectedBranch').value = localStorage.protectedBranch;
document.getElementById('buttonMessage').value = localStorage.buttonMessage;

$('#save_btn').closest('form').submit(function(e) {
document.getElementById('save_btn').closest('form').addEventListener('submit', e => {
e.preventDefault();
localStorage.protectedBranch = $('#protected_branch').val();
localStorage.buttonMessage = $('#button_message').val();
localStorage.protectedBranch = e.target.protectedBranch.value;
localStorage.buttonMessage = e.target.buttonMessage.value;

window.alert('The options have been saved!');
});
});
})(jQuery);
})();

0 comments on commit 037a4f0

Please sign in to comment.