• Stars
    star
    170
  • Rank 223,357 (Top 5 %)
  • Language
    HTML
  • License
    The Unlicense
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tool to create bookmarklet/ javascript apps to automate the web browser.

Bookmarklet Maker

Bookmarklet Maker

Overviiew

Bookmarklet maker is a small web app to create bookmarklet or small executable Javascript apps to peform browser aumtomation tasks.

You can run this app by accessing the hyperlink:

If you don’t know what is a bookmarklet, see:

Bookmarklet Cheat Sheet

Get Metadata

Get current page title

<title>Paget Title</title>
document.title

Get author

<meta content="author M.r dummy" name="author">
Array.from(document.getElementsByTagName("meta"))
    .find(function(e){return e.name == "author"})
    .content

Get description

<meta content="A description of the page." name="description">
Array.from(document.getElementsByTagName("meta"))
    .find(function(e){return e.name == "description"})
    .content

Get keywords

<meta content="keyword1 keyword2 keyword2" name="keywords">
Array.from(document.getElementsByTagName("meta"))
    .find(function(e){return e.name == "keywords"})
    .content

Get current date

> var d = new Date() ; (d.getYear() + 1900).toString() + "-" + d.getMonth().toString() + "-" + d.getDay().toString()
"2016-9-4"

Function getDate()

function getDate(){
    var d = new Date();
    return (d.getYear() + 1900).toString() + "-" +
        d.getMonth().toString() + "-" + d.getDay().toString() ;
}

>> getDate()
"2017-3-5"

Url

Get current page URL

document.URL

Redirect current page

window.location.href = "http://www.httpbin.org/get"

Open url in a new tab

window.open("http://www.yandex.com")

URL manipulation

URL Manipulation is useful to send the current URL to some web service or Web App such as Google Driver or Web Archive.

  • Open some page that doesn’t exist anymore in Web Archive:
var baseUrl = "https://web.archive.org/web/*/"
var urlmod  = document.URL
window.location.href = baseUrl + urlmod
  • Open a file google Driver.

Example URL: https://drive.google.com/viewerng/viewer?url=lampwww.epfl.ch/~hmiller/scala2014/proceedings/p51-prokopec.pdf

var baseUrl = "http://lampwww.epfl.ch/~hmiller/scala2014/proceedings/p51-prokopec.pdf"
var urlmod = "https://drive.google.com/viewerng/viewer?url=" + baseUrl
window.open(urlmod)

Open current page (PDF document in Google Driver).

window.open("https://drive.google.com/viewerng/viewer?url=" + document.URL);

Open a prompt showing Google driver URL to current document. Useful to create short URL in services like tiny URL and view document in Tablets or Smartphones.

prompt("Google driver URL:", "https://drive.google.com/viewerng/viewer?url=" + document.URL);

Misc

Display alert box (Messagebox)

alert("My message");

Display a prompt

  • The promopt function is useful to read user input and allow user to copy some data.
prompt("Window title", "Content")

Display string in console

console.log(object);
console.log("My message");

Style

Recipes

Generate org-mode Bibliographical Reference

function getDate(){
    var d = new Date()
    return (d.getYear() + 1900).toString() + "-" +
        d.getMonth().toString() + "-" + d.getDay().toString() ;
};


var text = '*' + document.title + '*' + " Accessed at " + getDate() +
    ". Available at <" + document.URL + "> " ;

prompt("Type Ctrl+A and Ctrl+C to copy the markdown", text);

It will generate a reference like this:

- *Overview of Forks, Threads, and Asynchronous I/O* Accessed at 2017-3-5. Available at <http://www.remwebdevelopment.com/blog/overview-of-forks-threads-and-asynchronous-io-133.html> 

Change the page width for better readability

This will set the page width to the width of an A4 ISO paper sheet that makes easier to read long texts in the browser.

document.querySelector("body").style.setProperty("width", "800px")

Invert page color for enhancing reading at night

document.querySelector("body").style.setProperty("color", "white")
document.querySelector("body").style.setProperty("background", "black")

Change page background color

document.querySelector("body").style.setProperty("background", "white")

See also:

More Repositories

1

Functional-Programming

Functional Programming concepts, examples and patterns illustrated in Haskell, Ocaml and Python
Haskell
2,681
star
2

C-Cpp-Notes

Notes about modern C++, C++11, C++14 and C++17, Boost Libraries, ABI, foreign function interface and reference cards.
C++
677
star
3

Emacs-Elisp-Programming

Tutorial about programming Elisp and Emacs text editor customization.
CSS
652
star
4

org-wiki

Wiki for Emacs org-mode built on top of Emacs org-mode.
CSS
354
star
5

sample-cpp-plugin

C++ cross-platform plugin architechture demonstration
C++
44
star
6

caiorss.github.io

Static Web page hosting
JavaScript
13
star
7

cpp-project-templates

C++ CPP project templates with CMake + Conan
C++
12
star
8

m2py

Python tools for Physics, Engineering and Finance based on Matlab and R language. Features: Unit Conversion, Physical constants, Steam tables and more.
Python
12
star
9

example-pybind11-vcpkg

Example project of a C++ native code Python3 module with Pybind11 managed by CMake and vcpkg
C++
10
star
10

Emacs-Bootstrap

Emacs wrapper to keep multiple emacs sites, ~/emacs.d and ~/emacs.d/init.el.
Emacs Lisp
9
star
11

clip.jar

Utility to paste images from clipboard to Emacs org-mode or any markdown.
Scala
9
star
12

clj-scheme

Clojure features implemented on top of Gambit Scheme and wrappers to C-libraries.
Scheme
7
star
13

org-nav-theme

org-mode theme with navigation bar for big documents
CSS
7
star
14

qtquick-examples

A CMake Qt5/ QML QtQuick project containing multiple subproject examples and experiments.
QML
6
star
15

xlw-cmake-fork

Fork of XLW project for building Excel Addins using Excel XLL native C-API. This fork changes the building system to CMake for easier usage and deployment.
C++
6
star
16

bookmark-storage-webapp

Python Django web application for storing bookmarks and files.
Python
5
star
17

qapplauncher

Q5/Modern C++ - Application launcher and bookmark system for files and directories
C++
4
star
18

zhserver

Haskell Webserver for Zotero reference manager - based on Zotero.
PLpgSQL
4
star
19

INIReader

Ini file configuration parser for F# and .NET
F#
3
star
20

qtwidgets-sample-uis

Sample C++ CMake project for QT5 Widgets with many user interfaces and executables in the same project
C++
3
star
21

winapi-snippets-cmake

Code snippets and examples for Windows API in modern C++ managed by CMake.
C++
3
star
22

Libreoffice-Macros-Functions

Python and Libreoffice Basic Documentation for Libreoffice and Useful Scripts, documentation and resources.
JavaScript
3
star
23

cpp-experiments

A single C++ CMake/Conan project with many libraries experiments.
CMake
3
star
24

prelude

A functional programming library for python based on Haskell Prelude, Fsharp and OCaml
Python
2
star
25

jmhttp

A portable cross-platform http web server for sharing file and directories on Local Network.
Scala
2
star
26

Rlang-RcppExamples

Examples about R raw native extension C API and Rcpp API for building R libraries in C++
C++
2
star
27

pget

Alternative command line dependency manager for .NET and F# projects.
F#
2
star
28

conan-cpp-recipes

Lots of conan recipes and CMake/Conan project-templates in a single repository.
Python
2
star
29

qemu-launcher-qt

A qt front-end for QEMU emulator that makes it easier to run virtual machines and Linux distributions live CDs iso images.
C++
2
star
30

build-fat-jar

Unix Shell Script to build java/Scala fat-jars and make the distributions and deployment of Scala applications easier.
Shell
2
star
31

fserver

Standalone, single-file file sharing web server written in Kotlin and Javalin web framework.
Kotlin
1
star
32

postgres-docker-container

Very lightweight and simple to setup postgres SQL docker image.
Shell
1
star
33

lazarus-linux-panel

A simple handy Linux panel built with Lazarus IDE Free-Pascal
Pascal
1
star
34

MultiTimeSeries

Multivariate time series library.
Haskell
1
star
35

Spread

Plataforma de negociação de Renda Fixa
C#
1
star
36

unix-clibox

Command line toolbox for Linux and Unix-like operating system built with modern C++17.
C++
1
star
37

sandbox

Experimental Python Sandbox tools to execute unsafe user input.
Python
1
star
38

example-project-pybind11

Sample C++ CMake + Conan project with Pybind11 library for Python3 C++ bindings
C++
1
star
39

dockman

Docker manager tool written in D (D Language) for making easier the use of toolchains and development tools from Docker containers.
D
1
star
40

jarget

Jarget - Toolbox for Java Platform to build uber jars, get information about jar files and download jars libraries from Maven Central.
Scala
1
star
41

netmon

Cross platform app to check internet connectivity and help diagnose connection failures.
Scala
1
star