Giter Site home page Giter Site logo

friendica / redshare Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leberwurscht/post2friendica

3.0 5.0 0.0 1.48 MB

A Firefox addon to post images, links, and selections to the Red Matrix using the context menu.

License: MIT License

JavaScript 100.00%

redshare's Introduction

Description

This is the beginning of a port of the post2friendica add-on (Open Source, MIT License) to the Red Matrix. It adds entries to the context menu which allow the user to share images, links, the page URL or a selection on his Red Matrix channel easily: A new tab with a configurable Red Matrix site is opened, and the item is inserted into the textarea. The user can still edit or add something before posting.

It works by injecting Javascript into the newly opened tab with the content script injection technique (http://wiki.greasespot.net/Content_Script_Injection). The injected scripts are based on the jotShare and jotGetLink functions from the Red Matrix, so if the interface used by these functions changes, the addon will probably stop working.

Translation

Messages are translated on transifex: https://www.transifex.net/projects/p/post2friendica/

Developer info

The addon is built with the Add-on SDK of Firefox (https://addons.mozilla.org/en-US/developers/builder). Due to the security concepts of Firefox, three layers are needed to inject the necessary script into the Red Matrix site:

  • lib/main.js configures the context menu items and opens a new tab with the Red Matrix site. main.js is not allowed to touch the DOM of the newly opened tab, therefore a so-called "content script" is attached to the tab.
  • data/contentscript.js is allowed to touch the DOM, but has (again for security reasons) no access to Javascript variables of the Red Matrix page. Therefore a script tag is appended to the DOM. This is the so-called "content script injection technique" (http://wiki.greasespot.net/Content_Script_Injection).
  • This script tag contains the necessary Javascript to insert something into the text area (see InsertHTMLScript and InsertURLScript variables in data/contentscript.js).

Communication between these three layers, i.e. sending the item that should be shared from one layer to the next, works with events.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.