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

Function gFlashVars

FlashViewer-HTML5 Video/flashViewer.user.js:1382–1421  ·  view source on GitHub ↗
(oValue, add)

Source from the content-addressed store, hash-verified

1380
1381 // 生成新的flashvars字符串
1382 function gFlashVars(oValue, add) {
1383 if (!oValue) return add;
1384 if (!add) return oValue;
1385
1386 // 转成数组 ['a=1', 'b=2', 'c=']之类的形式
1387 oValue = oValue.split('&');
1388 add = add.split('&');
1389
1390 // 转成字典 {a:'1', b:'2', c:''}之类的形式
1391 var oVDict = {};
1392
1393 function gDict(kv) {
1394 if (!kv) return;
1395
1396 var index = kv.indexOf('=');
1397 if (index == -1) {
1398 if (kv !=' ') {
1399 oVDict[kv] = '';
1400 };
1401 } else {
1402 if (index > 0) {
1403 oVDict[kv.slice(0, index)] = kv.slice(index + 1);
1404 };
1405 };
1406 };
1407
1408 // 用新的值覆盖旧的值
1409 oValue.forEach(gDict);
1410 add.forEach(gDict);
1411
1412 // 转会字符串
1413 var fVars = [];
1414 for (var key in oVDict) {
1415 if (!oVDict.hasOwnProperty(key)) continue;
1416 fVars.push(key + '=' + oVDict[key]);
1417 };
1418 fVars = fVars.join('&');
1419
1420 return fVars;
1421 };
1422
1423 if (matched.hasOwnProperty('allowFullscreen')) {
1424 var af = matched.allowFullscreen;

Callers 2

addParamOFunction · 0.85
initializerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected