|
| 1 | +<template> |
| 2 | + <div> |
| 3 | + <h3>Version: {{ version }}</h3> |
| 4 | + <form> |
| 5 | + <label><input |
| 6 | + v-model="options.analytics" |
| 7 | + type="checkbox" |
| 8 | + >Enable Analytics</label> |
| 9 | + <br> |
| 10 | + <label><input |
| 11 | + v-model="options.percent_main_page" |
| 12 | + type="checkbox" |
| 13 | + >Load final percent and missing assignments on overall grade page (More network intensive)</label> |
| 14 | + <br> |
| 15 | + <!--<label><input type="checkbox" id="save-grades" />Save last seen grades (requires previous option to work)</label>--> |
| 16 | + </form> |
| 17 | + <br> |
| 18 | + |
| 19 | + <footer> |
| 20 | + <br> |
| 21 | + Last Seen Grades has been temporarily removed to be improved upon.<br> |
| 22 | + <br> |
| 23 | + For any suggestions or feedback/inquiries regarding downloading or deleting collected analytics data, please email < a href= "mailto:[email protected]"> [email protected]</ a>.< br> |
| 24 | + <br> |
| 25 | + Analytics ID: {{ options.id }}<span style="white-space: nowrap; padding-left: 5px;" /><button @click="copyId"> |
| 26 | + <span v-if="copiedRecently">Copied!</span> |
| 27 | + <span v-else>Copy</span> |
| 28 | + </button><br> |
| 29 | + <br> |
| 30 | + SAS Powerschool Enhancement Suite is the collective work of many different people working together publicly. Visit our <a href="https://github.com/gary-kim/saspes">GitHub page</a> if you'd like to participate as well.<br> |
| 31 | + <br> |
| 32 | + More info and source code (Anyone and everyone is welcome to contribute): <br> |
| 33 | + <a href="https://github.com/gary-kim/saspes">https://github.com/gary-kim/saspes</a><br> |
| 34 | + <br> |
| 35 | + Credits: <br> |
| 36 | + Special thanks to Alan Chang for the idea. <br> |
| 37 | + <a |
| 38 | + :href="thirdPartyLibraries" |
| 39 | + target="_blank" |
| 40 | + >Third-Party Libraries</a> |
| 41 | + </footer> |
| 42 | + </div> |
| 43 | +</template> |
| 44 | + |
| 45 | +<script> |
| 46 | +import { analytics_message } from '../helpers'; |
| 47 | +import browser from 'webextension-polyfill'; |
| 48 | +
|
| 49 | +function defaultOptions () { |
| 50 | + return { |
| 51 | + id: "Not set yet", |
| 52 | + percent_main_page: true, |
| 53 | + analytics: true, |
| 54 | + save_grades_temp: true, |
| 55 | + }; |
| 56 | +} |
| 57 | +
|
| 58 | +export default { |
| 59 | + name: "Options", |
| 60 | + data () { |
| 61 | + return { |
| 62 | + options: defaultOptions(), |
| 63 | + ignoreNextReset: false, |
| 64 | + copiedRecently: false, |
| 65 | + thirdPartyLibraries: browser.extension.getURL('web_accessible_resources/libraries.txt'), |
| 66 | + version: SASPES_VERSION_NAME, |
| 67 | + }; |
| 68 | + }, |
| 69 | + watch: { |
| 70 | + options: { |
| 71 | + deep: true, |
| 72 | + handler (val) { |
| 73 | + if (this.ignoreNextReset) { |
| 74 | + this.ignoreNextReset = false; |
| 75 | + return; |
| 76 | + } |
| 77 | + browser.storage.local.set(JSON.parse(JSON.stringify(val))); |
| 78 | + }, |
| 79 | + }, |
| 80 | + }, |
| 81 | + async mounted () { |
| 82 | + analytics_message("Options Page", "saspes://options"); |
| 83 | + await this.resetData(); |
| 84 | + browser.storage.onChanged.addListener(this.resetData); |
| 85 | + }, |
| 86 | + methods: { |
| 87 | + async resetData () { |
| 88 | + const options = await browser.storage.local.get(defaultOptions()); |
| 89 | + this.ignoreNextReset = true; |
| 90 | + this.options = Object.assign({}, this.options, options); |
| 91 | + }, |
| 92 | + copyId () { |
| 93 | + this.copiedRecently = true; |
| 94 | + navigator.clipboard.writeText(this.options.id); |
| 95 | + setTimeout(() => { this.copiedRecently = false; }, 1500); |
| 96 | + }, |
| 97 | + }, |
| 98 | +}; |
| 99 | +</script> |
| 100 | + |
| 101 | +<style scoped> |
| 102 | +
|
| 103 | +</style> |
0 commit comments