Fork me on GitHub

core 0.1.37

node:

Text

THE
rewrite_js()
FUNCTION
mixer
core 0.1.37
category
Modify
{
Overview

Rewrites javascript to the correct domain.

The rewrite js function ensures that all javascript points to the correct domain - rewriting anything from a regular desktop link to a modified link. For example, the domain example.com will be rewritten as m.example.com on a mobile site in the javascript.

*
This function has no arguments
Example
rewrite_js()
»
View Source
node:

Text

THE
rewrite_link()
FUNCTION
mixer
core 0.1.37
category
Modify
{
Overview

Rewrites links to point to the correct domain.

The rewrite link function takes links on the regular site and rewrites them to modified links. On a mobile site, you do not want the links to point to the desktop site. This function fixes that. For most projects, link rewriting is done automatically via the "rewrite_links()" function found in html.ts. In the example below, we rewrite the links with the class "internal" so that they remain on the Moovweb site.

*
This function has no arguments
Example
$(".//a[@class='internal']") {
  attribute("href") {
    value() {
      rewrite_link()
    }
  }
}
rewrite_link()
»
View Source