Skip to content
/ dorothy Public

A simple way to condition your JS code execution based on page types for Blogger blogs.

License

Notifications You must be signed in to change notification settings

1e90ff/dorothy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dorothy

A simple way to condition your JS code execution based on page types for Blogger blogs.

Setup

Add to your XML template the next script tag.

<script src="https://cdn.jsdelivr.net/gh/1e90ff/dorothy@1.0.1/dorothy.min.js" />

Method

dorothy(pageTypes, callbackFn[, applyMobile=true]);
  1. pageTypes, a single or multiple page-types (pipe-delimited).
  2. callbackFn, a function with the routine to execute.
  3. applyMobile, a flag to enable or disable running on mobile requests.

Example

// Available page types:
// ALL, ITEM, POST, PAGE, FEED, HOME,
// QUERY, LABEL, ERROR, SEARCH, ARCHIVE

dorothy('HOME', function (data) {
  alert('Welcome to ' + data.blog.title + '!');
});

dorothy('POST|PAGE', function (data) {
  alert('You are reading: "' + data.view.title + '".');
}, false);

License

See the LICENSE file included in this project for details.

About

A simple way to condition your JS code execution based on page types for Blogger blogs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published