Home > front end >  How to put the three objects in a container
How to put the three objects in a container

Time:12-09

Three different objects, show different ICONS, delimit words different content respectively pop icon, how to merge into a container inside here

The original script address
Browser search extension

 
Var iconArraya=[
{
Name: 'baidu,
Image: 'https://i.ibb.co/R9HMTyR/1-5.png',
Popup: function (text) {
Open (' https://search.bilibili.com/live? Keyword='+ encodeURIComponent (text));
}
},
],
IconArrayb=[
{
Name: 'open',
Image: 'https://i.ibb.co/fxpm6Wc/image.png', host: [...],
Popup: function (text) {
If (text. IndexOf (" http://")==0 | | text. The indexOf (" https://")==0)
Window. The open (text, "_blank");
The else window. The open (" http://"+ text," _blank ");
}
},
],
IconArrayc=[
{
Name: 'copy'
Image: 'https://i.ibb.co/R0bq3jm/icons8-delete-512-1.png',
Host: ['],
Popup: function (text) {
Text=document. DefaultView. GetSelection (). The toString ();
Document. ExecCommand (' copy ', false, null)
}

},
],
HostCustomMap={};
IconArraya. ForEach (function (obj) {
Obj. Host. ForEach (function (the host) {
HostCustomMap [host]=obj. Custom;
});
});
IconArrayb. ForEach (function (obj) {
Obj. Host. ForEach (function (the host) {
HostCustomMap [host]=obj. Custom;
});
});
IconArrayc. ForEach (function (obj) {
Obj. Host. ForEach (function (the host) {
HostCustomMap [host]=obj. Custom;
});
});
Var text=GM_getValue (' search ');
If (text & amp; & Window. The location. The host in hostCustomMap) {
Keyword. BeforeCustom (hostCustomMap [window. The location. The host]);
}
Var icona=document. The createElement method (' div ');
Var iconb=document. The createElement method (' div ');
Var iconc=document. The createElement method (' div ');

IconArraya. ForEach (function (obj) {
Var img=document. The createElement method (" img ");
Img. SetAttribute (' SRC 'obj. Image).
Img. SetAttribute (' Alt 'obj. Name);
Img. SetAttribute (' title ', obj. Name);
Img. AddEventListener (" mouseup ", function () {
Keyword. BeforePopup (obj. Popup);
});
Img. SetAttribute (' style ', '+
'the cursor: pointer! Important; + '
'display: inline - block! Important; + '
'width: 22 px! Important; + '
'height: 22 px! Important; + '
'border: 0! Important; + '
'background - color: rgba (255255255, 1)! Important; + '
'the padding: 0! Important; + '
'margin: 0! Important; + '
'margin - right: 5 px! Important; + '
");
Icona. The appendChild (img);
});
IconArrayb. ForEach (function (obj) {
Var img=document. The createElement method (" img ");
Img. SetAttribute (' SRC 'obj. Image).
Img. SetAttribute (' Alt 'obj. Name);
Img. SetAttribute (' title ', obj. Name);
Img. AddEventListener (" mouseup ", function () {
Keyword. BeforePopup (obj. Popup);
});
Img. SetAttribute (' style ', '+
'the cursor: pointer! Important; + '
'display: inline - block! Important; + '
'width: 22 px! Important; + '
'height: 22 px! Important; + '
'border: 0! Important; + '
'background - color: rgba (255255255, 1)! Important; + '
'the padding: 0! Important; + '
'margin: 0! Important; + '
'margin - right: 5 px! Important; + '
");
Iconb. The appendChild (img);
});
IconArrayc. ForEach (function (obj) {
Var img=document. The createElement method (" img ");
Img. SetAttribute (' SRC 'obj. Image).
Img. SetAttribute (' Alt 'obj. Name);
Img. SetAttribute (' title ', obj. Name);
Img. AddEventListener (" mouseup ", function () {
Keyword. BeforePopup (obj. Popup);
});
Img. SetAttribute (' style ', '+
'the cursor: pointer! Important; + '
'display: inline - block! Important; + '
'width: 22 px! Important; + '
'height: 22 px! Important; + '
'border: 0! Important; + '
'background - color: rgba (255255255, 1)! Important; + '
'the padding: 0! Important; + '
'margin: 0! Important; + '
'margin - right: 5 px! Important; + '
");
Iconc. The appendChild (img);
});
Icona. SetAttribute (' style ', '+
'display: none! Important; + '
'the position: absolute! Important; + '
'the padding: 0! Important; + '
'margin: 0! Important; + '
'the font - size: 13 px! Important; + '
'the text - align: left! Important; + '
'border: 0! Important; + '
'background: transparent! Important; + '
'z - index: 2147483647!!! Important; + '
");
Iconb. SetAttribute (' style ', '+
'display: none! Important; + '
'the position: absolute! Important; + '
'the padding: 0! Important; + '
'margin: 0! Important; + '
'the font - size: 13 px! Important; + '
'the text - align: left! Important; + '
'border: 0! Important; + '
'background: transparent! Important; + '
'z - index: 2147483647!!! Important; + '
");
Iconc. SetAttribute (' style ', '+
'display: none! Important; + '
'the position: absolute! Important; + '
'the padding: 0! Important; + '
'margin: 0! Important; + '
'the font - size: 13 px! Important; + '
'the text - align: left! Important; + '
'border: 0! Important; + '
'background: transparent! Important; + '
'z - index: 2147483647!!! Important; + '
");
//added to the DOM
Document. The documentElement. The appendChild (icona);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related