MCPcopy Index your code
hub / github.com/hoothin/UserScripts / buildConfigWin

Function buildConfigWin

Picviewer CE+/GM_config CN.js:245–375  ·  view source on GitHub ↗
(body, head)

Source from the content-addressed store, hash-verified

243
244 // Function to build the mighty config window :)
245 function buildConfigWin (body, head) {
246 var create = config.create,
247 fields = config.fields,
248 configId = config.id,
249 bodyWrapper = create('div', {id: configId + '_wrapper'});
250
251 // Append the style which is our default style plus the user style
252 head.appendChild(
253 create('style', {
254 type: 'text/css',
255 textContent: config.css.basic + config.css.stylish
256 }));
257
258 // Add header and title
259 bodyWrapper.appendChild(create('div', {
260 id: configId + '_header',
261 className: 'config_header block center'
262 }, config.title));
263
264 // Append elements
265 var section = bodyWrapper,
266 secNum = 0; // Section count
267 var lastParentNode = null;
268
269 // loop through fields
270 for (var id in fields) {
271 var field = fields[id],
272 settings = field.settings;
273
274 if (settings.section) { // the start of a new section
275 section = bodyWrapper.appendChild(create('div', {
276 className: 'section_header_holder',
277 id: configId + '_section_' + secNum
278 }));
279
280 if (Object.prototype.toString.call(settings.section) !== '[object Array]')
281 settings.section = [settings.section];
282
283 if (settings.section[0])
284 section.appendChild(create('div', {
285 className: 'section_header center',
286 id: configId + '_section_header_' + secNum
287 }, settings.section[0]));
288
289 if (settings.section[1])
290 section.appendChild(create('p', {
291 className: 'section_desc center',
292 id: configId + '_section_desc_' + secNum
293 }, settings.section[1]));
294 ++secNum;
295 }
296
297 if (settings.line == 'start' && lastParentNode) { // 切换到下一行
298 lastParentNode = null;
299 }
300
301 // Create field elements and append to current section
302 (lastParentNode || section).appendChild((field.wrapper = field.toNode(configId, lastParentNode)));

Callers 1

GM_config CN.jsFile · 0.85

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected