Adding `Easy Switch Between Utopian and Steem Posts` to Utopian Moderator Chrome Extension


Utopian Moderator & Supervisor

Utopian Moderator & Supervisor is the FIRST chrome extension that is intended to help the Utopian Moderators & Supervisors in moderating work.

New Feature

As promised earlier, I am adding a very useful feature to the version 0.0.2: Allow Easy switch between Utopian and SteemIt posts.

Configuration

Adding a Dropdown menu to allow user select the prefered ‘steem’ sites i.e. steemit.com or busy.org (more can be added in the future)

utopian-chrome-extension-alt-s Adding `Easy Switch Between Utopian and Steem Posts` to Utopian Moderator Chrome Extension chrome extension javascript software development SteemIt

utopian-chrome-extension-alt-s

Now, as you are moderating utopian posts, you can easily switch between Utopian to the preferred steem sites by Alt+S short cut. For example, utopian.io to busy.org and busy.org to utopian.io

How to Inject Scripts in Chrome Extension?

In Chrome Extension, you need to inject the scripts to the page, which is a bit tricky. The commits are: here

Add this to manifest.json of the plugin root folder.

  "content_scripts": [{
      "matches": ["<all_urls>"],
      "js":[
          "js/jquery-3.2.1.min.js",
          "js/content.js"
      ],
      "run_at":"document_start"
  }],
</all_urls>

The logic code that deals with the URL page switch.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$(function() {
    let id;
    let website;
 
    // load settings 
    chrome.storage.sync.get('utopian_settings', function(data) {
        if (data && data.utopian_settings) {
            let utopian = data.utopian_settings;
            if (utopian["steemit_id"]) {
                id = utopian["steemit_id"].trim();
            }
            if (utopian["steemit_website"]) {
                website = utopian["steemit_website"].trim();
            }
        }
    });
 
    // use steemit.com if not set
    website = website || "steemit.com";
 
    // short cut Alt + S to switch between utopian and steemit
    $(document).keydown(function(e) {
        if(e.key.toLowerCase() == "s" && e.altKey) {
            var url = document.location.href;
            if (url.includes("utopian.io")) {               
                document.location.href = url.replace("utopian.io", website);
            } else if (url.includes("steemit.com")) {
                document.location.href = url.replace("steemit.com", "utopian.io");
            } else if (url.includes("busy.org")) {
                document.location.href = url.replace("busy.org", "utopian.io");
            }       
        }
    });
})();
$(function() {
    let id;
    let website;

    // load settings 
    chrome.storage.sync.get('utopian_settings', function(data) {
        if (data && data.utopian_settings) {
            let utopian = data.utopian_settings;
            if (utopian["steemit_id"]) {
                id = utopian["steemit_id"].trim();
            }
            if (utopian["steemit_website"]) {
                website = utopian["steemit_website"].trim();
            }
        }
    });

    // use steemit.com if not set
    website = website || "steemit.com";

    // short cut Alt + S to switch between utopian and steemit
    $(document).keydown(function(e) {
        if(e.key.toLowerCase() == "s" && e.altKey) {
            var url = document.location.href;
            if (url.includes("utopian.io")) {               
                document.location.href = url.replace("utopian.io", website);
            } else if (url.includes("steemit.com")) {
                document.location.href = url.replace("steemit.com", "utopian.io");
            } else if (url.includes("busy.org")) {
                document.location.href = url.replace("busy.org", "utopian.io");
            }       
        }
    });
})();

Roadmap of Utopian Moderators & Supervisors

I am adding the following features in the next coming versions:

  • Show More statistics for a given category.
  • Show Personal Moderating statistics.

Contributing to Utopian Extension

Github: https://github.com/DoctorLai/utopian-moderator

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am ‘Add some feature’
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request.

Install Utopian Moderators & Supervisors at Chrome Webstore

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
534 words
Last Post: The First Utopian Moderator Chrome Extension
Next Post: Adding `Moderators Tab` to Utopian Chrome Extension!

The Permanent URL is: Adding `Easy Switch Between Utopian and Steem Posts` to Utopian Moderator Chrome Extension

Leave a Reply