PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / assets / js / media-hints.js

media-hints.js in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at assets/js/media-hints.js

141 lines 7.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function() {
2
3 //#region \0rolldown/runtime.js
4 var __defProp = Object.defineProperty;
5 var __name = (target, value) => __defProp(target, "name", {
6 value,
7 configurable: true
8 });
9
10 //#endregion
11
12 //#region node_modules/@babel/runtime/helpers/esm/typeof.js
13 function _typeof(o) {
14 "@babel/helpers - typeof";
15 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
16 return typeof o;
17 } : function(o) {
18 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
19 }, _typeof(o);
20 }
21
22 //#endregion
23 //#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js
24 function toPrimitive(t, r) {
25 if ("object" != _typeof(t) || !t) return t;
26 var e = t[Symbol.toPrimitive];
27 if (void 0 !== e) {
28 var i = e.call(t, r || "default");
29 if ("object" != _typeof(i)) return i;
30 throw new TypeError("@@toPrimitive must return a primitive value.");
31 }
32 return ("string" === r ? String : Number)(t);
33 }
34
35 //#endregion
36 //#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
37 function toPropertyKey(t) {
38 var i = toPrimitive(t, "string");
39 return "symbol" == _typeof(i) ? i : i + "";
40 }
41
42 //#endregion
43 //#region node_modules/@babel/runtime/helpers/esm/defineProperty.js
44 function _defineProperty(e, r, t) {
45 return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
46 value: t,
47 enumerable: !0,
48 configurable: !0,
49 writable: !0
50 }) : e[r] = t, e;
51 }
52
53 //#endregion
54 //#region assets/dev/js/admin/hints/media.js
55 function ownKeys(e, r) {
56 var t = Object.keys(e);
57 if (Object.getOwnPropertySymbols) {
58 var o = Object.getOwnPropertySymbols(e);
59 r && (o = o.filter(function(r) {
60 return Object.getOwnPropertyDescriptor(e, r).enumerable;
61 })), t.push.apply(t, o);
62 }
63 return t;
64 }
65 function _objectSpread(e) {
66 for (var r = 1; r < arguments.length; r++) {
67 var t = null != arguments[r] ? arguments[r] : {};
68 r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
69 _defineProperty(e, r, t[r]);
70 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
71 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
72 });
73 }
74 return e;
75 }
76 (function(_elementorAdminHints, _wp) {
77 if (!((_elementorAdminHints = elementorAdminHints) !== null && _elementorAdminHints !== void 0 && _elementorAdminHints.mediaHint)) return;
78 if (!((_wp = wp) !== null && _wp !== void 0 && (_wp = _wp.media) !== null && _wp !== void 0 && (_wp = _wp.view) !== null && _wp !== void 0 && (_wp = _wp.Attachment) !== null && _wp !== void 0 && _wp.Details)) return;
79 wp.media.view.Attachment.Details = wp.media.view.Attachment.Details.extend({
80 _tmpl: "<div class=\"e-hint__container\" style=\"clear:both\" data-event=\"<%= dismissible %>\">\n <div class=\"elementor-control-notice elementor-control-notice-type-<%= type %>\" data-display=\"<%= display %>\">\n <div class=\"elementor-control-notice-icon\">\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M2.25 9H3M9 2.25V3M15 9H15.75M4.2 4.2L4.725 4.725M13.8 4.2L13.275 4.725M7.27496 12.75H10.725M6.75 12C6.12035 11.5278 5.65525 10.8694 5.42057 10.1181C5.1859 9.36687 5.19355 8.56082 5.44244 7.81415C5.69133 7.06748 6.16884 6.41804 6.80734 5.95784C7.44583 5.49764 8.21294 5.25 9 5.25C9.78706 5.25 10.5542 5.49764 11.1927 5.95784C11.8312 6.41804 12.3087 7.06748 12.5576 7.81415C12.8065 8.56082 12.8141 9.36687 12.5794 10.1181C12.3448 10.8694 11.8796 11.5278 11.25 12C10.9572 12.2899 10.7367 12.6446 10.6064 13.0355C10.4761 13.4264 10.4397 13.8424 10.5 14.25C10.5 14.6478 10.342 15.0294 10.0607 15.3107C9.77936 15.592 9.39782 15.75 9 15.75C8.60218 15.75 8.22064 15.592 7.93934 15.3107C7.65804 15.0294 7.5 14.6478 7.5 14.25C7.56034 13.8424 7.52389 13.4264 7.3936 13.0355C7.2633 12.6446 7.04282 12.2899 6.75 12Z\" stroke=\"currentColor\" stroke-width=\"1.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n </div>\n <div class=\"elementor-control-notice-main action-handler\" data-event=\"<%= button_event %>\" data-settings=\"<%= button_data %>\">\n <div class=\"elementor-control-notice-main-content\"><%= content %></div>\n <div class=\"elementor-control-notice-main-actions\">\n <% if ( typeof(button_text) !== \"undefined\" ) { %>\n <button class=\"e-btn e-<%= type %> e-btn-1\">\n <%= button_text %>\n </button>\n <% } %>\n </div>\n </div>\n <button class=\"elementor-control-notice-dismiss\" data-event=\"<%= dismissible %>\" aria-label=\"<%= dismiss %>\">\n <i class=\"eicon eicon-close\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>",
81 template: function template(view) {
82 var html = wp.media.template("attachment-details")(view);
83 var dom = document.createElement("div");
84 dom.innerHTML = html;
85 if (!this.shouldDisplayHint(view)) return dom.innerHTML;
86 var hint = document.createElement("div");
87 hint.classList.add("e-hint");
88 hint.innerHTML = _.template(this._tmpl)(elementorAdminHints.mediaHint);
89 dom.querySelector(".attachment-info").appendChild(hint);
90 return dom.innerHTML;
91 },
92 events: _objectSpread(_objectSpread({}, wp.media.view.Attachment.Details.prototype.events), {}, {
93 "click .elementor-control-notice-dismiss": "dismiss",
94 "click .e-hint__container a": "onHintAnchorClick",
95 "click .e-hint__container button.e-btn-1": "onHintAction"
96 }),
97 shouldDisplayHint: function shouldDisplayHint(view) {
98 var _elementorAdminHints2;
99 if (!elementorAdminHints || !((_elementorAdminHints2 = elementorAdminHints) !== null && _elementorAdminHints2 !== void 0 && _elementorAdminHints2.mediaHint)) return false;
100 if (window.elementorHints !== void 0) return false;
101 if (view.type !== "image") return false;
102 if (elementorAdminHints.mediaHint.display) return true;
103 return this.imageNotOptimized(view);
104 },
105 imageNotOptimized: function imageNotOptimized(attachment) {
106 var checks = {
107 height: 1080,
108 width: 1920,
109 filesizeInBytes: 1e5
110 };
111 return Object.keys(checks).some(function(key) {
112 var value = attachment[key] || false;
113 return value && value > checks[key];
114 });
115 },
116 onHintAction: function onHintAction(event) {
117 event.preventDefault();
118 var b64Settings = event.target.closest(".action-handler").dataset.settings;
119 var settings = atob(b64Settings);
120 var _JSON$parse$action_ur = JSON.parse(settings).action_url;
121 var actionURL = _JSON$parse$action_ur === void 0 ? null : _JSON$parse$action_ur;
122 if (actionURL) window.open(actionURL, "_blank");
123 this.dismiss(event);
124 },
125 onHintAnchorClick: function onHintAnchorClick(event) {
126 this.dismiss(event);
127 },
128 dismiss: function dismiss(event) {
129 elementorCommon.ajax.addRequest("dismissed_editor_notices", { data: { dismissId: event.target.closest(".e-hint__container").dataset.event } });
130 this.hideHint(event);
131 },
132 hideHint: function hideHint(event) {
133 event.target.closest(".e-hint__container").remove();
134 window.elementorHints = {};
135 }
136 });
137 })();
138
139 //#endregion
140 })();
141 //# sourceMappingURL=media-hints.js.map