Git Product home page Git Product logo

eddystone-bookmarklet's Introduction

eddystone-bookmarklet

Share links in the office with this Physical Web Eddystone URL beacon bookmarklet.

Note: A recent change to discover Physical Web URL:s via Google Chrome and Android Nearby requires them to be using https. This bookmarklet will fail on https URL:s unless slide-beacon is modified to use secure websockets. Since this modification requires certificate files and because slide-beacon was originally meant to broadcast presentational slide URL:s I will not update it myself.

Use

To be able to use this bookmarklet and broadcast the URL from your computer you need to use the node.js server part from the slide-beacon project, or this desktop app for Mac OSX electron-slide-beacon.

Add this link to a bookmark:

javascript:(function(){function%20e(){var%20e=new%20XMLHttpRequest;e.open(%22POST%22,%22https://www.googleapis.com/urlshortener/v1/url%3Fkey=AIzaSyDdsRcdenBZR8nWqo_Ak58w8vCoASSty1k%22,!0),e.setRequestHeader(%22Content-Type%22,%22application/json%22),e.onreadystatechange=function(){if(4==e.readyState%26%26200==e.status){var%20t=JSON.parse(e.responseText);n.innerHTML+=%22%3Cp%3EShortened%20%22+t.longUrl+%22%20to%20%22+t.id+%22%3C/p%3E%22,ws.send(t.id)}};var%20t=window.location.href;e.send('{%22longUrl%22:%20%22'+t+'%22}')}var%20n=document.getElementById(%22eddystone-bm%22)||document.createElement(%22div%22);n.id||(n.id=%22eddystone-bm%22,n.setAttribute(%22style%22,%22z-index:1999;position:fixed;bottom:0;left:0;right:0;width:100%25;background-color:%23000;color:%23fff;font-size:12px;padding:1em;text-align:center;%22),n.setAttribute(%22onclick%22,%22this.parentNode.removeChild(this)%22),document.body.appendChild(n)),%22undefined%22==typeof%20WebSocket%26%26%22undefined%22!=typeof%20MozWebSocket%26%26(WebSocket=MozWebSocket),ws=new%20WebSocket(%22ws://localhost:1234/%22),ws.onopen=function(t){n.innerHTML+=%22%3Cp%3EConnected%3C/p%3E%22,e()},ws.onmessage=function(e){n.innerHTML+=%22%3Cp%3E%22+e.data+%22%3C/p%3E%22},ws.onclose=function(e){ws=null,n.innerHTML+=%22%3Cp%3EDisconnected%3C/p%3E%22},ws.onerror=function(e){n.innerHTML+=%22%3Cp%3EError%3C/p%3E%22}})();

Navigate to the page you want to share and press the bookmarklet. This will auto-shorten the link (using Google's API) and send it to the localhost beacon-server over websockets.

eddystone-bookmarklet's People

Contributors

dermike avatar

Watchers

James Cloos avatar  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.