4 |
5 |

6 |
7 |
14 |
19 |
20 | );
21 | export default Navigation;
--------------------------------------------------------------------------------
/src/scripts/react-components/options.js:
--------------------------------------------------------------------------------
1 | ////MESSAGING AND COMMUNICATION
2 | function packageData(sender:string,receiver:string,targetMethod:String,data: any): Object{
3 | let package :Object = {
4 | sender: sender,
5 | receiver: receiver,
6 | targetMethod:targetMethod,
7 | data: data
8 | };
9 | return package;
10 | }
11 |
12 | function packageAndBroadcast(sender:string = sender,receiver:string,targetMethod:String,data: any){
13 | chrome.runtime.sendMessage(packageData(sender,receiver,targetMethod,data));
14 | }
15 | chrome.runtime.onConnect.addListener(function(port){
16 |
17 | console.assert(port.name == "ActiveTabsConnection");
18 | if (port.name == "ActiveTabsConnection") {
19 | port.onMessage.addListener(function(msg) {
20 | console.log("msg",msg);
21 | if(!jQuery.isEmptyObject(msg))
22 | {
23 | tabsList = msg.tabs;
24 | $('.active-tab-count').html(msg.tabs.length);
25 | ActiveTabs.setState({data: msg.tabs});
26 | }
27 | });
28 | }
29 | });
30 |
31 |
32 | // Saves options to chrome.storage.sync.
33 | function save_options(e) {
34 | e.preventDefault();
35 | let pref = {};
36 | pref.filterType = $('#filter-type-option-id').val();
37 | pref.filterCase = $('#filterCase-option-id').prop('checked');
38 | pref.sortAnimation = $('#sort-animation-option-id').val();
39 | console.log(pref)
40 | chrome.storage.local.set({
41 | pref: pref
42 | }, function () {
43 | // Update status to let user know options were saved.
44 | console.log(pref);
45 | let status = document.getElementById('status');
46 | $('#status>span').text('Options Saved');
47 | $('#status').fadeIn('slow')
48 | // status.textContent = 'Options saved.';
49 | setTimeout(function () {
50 | $('#status').fadeOut('slow')
51 | $('#status>span').text('');
52 | }, 2500);
53 | });
54 |
55 | }
56 | // Restores select box and checkbox state using the preferences
57 | // stored in chrome.storage.
58 | function restore_options() {
59 | chrome.storage.local.get("pref", function (items) {
60 | console.log(items);
61 | $('#filter-type-option-id').val(items.pref.filterType)
62 | $('#sort-animation-option-id').val(items.pref.sortAnimation)
63 | $('#filterCase-option-id').prop('checked': items.pref.filterCase)
64 | });
65 | }
66 | document.addEventListener('DOMContentLoaded', restore_options);
67 | // document.getElementById('save').addEventListener('click', save_options);
68 | $('#save').on('click',save_options);
69 | $('#go-to-tabs').on('click',function(){
70 | packageAndBroadcast('options','background','openExcitedGemPage',null);
71 | });
72 |
73 |
--------------------------------------------------------------------------------
/src/scripts/sessions-container.js:
--------------------------------------------------------------------------------
1 | //Vendors
2 | const $ = (jQuery = require('jquery'));
3 | const bootstrap = require('bootstrap');
4 | import React from 'react';
5 | import ReactDOM from 'react-dom';
6 | // import * as general from './components/general.js';
7 | import Sessions from './react-components/session';
8 | import { saveSessions, getSessions } from './components/getsetSessions';
9 |
10 | //Styles
11 | import '../styles/fontawesome5/fa-solid.scss';
12 | import '../styles/fontawesome5/fa-light.scss';
13 | import '../styles/fontawesome5/fa-regular.scss';
14 | import '../styles/fontawesome5.scss';
15 | import '../styles/eg.scss';
16 |
17 | $(document).ready(function() {
18 | $('.collapse').collapse();
19 | window.sessions = ReactDOM.render(