Giter VIP home page Giter VIP logo

daylight's Introduction

daylight

A Chrome extension to customise the Apple iCloud web interface

alt text

"Refractor" 0.0.3-alpha

  • This release allows us to customise the Apple iCloud background image.
  • The background image is saved when leaving the page/quitting Chrome.
  • untested Theoretically the saved background image will sync between other devices running Chrome/daylight which you are signed into with your Google Account.

Notes

  • Images will need to be the same size otherwise the ease-in-out property looks stretchy (try it, that's the best i can explain)

Installation

Credits

daylight's People

Contributors

marmatee avatar

Watchers

 avatar

daylight's Issues

CSS Label Bug

Demo

alt text

Description

  • When clicking on the default top right iCloud menu, the image selector will not open when clicking the icon in the bottom right. Instead the default top right iCloud menu opens.

Blocks

  • Blocking progress to create a second dropdown to allow you to input your own custom image URL.

Fix

  • I don't think I'll be fixing this bug as such, instead I believe I will be rewriting the frontend in JS instead of plain CSS.

JS Suggestions

Hey bud, I saw you pinged me in another post, so I peeked through some code. Since you're going to be doing some changes with your JS, I'd probably start with trying to wean yourself off of jQuery (or kill it entirely). Also, in the code snippet below I saw you kind of mixed JS and jQuery, which you could technically do with just JS.

Also, I saw that you were changing the body background, and then doing some weird regex replace on it, but doesn't the result in value end up being the same as img1?

Here's an example of the same code with just JavaScript and no regex replace (assuming it's not doing something that I missed).

$(css1).click(function() {
  $('body').css('background', 'url('+img1+')');
    var value = document.querySelectorAll("body")[0].style.background.replace(/(url\(|\)|")/g, '');

    chrome.storage.sync.set({'background': value}, function(){
      // alert('Success!');
    });
});

Becomes

// I've also used a few ES6 things here you may want to check out:
// https://webapplog.com/es6/

// This method becomes partially applied, so you pass the image url in
// then once the second method is called, the appropriate cached variable
// would be set
const setBackground = (background = '') => {
  return () => {
    body.style.background = `url('${background}')`; // Template Literal (ES6)
    chrome.storage.sync.set({ background }, () => {
      console.log(`background set to ${background}`);
    });
  };
};

// Typically these would be generated from some sort of config
css1.addEventListener('click', setBackground(img1));
css2.addEventListener('click', setBackground(img2));
css3.addEventListener('click', setBackground(img3));

Just my two cents!

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.