--- a/wp/wp-includes/js/utils.js Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/js/utils.js Mon Oct 14 18:28:13 2019 +0200
@@ -1,8 +1,13 @@
-/* global userSettings */
+/**
+ * Cookie functions.
+ *
+ * @output wp-includes/js/utils.js
+ */
+
+/* global userSettings, getAllUserSettings, wpCookies, setUserSetting */
/* exported getUserSetting, setUserSetting, deleteUserSetting */
-// utility functions
-var wpCookies = {
+window.wpCookies = {
// The following functions are from Cookie.js class in TinyMCE 3, Moxiecode, used under LGPL.
each: function( obj, cb, scope ) {
@@ -134,7 +139,7 @@
};
// Returns the value as string. Second arg or empty string is returned when value is not set.
-function getUserSetting( name, def ) {
+window.getUserSetting = function( name, def ) {
var settings = getAllUserSettings();
if ( settings.hasOwnProperty( name ) ) {
@@ -146,12 +151,12 @@
}
return '';
-}
+};
// Both name and value must be only ASCII letters, numbers or underscore
// and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
// The value is converted and stored as string.
-function setUserSetting( name, value, _del ) {
+window.setUserSetting = function( name, value, _del ) {
if ( 'object' !== typeof userSettings ) {
return false;
}
@@ -181,18 +186,17 @@
wpCookies.set( 'wp-settings-time-' + uid, userSettings.time, 31536000, path, '', secure );
return name;
-}
+};
-function deleteUserSetting( name ) {
+window.deleteUserSetting = function( name ) {
return setUserSetting( name, '', 1 );
-}
+};
// Returns all settings as js object.
-function getAllUserSettings() {
+window.getAllUserSettings = function() {
if ( 'object' !== typeof userSettings ) {
return {};
}
return wpCookies.getHash( 'wp-settings-' + userSettings.uid ) || {};
-}
-
+};