PHP Classes

File: public/js/tinymce/src/themes/mobile/src/main/js/touch/view/MetaViewport.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/themes/mobile/src/main/js/touch/view/MetaViewport.js   Download  
File: public/js/tinymce/src/themes/mobile/src/main/js/touch/view/MetaViewport.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,707 bytes
 

Contents

Class file image Download
define( 'tinymce.themes.mobile.touch.view.MetaViewport', [ 'ephox.sugar.api.dom.Insert', 'ephox.sugar.api.node.Element', 'ephox.sugar.api.properties.Attr', 'ephox.sugar.api.search.SelectorFind' ], function (Insert, Element, Attr, SelectorFind) { /* * The purpose of this fix is to toggle the presence of a meta tag which disables scrolling * for the user */ var tag = function () { var head = SelectorFind.first('head').getOrDie(); var nu = function () { var meta = Element.fromTag('meta'); Attr.set(meta, 'name', 'viewport'); Insert.append(head, meta); return meta; }; var element = SelectorFind.first('meta[name="viewport"]').getOrThunk(nu); var backup = Attr.get(element, 'content'); var maximize = function () { Attr.set(element, 'content', 'width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0'); }; var restore = function () { if (backup !== undefined && backup !== null && backup.length > 0) { Attr.set(element, 'content', backup); } else { // According to apple docs the default is: // width=980 // height=<calculated> // initial-scale=<calculated> // minimum-scale=0.25 // maximum-scale=5.0 // user-scalable yes // However just setting user-scalable seems to fix pinch zoom and who knows these defaults might change Attr.set(element, 'content', 'user-scalable=yes'); } }; return { maximize: maximize, restore: restore }; }; return { tag: tag }; } );