PageSourceSearch

https://vlasti.net/ext/plugins/wp-user-avatar/js/wp-user-avatar.js?ver=1.4.02

js vlasti.net collected 2026-10-02 10:09:29 UTC 3,558 bytes, 85 lines download raw bytes

1function openMediaUploader(c) {
2    wp.media.wpUserAvatar = {
3        get: function() {
4            return wp.media.view.settings.post.wpUserAvatarId
5        },
6        set: function(a) {
7            var b = wp.media.view.settings;
8            b.post.wpUserAvatarId = a;
9            b.post.wpUserAvatarSrc = jQuery('div.attachment-info').find('img').attr('src');
10            if (b.post.wpUserAvatarId) {
11                setWPUserAvatar(b.post.wpUserAvatarId, b.post.wpUserAvatarSrc);
12                jQuery('#wp_user_avatar_radio').trigger('click')
13            }
14        },
15        frame: function() {
16            if (this._frame) {
17                return this._frame
18            }
19            this._frame = wp.media({
20                state: 'library',
21                states: [new wp.media.controller.Library({
22                    title: "Edit WP User Avatar: " + c
23                })]
24            });
25            this._frame.on('open', function() {
26                var a = this.state().get('selection');
27                id = jQuery('#wp-user-avatar').val();
28                attachment = wp.media.attachment(id);
29                attachment.fetch();
30                a.add(attachment ? [attachment] : [])
31            }, this._frame);
32            this._frame.on('toolbar:create:select', function(a) {
33                this.createSelectToolbar(a, {
34                    text: 'Set WP User Avatar'
35                })
36            }, this._frame);
37            this._frame.state('library').on('select', this.select);
38            return this._frame
39        },
40        select: function(a) {
41            var b = wp.media.view.settings
42              , selection = this.get('selection').single();
43            wp.media.wpUserAvatar.set(selection ? selection.id : -1)
44        },
45        init: function() {
46            jQuery('body').on('click', '#add-wp-user-avatar', function(e) {
47                e.preventDefault();
48                e.stopPropagation();
49                wp.media.wpUserAvatar.frame().open()
50            })
51        }
52    };
53    jQuery(wp.media.wpUserAvatar.init)
54}
55function openThickboxUploader(a, b) {
56    jQuery('#add-wp-user-avatar').click(function(e) {
57        e.preventDefault();
58        tb_show('Edit WP User Avatar: ' + a, b)
59    })
60}
61function setWPUserAvatar(a, b) {
62    jQuery('#wp-user-avatar', window.parent.document).val(a);
63    jQuery('#wp-user-avatar-preview', window.parent.document).find('img').attr('src', b).removeAttr('width', '').removeAttr('height', '');
64    jQuery('#wp-user-avatar-message', window.parent.document).show();
65    jQuery('#remove-wp-user-avatar', window.parent.document).show();
66    jQuery('#wp-user-avatar-thumbnail', window.parent.document).hide();
67    jQuery('#wp_user_avatar_radio', window.parent.document).trigger('click');
68    if (typeof (wp) != 'undefined') {
69        wp.media.wpUserAvatar.frame().close()
70    } else {
71        window.parent.tb_remove()
72    }
73}
74function removeWPUserAvatar(a) {
75  //  jQuery('body').on('click', '#remove-wp-user-avatar', function(e) {
76	jQuery('#remove-wp-user-avatar').click(function(e) {
77        e.preventDefault();
78        jQuery(this).hide();
79        jQuery('#edit-wp-user-avatar, #wp-user-avatar-thumbnail').hide();
80        jQuery('#wp-user-avatar-preview').find('img').attr('src', a).removeAttr('width', '').removeAttr('height', '');
81        jQuery('#wp-user-avatar').val('');
82        jQuery('#wp-user-avatar-message').show();
83        jQuery('#wp_user_avatar_radio').trigger('click')
84    })
85}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.