PageSourceSearch

https://parcdejeurre.fr/js/get_image.js.php?theme=pmahomme

js parcdejeurre.fr collected 2026-09-26 20:48:12 UTC 6,435 bytes, 253 lines download raw bytes

1/**
2 * Returns an HTML IMG tag for a particular image from a theme,
3 * which may be an actual file or an icon from a sprite
4 *
5 * @param string image      The name of the file to get
6 * @param string alternate  Used to set 'alt' and 'title' attributes of the image
7 * @param object attributes An associative array of other attributes
8 *
9 * @return Object The requested image, this object has two methods:
10 *                  .toString()        - Returns the IMG tag for the requested image
11 *                  .attr(name)        - Returns a particular attribute of the IMG
12 *                                       tag given it's name
13 *                  .attr(name, value) - Sets a particular attribute of the IMG
14 *                                       tag to the given value
15 *                And one property:
16 *                  .isSprite          - Whether the image is a sprite or not
17 */
18function PMA_getImage(image, alternate, attributes) {
19    var in_array = function (needle, haystack) {
20        for (var i in haystack) {
21            if (haystack[i] == needle) {
22                return true;
23            }
24        }
25        return false;
26    };
27    var sprites = [
28        'asc_order',
29        'b_bookmark',
30        'b_browse',
31        'b_calendar',
32        'b_chart',
33        'b_close',
34        'b_column_add',
35        'b_comment',
36        'b_dbstatistics',
37        'b_deltbl',
38        'b_docs',
39        'b_docsql',
40        'b_drop',
41        'b_edit',
42        'b_empty',
43        'b_engine',
44        'b_event_add',
45        'b_events',
46        'b_export',
47        'b_favorite',
48        'b_find_replace',
49        'b_firstpage',
50        'b_ftext',
51        'b_group',
52        'b_help',
53        'b_home',
54        'b_import',
55        'b_index',
56        'b_index_add',
57        'b_info',
58        'b_inline_edit',
59        'b_insrow',
60        'b_lastpage',
61        'b_minus',
62        'b_more',
63        'b_move',
64        'b_newdb',
65        'b_newtbl',
66        'b_nextpage',
67        'b_no_favorite',
68        'b_pdfdoc',
69        'b_plus',
70        'b_prevpage',
71        'b_primary',
72        'b_print',
73        'b_props',
74        'b_relations',
75        'b_routine_add',
76        'b_routines',
77        'b_save',
78        'b_sbrowse',
79        'b_sdb',
80        'b_search',
81        'b_selboard',
82        'b_select',
83        'b_snewtbl',
84        'b_spatial',
85        'b_sql',
86        'b_sqldoc',
87        'b_sqlhelp',
88        'b_table_add',
89        'b_tblanalyse',
90        'b_tblexport',
91        'b_tblimport',
92        'b_tblops',
93        'b_tbloptimize',
94        'b_tipp',
95        'b_trigger_add',
96        'b_triggers',
97        'b_undo',
98        'b_unique',
99        'b_usradd',
100        'b_usrcheck',
101        'b_usrdrop',
102        'b_usredit',
103        'b_usrlist',
104        'b_view',
105        'b_view_add',
106        'b_views',
107        'bd_browse',
108        'bd_deltbl',
109        'bd_drop',
110        'bd_edit',
111        'bd_empty',
112        'bd_export',
113        'bd_firstpage',
114        'bd_ftext',
115        'bd_index',
116        'bd_insrow',
117        'bd_lastpage',
118        'bd_nextpage',
119        'bd_prevpage',
120        'bd_primary',
121        'bd_sbrowse',
122        'bd_select',
123        'bd_spatial',
124        'bd_unique',
125        'col_drop',
126        'database',
127        'eye',
128        'eye_grey',
129        'item',
130        'lightbulb',
131        'lightbulb_off',
132        'more',
133        'new_data',
134        'new_data_hovered',
135        'new_data_selected',
136        'new_data_selected_hovered',
137        'new_struct',
138        'new_struct_hovered',
139        'new_struct_selected',
140        'new_struct_selected_hovered',
141        'pause',
142        'php_sym',
143        'play',
144        's_asc',
145        's_asci',
146        's_attention',
147        's_cancel',
148        's_cancel2',
149        's_cog',
150        's_db',
151        's_desc',
152        's_error',
153        's_error2',
154        's_host',
155        's_info',
156        's_lang',
157        's_loggoff',
158        's_notice',
159        's_okay',
160        's_passwd',
161        's_process',
162        's_really',
163        's_reload',
164        's_replication',
165        's_rights',
166        's_sortable',
167        's_status',
168        's_success',
169        's_sync',
170        's_tbl',
171        's_theme',
172        's_top',
173        's_vars',
174        's_views',
175        'window-new'
176    ];
177    // custom image object, it will eventually be returned by this functions
178    var retval = {
179        data: {
180            // this is private
181            alt: '',
182            title: '',
183            src: (typeof PMA_TEST_THEME == 'undefined' ? '' : '../')
184                + 'themes/dot.gif'
185        },
186        isSprite: true,
187        attr: function (name, value) {
188            if (value == undefined) {
189                if (this.data[name] == undefined) {
190                    return '';
191                } else {
192                    return this.data[name];
193                }
194            } else {
195                this.data[name] = value;
196            }
197        },
198        toString: function () {
199            var retval = '<' + 'img';
200            for (var i in this.data) {
201                retval += ' ' + i + '="' + this.data[i] + '"';
202            }
203            retval += ' /' + '>';
204            return retval;
205        }
206    };
207    // initialise missing parameters
208    if (attributes == undefined) {
209        attributes = {};
210    }
211    if (alternate == undefined) {
212        alternate = '';
213    }
214    // set alt
215    if (attributes.alt != undefined) {
216        retval.attr('alt', attributes.alt);
217    } else {
218        retval.attr('alt', alternate);
219    }
220    // set title
221    if (attributes.title != undefined) {
222        retval.attr('title', attributes.title);
223    } else {
224        retval.attr('title', alternate);
225    }
226    // set src
227    var klass = image.replace('.gif', '').replace('.png', '');
228    if (in_array(klass, sprites)) {
229        // it's an icon from a sprite
230        retval.attr('class', 'icon ic_' + klass);
231    } else {
232        // it's an image file
233        retval.isSprite = false;
234        retval.attr(
235            'src',
236            "./themes/pmahomme/img/" + image
237        );
238    }
239    // set all other attrubutes
240    for (var i in attributes) {
241        if (i == 'src') {
242            // do not allow to override the 'src' attribute
243            continue;
244        } else if (i == 'class') {
245            retval.attr(i, retval.attr('class') + ' ' + attributes[i]);
246        } else {
247            retval.attr(i, attributes[i]);
248        }
249    }
250
251    return retval;
252}
253//

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.