This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaning up custom mobify.js build file example, adding example for o…
…ne that works with v6
- Loading branch information
Showing
2 changed files
with
41 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require(["capture", "resizeImages"], function(Capture, ResizeImages) { | ||
var Mobify = window.Mobify = window.Mobify || {}; | ||
|
||
// === HACKS TO ENSURE NEW CODE WORKING WITH v6 TAG === // | ||
|
||
if (Mobify.api != "2.0.0") { // same as if (capturing) | ||
// legacy need for v6 tags | ||
Mobify.api = "2.0.0"; | ||
|
||
// Remove the bootstrap and tag scripts | ||
var scripts = document.getElementsByTagName("script"); | ||
var preview = scripts[1]; | ||
preview.parentNode.removeChild(preview); | ||
var tag = scripts[1]; | ||
tag.parentNode.removeChild(tag); | ||
|
||
// === END HACKS ====// | ||
|
||
// Grab reference to a newly created document | ||
var capture = new Capture(); | ||
var capturedDoc = capture.capturedDoc; | ||
|
||
// Resize images using Mobify Image Resizer | ||
ResizeImages.resize(capturedDoc, 320); | ||
// Render source DOM to document | ||
capture.renderCapturedDoc(); | ||
} | ||
|
||
}, undefined, true); | ||
// relPath, forceSync |