Code Monkey home page Code Monkey logo

practical-startpage's Introduction

logo

Practical Startpage

Chrome Extension that replaces the default newtab. Install from Practical Startpage in chrome store or visit Practical Startpage homepage


License MIT GitHub release

GitHub issues To be started Stories in Progress Implemented

Chrome Web Store Chrome Web Store


About

Startpage focuses on making your existing data available to you simple way.

Practical Startpage is for those that want a functional startpage, allowing easy access to chrome data, such as bookmarks and history.

Up now and on the next few months the intention is to improve the customization of the page, allowing changes to layout and styles. In the future there will be more widgets added that the users can have on their Practical Startpage.

The application is build flexibly, allowing anyone to contribute with a widget for the tabs.

Contributions

The application is written in AngularJS with [Semantic UI] as the layout framework. For the build Gulp is used. Please review Angular Style Guide and try to adhere where it makes sense. Further there are ESLint rules available in the project.

Translation

Help with transaltion is much appreciated. Check the Practical Startpage homepage on how to do

Widgets

Adding widgets should be fairly easy. Any self contained directive will run. All formatting variables are available from Services if needed, allowing consistent colors throughout.

Folder Structure

To keep each component easily identified, all files used by that component must be grouped together with the same name or at least same prefix. In the case where components share parts with other components, such as services and templates these can be in a different location or have a different naming convention.

appdev/       - development Folder
  app/        - scripts
    core/     - core application
    services/ - services connecting to external
    widgets/  - widgets, directives, controller, and services
  dist/       - third party distributions
  img/        - images that are not specific to any part
dist/         - distribution that need adaptation

E.g. a mail checker would have the base logic and rendering code in widgets/ while the interfaces to outlook, Gmail and yahoo api would be under services/

Configuration data

For the startpage to notice the widget it needs to be registered in widgetConstants.js

[label of widget]: {
  title: "Title of Widget",
  icon: "icon classes from",
  directive: "widget directive without ps- prefix",
  help: "Help text",
  edit: {
    type: "type of edit widget, only support modal right now",
    url: "url to the html file",
  },
},

Callback functions

In order to allow a simple trigger on various events, there are some simple callbacks available. Alternative is to use $scope.$watch however this is resource consuming, and also often requires exact variable comparison, which is even heavier.

The approach chosen is to rely on the native chrome event functions, as well as services to trigger events.

Set local data callbacks

Since all settings are persisted in chrome storage, the call is triggered by changes to the stored variable. To bind a function to a change to an object:

//To bind functions to data changes
dataService.setOnChangeData(objectLabel, function callback)

objectLabel //name of object (string)
callback    //the callback function

Tab click callbacks

The widgets need to be refreshed when the tab is shown and for some also when clicked. This callback is also very useful to trigger when you need data to refresh with saving data.

//to bind functions to tab click
layoutService.setOnTabClick(tabLabel, function callback)

//to trigger a refresh of a specific tab
layoutService.runOnTabClick(tabLabel)

tabLabel    //the label of the tab = label of widget on that tab (string)
callback    //the callback function

Permissions

New widgets will need additional permissions, however to avoid bloating the default permissions, optional permissions will be used for new widgets.

"optional_permissions": [
  "http://ajax.googleapis.com/*"
],
"permissions": [
  "topSites",
  "chrome://favicon/",
  "tabs",
  "bookmarks",
  "management",
  "history",
  "sessions",
  "storage"
],

In this example "optional_permissions": ["http://ajax.googleapis.com/*"] are the permission for the RSS feed widget. To check and approve permissions there are two new services.

//check if the permission is authorized, returns boolean
permissionService.checkPermissions(permissionsList)

//request additional permissions returns boolean
permissionService.requestPermissions(permissionsList)

permissionsList    //list of oermissions needed

Set-up development

Clone

  • branch code and clone locally
  • load the development folder to continuously monitor
    • in chrome to to Extensions ( More toole -> Extensions )
    • tick Developer mode
    • Load unpacked extensions and select appdev/

Build

Install all dependencies

> npm install

Build code to build/

> gulp build

practical-startpage's People

Contributors

pd75 avatar efueger avatar

Watchers

Robert Priebs avatar

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.