所以我只有这个例子,但它确实是我想要做的;但它也做了很多其他的东西 - 并为错误的网站。 (这提供的js只是我知道的例子,我可能不知道如何获得"只有那个"片段而且只有那个)。
我想要一个小的js文本,我可以注入控制台弹出Firefox的CTRL-SHIFT-K,这将改变网站的背景图像(此脚本中使用的同一站点)。
但这就是我想要的。我只是想在网站上创建自己的背景。
这里的脚本确实改变了背景(它是开头的一个命令(背景图像JPG)。
我如何将其分离成一小段js ...我可以单独使用,只做那个而已,仅此而已?
我试图修改它,并且阅读了脚本JS,但我没有编码,所以我只是遇到了错误。
任何帮助都会非常感激! :)
背景代码行从LINE 45-46开始。 - 这就是我想要的 - 只有一个小小的文字只做背景,一切都消失了
谢谢!
var flameBot, betspeed, aftermanualtrigger, swaplosscount, swapcount, loop, loopenabled, betData, condition, profit, target, losscount, totalloss, totalwin, currentbet, basebet, mainmult, initmult, result, afterwin, UI = '',
UI2 = '';
profit = 0;
var streakcounter = [];
var balance;
var winstreak = 0;
betspeed = 613;
loopcount = 0;
betstarted = false;
loopenabled = false;
aftermanualtrigger = false;
afterwin = false;
var consecutive = 0,
singlewin = 0;
swaplosscount = 0;
var conseclossenabled = false;
var swapnextwin = false;
swapcount = 0;
var firstInit = true;
if (firstInit == true) {
balance = Math.floor($('div.hero span.btn__text.select div').text()*1e8);
}
flameBot = {
initialize: {
init1: function () {
var lib = '<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/dark-hive/jquery-ui.css" /><script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>';
$(lib).appendTo('head');
setTimeout(function () {
flameBot.initialize.init2();
}, 1000);
},
init2: function () {
losscount = 0;
totalloss = 0;
totalwin = 0;
$('.hero__main').empty().css('width', '550px') & $('.hero__main').css("padding", "0") & $(UI).appendTo('.hero__main') &
$('#flameBot').tabs() & $('button').button().css('font-size', '13px').css('padding', '5px');
$('#stats th').css("width", "20%").css("font-size", "14px");
$('#hilo, #resetorzero').buttonset();
$('#flameBot li').css('font-size', '15px');
$('#flameBot #resetorzero').css('font-size', '13px');
$('#flameBot div[role=tabpanel] td').css('padding', 1);
$('.hero__main').css('margin-top', '-75px');
$('#stats2 th').css('width', '6.25%');
var css = '',
backgroundurl = 'http://cdn.wonderfulengineering.com/wp-content/uploads/2014/01/HD-backgrounds-3.jpg';
css += '<style id="paraDark">';
css += 'header, .tabs, .slideout__content__inside, .chat__you *, .btn, .hero__main, .rollrow-dark, .rollbox--prominent, .chat__input-holder{background-color:#121212 !important;color:#ccc !important;}';
css += 'time{color:#ccc !important;}';
css += 'div.tabs > div > div.live-data-header > div{background-color:#111111;border-top:1px solid #777; border-bottom:1px solid #777;}';
css += '.btn,.btn--secondary.btn--active,.btn--secondary.btn--selector, .btn--submit:last-child{border:1px solid #777 !important;background-color:#242130 !important;color:#ccc!important;}';
css += '.btn:hover,.btn--secondary.btn--active:hover,.btn--secondary.btn--selector:hover{border:1px solid #777 !important;background-color:#322E47 !important;color:#ccc!important;}';
css += '.hero{margin-bottom:0px;background:url("' + backgroundurl + '") no-repeat 50% 50%;}';
css += '.slideout *{color:#ccc;}';
css += '.tabs{padding-top:20px;border-top:1px solid #777 !important;}';
css += 'header{border: 1px solid #777 !important;border-left:none !important;border-right:none !important;}';
css += '.rollrow-thin, .rollrow-dark .chat__input-holder {background-color:#212121;}';
css += '.input{background-color:#323232 !important;color:#ccc;}';
css += '.action-open-slideout{background-color:#121212 !important;}';
css += 'span.admin{color:white !important}';
css += '</style>';
$(css).appendTo('head');
$('#stats2, #stats3').css('margin-left', '10px');
$('#stats3 th').css('width', '25%').css('text-align', 'center');
$('#stats3').css('width', '50%').css('text-align', 'center');
$('<center><button onclick="flameBot.API.bet();" class="btn btn--primary btn--huge btn--limited btn--block text--center" id="spinner2">Roll</button></center>').appendTo('.hero__main');
$('#resetorzero').css('font-size', '11px');
$('#lastbet th').css('text-align', 'center');
$('#lastbet th').css('padding', '3px');
$('#lastbet tr').css('border-top', '1px solid #fff');
$('#lastbet3 > tbody > tr').css('background', '#181818', 'important');
$('#lastbet2 > tbody').css('background', '#181818');
$('.hero__main').css('border', '1px solid #777');
for (i = 0; i < $('#stats2 th').length; i++) {
streakcounter.push(0);
}
for (i = 0; i < $('#stats2 th').length; i++) {
var lol = $('#stats2 th')[i];
lol.textContent = (i + 1).toString() + "(" + streakcounter[i] + ")";
}
$('#resetstats').click(function () {
streakcounter = [];
for (i = 0; i < $('#stats2 th').length; i++) {
streakcounter.push(0);
}
for (i = 0; i < $('#stats2 th').length; i++) {
var lol = $('#stats2 th')[i];
lol.textContent = (i + 1).toString() + "(" + streakcounter[i] + ")";
}
totalwin = 0;
totalloss = 0;
profit = 0;
consecutive = 0,
singlewin = 0;
winstreak = 0;
losscount = 0;
flameBot.API.addRow();
});
$('#start').click(function () {
looptimes = 999999999;
if (loopenabled === false) {
loopenabled = true;
loop = setInterval(function () {
if (loopcount >= looptimes) {
clearInterval(loop);
loopcount = 0;
loopenabled = false;
} else {
if (betstarted === true) {} else {
flameBot.API.bet();
}
}
}, betspeed);
}
});
$('#stop').click(function () {
clearInterval(loop);
loopenabled = false;
loopcount = 0;
});
$('#setparams').click(function () {
flameBot.API.setParams();
})
}
},
tools: {
dec2Sat: function (decimal) {
return (Math.floor(decimal * 1e8));
},
token: function () {
return localStorage.token;
},
satToDec: function (satoshi) {
return ((satoshi / 1e8).toFixed(8));
},
},
API: {
onLoss: function () {
totalloss++;
losscount++;
if (afterwin === true) {
afterwin = false;
flameBot.API.setParams();
}
if (winstreak >= 2) {
consecutive++;
$('#consecutive').text(consecutive);
winstreak = 0;
}
if (winstreak == 1) {
singlewin++;
$('#single').text(singlewin);
winstreak = 0;
}
if ($('#swaplossesenabled').is(':checked') === true) {
swaplosscount++;
if (swaplosscount >= $('#swaplosses').val()) {
swapnextwin = true;
swaplosscount = 0;
}
}
if ($('#afterlossesenabled').is(':checked') === true) {
if (losscount >= $('#afterlosses').val()) {
if ($('#aftermanualenabled').is(':checked') === true) {
if (aftermanualtrigger === true) {} else {
var r = prompt("Enter '1' to reset to base. Enter '2' to bet 0 until win. Enter '3' to stop.");
if (r == 1) {
aftermanualtrigger = false;
currentbet = basebet;
losscount = 0;
} else if (r == 2) {
aftermanualtrigger = true;
currentbet = 0;
} else {
clearInterval(loop);
aftermanualtrigger = false;
loopenabled = false;
}
}
} else {
if ($('input:radio[name=resetorzero]:checked').val() == 'orzero') {
currentbet = 0;
} else if ($('input:radio[name=resetorzero]:checked').val() == 'orstop') {
clearInterval(loop);
loopenabled = false;
} else if ($('input:radio[name=resetorzero]:checked').val() == 'resetor') {
losscount = 0;
currentbet = basebet;
}
}
} else {
if (losscount == $('#startlosses').val()) {
currentbet = currentbet * $('#initialmultiplier').val();
} else if (losscount > $('#startlosses').val()) {
currentbet = currentbet * $('#mainmultiplier').val();
}
}
} else {
if (losscount == $('#startlosses').val()) {
currentbet = currentbet * $('#initialmultiplier').val();
} else if (losscount > $('#startlosses').val()) {
currentbet = currentbet * $('#mainmultiplier').val();
}
}
flameBot.API.addRow();
},
onWin: function () {
if ($('#betdivisorenabled').is(':checked') === true) {
basebet = Math.floor(balance/$('#betdivisor').val());
}
winstreak++;
conseclossenabled = false;
if (swapnextwin === true) {
flameBot.API.swap();
swapnextwin = false;
}
if ($('#afterwinenabled').is(':checked') == true) {
if (afterwin === false) {
afterwin = true;
}
}
if (aftermanualtrigger === true) {
aftermanualtrigger = false
}
totalwin++;
swaplosscount = 0;
var streak = losscount;
if (losscount >= 250) {
losscount = 250;
}
streakcounter[losscount - 1] ++;
losscount = 0;
currentbet = basebet;
flameBot.API.addRow();
},
setParams: function () {
losscount = 0;
aftermanualtrigger = false;
swaplosscount = 0;
swapcount = 0;
initmult = $('#initialmultiplier').val();
mainmult = $('#mainmultiplier').val();
if ($('#betdivisorenabled').is(':checked') === true) {
basebet = Math.floor(balance/$('#betdivisor').val());
currentbet = basebet;
} else {
basebet = flameBot.tools.dec2Sat($('#basebet').val());
currentbet = basebet;
}
if ($('input:radio[name=hilo]:checked').val() == 'hi') {
condition = '>';
target = (99.99 - (99 / $('#chance').val())).toFixed(2);
} else if ($('input:radio[name=hilo]:checked').val() == 'lo') {
condition = '<';
target = (99 / $('#chance').val()).toFixed(2);
} else if ($('input:radio[name=hilo]:checked').val() == 'swap') {
condition = '<';
target = 0 + (99 / $('#chance').val()).toFixed(2);
}
},
addRow: function () {
var bettable = '',
bettab = '#lastbet2';
bettable += '<tr><td>' + flameBot.tools.satToDec(result.bet.amount) + '</td>';
bettable += '<td>' + result.bet.multiplier + 'x' + '</td>'; /* return bet payout */
bettable += '<td>' + (result.bet.target).toFixed(2) + '</td>'; /* return target*/
bettable += '<td>' + result.bet.roll + '</td>'; /* return roll */
bettable += '<td id="proff">' + flameBot.tools.satToDec(result.bet.profit) + '</td></tr>';
var stattable = '',
stattab = '#lastbet3';
stattable += '<tr><td style="color:blue;">' + flameBot.tools.satToDec(result.user.balance) + '</td><td style="color:white;">' + losscount + '</td><td style="color:blue;">' + totalwin + '</td><td style="color:white;">' + totalloss + '</td><td id="profit">' + (profit).toFixed(8) + '</td></tr>';
$(stattab).empty();
$(stattab).prepend(stattable);
stattable = '';
if ($(bettab + ' tbody tr').length >= 30) {
$(bettab + ' tr').last().remove();
$(bettab).prepend(bettable);
bettable = '';
} else if ($(bettab).length < 30) {
$(bettab).prepend(bettable);
bettable = '';
}
for (i = 0; i < $('#stats2 th').length; i++) {
var lol = $('#stats2 th')[i];
lol.textContent = (i + 1).toString() + "(" + streakcounter[i] + ")";
}
$('#stats2 th:nth-child(19)').text('>' + $('#stats2 th:nth-child(19)').text());
$('#lastbet2 *, #lastbet3 *, #lastbet *, #proff').css('text-align', 'center');
$('#lastbet2 *, #lastbet3 *, #lastbet *').css('width', '20%');
$('#lastbet *').css('padding', '5px');
$('#lastbet *').css('border-bottom', '1px solid #ccc');
$('#result-1').css('padding', '5px');
$('#lastbet2 *, #lastbet3 *, #proff').css('padding', '5px');
$('#lastbet > tbody > tr > th:nth-child(2)').css('border-top', '1px solid #ddd');
if (profit >= 0) {
$('#profit').css('color', 'blue');
} else {
$('#profit').css('color', 'white');
}
if (result.bet.win === true) {
$('#proff:first').css('color', 'blue');
} else {
$('#proff:first').css('color', 'white');
}
betstarted = false;
},
bet: function () {
betstarted = true;
if ($('#maxbetenabled').is(':checked') === true) {
if ((currentbet / 1e8) >= $('#maxbet').val()) {
$('#setparams').click();
}
}
if ($('#afterwinenabled').is(':checked') === true) {
if (afterwin === true) {
currentbet = ($('#afterwinamount').val() * 1e8).toFixed(8);
}
}
if ($('#clossenabled').is(':checked') === true) {
if (losscount >= $('#clossafter').val()) {
if (conseclossenabled === false) {
conseclossenabled = true;
currentbet = Math.floor($('#clossbet').val() * 1e8);
}
}
}
var betData = {
amount: currentbet,
condition: condition,
target: target,
};
$.ajax({
url: 'https://api.primedice.com/api/bet?access_token=' + flameBot.tools.token(),
type: 'POST',
data: betData,
datatype: 'jsonp',
success: function (data) {
result = data;
balance = result.user.balance;
profit = parseFloat(profit) + parseFloat(flameBot.tools.satToDec(data.bet.profit));
if ($('input:radio[name=hilo]:checked').val() == 'swap') {
swapcount++;
if (swapcount >= $('#swapevery').val()) {
flameBot.API.swap();
swapcount = 0;
}
}
if (data.bet.win === true) {
$('span.btn__text.select div').text(flameBot.tools.satToDec(result.user.balance)).css('color', 'blue');
flameBot.API.onWin();
} else {
$('span.btn__text.select div').text(flameBot.tools.satToDec(result.user.balance)).css('color', 'white');
flameBot.API.onLoss();
}
},
error: function (errorThrown) {
betstarted = false;
}
});
},
seedChange: function () {
function seedgen() {
var seed = '';
var seedlength = 10;
var charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()';
for (var i = 0; i <= seedlength; i++)
seed += charset.charAt(Math.floor(Math.random() * charset.length));
return seed;
}
var s = seedgen(),
url = 'https://api.primedice.com/api/seed?access_token=' + localStorage.token,
sData = {
seed: s
};
$.ajax({
url: url,
type: 'POST',
data: sData,
datatype: 'json',
success: function (data, textStatus, jqXHR) {
data2 = data;
$('#currentseed').val(data2.seeds.client);
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
});
},
swap: function () {
if (condition == '<') {
condition = '>';
target = (99.99 - (99 / $('#chance').val())).toFixed(2);
} else if (condition == '>') {
condition = '<';
target = (99 / $('#chance').val()).toFixed(2);
}
},
}
}
var UI = '';
UI += '<table style="margin:0; text-align:center; border-bottom: 1px solid #fff;border-top: 1px solid #fff;"id="stats">';
UI += '<thead><tr><th style="text-align:center;padding:3px;">Balance</th><th style="text-align:center;padding:3px;">Loss Streak</th><th style="text-align:center;padding:3px;">Total Wins</th><th style="text-align:center;padding:3px;">Total Losses</th><th style="text-align:center;">Total Profit</th></tr></thead><tbody></tbody><table id="lastbet3"></table></table>';
UI += '<table id="lastbet">';
UI += '<tr><th>Bet</th><th>Payout</th><th>Game</th><th>Roll</th><th>Profit</th></tr></table>';
UI += '<div style="max-height:150px !important;font-size:12px;overflow-y: scroll;overflow-x: hidden;"><table id="lastbet2"></table></div>';
UI += '<div id="flameBot" style="width:550px"><ul><li>';
UI += '<a href="/play#basic">Basic Settings</a></li>';
UI += '<li><a href="/play#onloss">On Loss</a></li>';
UI += '<li><a href="/play#onlosstreak">Loss - Adv.</a></li>';
UI += '<li><a href="/play#onwin">On Win</a></li>';
//UI += '<li style="margin:8px;font-size:9px;margin-left:15px;text-align:center;"><span>FlameBot - v1.0</span></li>';
UI += '</ul>';
UI += '<div id="basic" style="font-size:17.5px;">';
UI += '<table style="display:table;"><thead><tr><th>Basebet: </th><th>Chance:</th></tr></thead><tbody><tr><td><input id="basebet" placeholder="ex. 0.00001000" type="text"></td><td><input id="chance" placeholder="ex. 10 for 10x, 2 for 2x, etc." type="text"></td></tr></tbody><thead><tr><th>High/Low/Swap:</th><th>Swap Every:</th></tr></thead><tbody><tr><td><div id="hilo"><input type="radio" id="hi" value="hi" name="hilo"><label for="hi">High</label> <input type="radio" id="lo" value="lo" name="hilo" checked="checked"><label for="lo">Low</label> <input type="radio" id="swap" value="swap" name="hilo"><label for="swap">Swap</label> </div></td><td><input id="swapevery" placeholder="# of rolls" type="text"></td></tr></tbody></table></div>';
UI += '<div id="onloss" style="font-size:17.5px;">';
UI += '<table style="display:table;"><thead><tr><th>Start Multipling: </th><th>Main Multiplier:</th></tr></thead><tbody><tr><td><input id="startlosses" style="text-align:center;" placeholder="after # of losses"type="text"></td><td><input id="mainmultiplier" style="text-align:center;" placeholder="2, 4, etc."type="text"></td></tr></tbody><thead><tr><th>Initial Multiplier</th><th>Max Bet: <input type="checkbox" id="maxbetenabled"></th></tr></thead><tbody><tr><td><input id="initialmultiplier" style="text-align:center;" placeholder="2, 4, etc."type="text"></td><td><input id="maxbet" style="text-align:center;" placeholder="ex. 0.001" type="text"></td></tr><tr><th>After: <input type="checkbox" id="clossenabled"></th><th>Change Bet To:</th></tr></thead></tr><tbody><tr><td><input id="clossafter" style="text-align:center;" placeholder="# of consecutive loss"type="text"></td><td><input id="clossbet" style="text-align:center;" placeholder="ex. 0.00100000"type="text"></td></tr></tbody></tbody><thead><tr><th>Divisible Basebet:</th><th>Basebet Divisor:</th></tr></thead><tbody><tr><td><input id="betdivisorenabled" style="text-align:center;" type="checkbox"></td><td><input id="betdivisor" style="text-align:center;" placeholder="ex. 0.00100000"type="text"></td></tr></tbody></tbody></table>';
UI += '</div>';
UI += '<div id="onlosstreak" style="font-size:17.5px;">';
UI += '<table style="display:table;"><thead><tr><th>After: <input type="checkbox" id="afterlossesenabled"></th><th>Either: </th></tr></thead><tbody><tr><td><input id="afterlosses" style="text-align:center;" placeholder="# of losses"type="text"></td><td><div id="resetorzero"><input type="radio" id="resetor" value="resetor" name="resetorzero"><label for="resetor">Reset to Base</label><input type="radio" id="orzero" value="orzero" name="resetorzero" checked="checked"><label for="orzero">Roll 0 to Win</label><input type="radio" id="orstop" value="orstop" name="resetorzero" checked="checked"><label for="orstop">Stop</label></div></td></tr></tbody><thead><tr><th>Manualy Choose?</th><th>Swap After: <input id="swaplossesenabled" type="checkbox"></th></tr></thead><tbody><tr><td><input id="aftermanualenabled" type="checkbox"></td><td><input id="swaplosses" style="text-align:center;" placeholder="# of losses" type="text"></td></tr></tbody></table>';
UI += '</div>';
UI += '<div style="font-size:17.5px;" id="onwin">';
UI += '<table style="display:table;"><thead><tr><th>After Win:</th><th>Bet X Until Loss </th></tr></thead><tbody><tr><td><input type="checkbox" id="afterwinenabled"></td><td><input type="text" placeholder="ex. 0.00002000" id="afterwinamount"></td></tr></tbody></table>';
UI += '</div>';
UI += '<div id="controlstat">';
UI += '<center><div id="toolbar" class="ui-widget-header ui-corner-all"><div id="buttonz"><span id="startstop"><button id="start">Start</button><button id="stop">Stop</button></span><span id="set"><button id="setparams">Set Params</button><button id="resetstats">Reset Stats</button><br><button id="save">Save Settings</button><button id="load">Load Settings</button></div></center><br>';
UI += '<table style="margin:3px;"id="stats2">';
UI += '<span style="font-weight:bold;">Loss Streaks:</span>';
UI += '<thead><tr><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>10</th></tr>';
UI += '<tr><th>11</th><th>12</th><th>13</th><th>14</th><th>15</th><th>16</th><th>17</th><th>18</th><th>19</th><th>20</th></tr>';
UI += '<tr><th>21</th><th>22</th><th>23</th><th>24</th><th>25</th><th>26</th><th>27</th><th>28</th><th>29</th><th>30</th></tr>';
UI += '<tr><th>31</th><th>32</th><th>33</th><th>34</th><th>35</th><th>36</th><th>37</th><th>38</th><th>39</th><th>40</th></tr>';
UI += '<tr><th>41</th><th>42</th><th>43</th><th>44</th><th>45</th><th>46</th><th>47</th><th>48</th><th>49</th><th>50</th></tr>';
UI += '<tr><th>51</th><th>52</th><th>53</th><th>54</th><th>55</th><th>56</th><th>57</th><th>58</th><th>59</th><th>60</th></tr>';
UI += '<tr><th>61</th><th>62</th><th>63</th><th>64</th><th>65</th><th>66</th><th>67</th><th>68</th><th>69</th><th>70</th></tr>';
UI += '<tr><th>71</th><th>72</th><th>73</th><th>74</th><th>75</th><th>76</th><th>77</th><th>78</th><th>79</th><th>80</th></tr>';
UI += '<tr><th>81</th><th>82</th><th>83</th><th>84</th><th>85</th><th>86</th><th>87</th><th>88</th><th>89</th><th>90</th></tr>';
UI += '<tr><th>91</th><th>92</th><th>93</th><th>94</th><th>95</th><th>96</th><th>97</th><th>98</th><th>99</th><th>100</th></tr></thead></table>';
UI += '<table style="margin:3px;"id="stats3">';
UI += '<span style="font-weight:bold;">Wins:</span>';
UI += '<thead><tr><th>Single:</th><th>Consecutive:</th></tr>';
UI += '<tr><th id="single">0</th><th id="consecutive">0</th></tr></thead></table>';
UI += '</div>';
UI += '</div>';
flameBot.initialize.init1();
&#13;
背景代码行从LINE 45-46开始。
谢谢!
答案 0 :(得分:0)
我可以在控制台中注入的小js文本弹出Firefox的CTRL-SHIFT-K,这将改变网站的背景图像(此脚本中使用的相同网站)
您发布的代码(在查看页面源之后)是一个静态HTML页面。您可以通过在第36行添加以下内容来更改该html的背景图像。
$('body').css('background-image','url(path/to/yourimage.png)');
示例:
flameBot = {
initialize: {
init1: function () {
var lib = '<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/dark-hive/jquery-ui.css" /><script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>';
$('body').css('background-image','url(path/to/yourimage.png)');
$(lib).appendTo('head');
setTimeout(function () {
flameBot.initialize.init2();
}, 1000);
},
但是,这只能用作静态HTML页面(就像在浏览器上打开文本文件一样,除非您使用新图像进行操作)。