eslint
This commit is contained in:
parent
6afe85798a
commit
aa75d75448
@ -15,31 +15,31 @@ class PagesPie extends Component {
|
|||||||
delete params.replace;
|
delete params.replace;
|
||||||
}
|
}
|
||||||
if (Array.isArray(pages)) {
|
if (Array.isArray(pages)) {
|
||||||
for (let i in pages) {
|
for (let i in pages) {
|
||||||
this.pie.push({
|
this.pie.push({
|
||||||
Page: pages[i],
|
Page: pages[i],
|
||||||
params: params
|
params: params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.pie.push({
|
this.pie.push({
|
||||||
Page: pages,
|
Page: pages,
|
||||||
params: params
|
params: params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(this._mounted)
|
if(this._mounted)
|
||||||
this.forceUpdate()
|
this.forceUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount()
|
componentWillMount()
|
||||||
{
|
{
|
||||||
this._mounted = true
|
this._mounted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount()
|
componentWillUnmount()
|
||||||
{
|
{
|
||||||
this._mounted = false
|
this._mounted = false
|
||||||
}
|
}
|
||||||
|
|
||||||
close(count) {
|
close(count) {
|
||||||
if (count && typeof count === 'number') {
|
if (count && typeof count === 'number') {
|
||||||
@ -59,7 +59,7 @@ class PagesPie extends Component {
|
|||||||
}
|
}
|
||||||
// ОТРИСОВКА
|
// ОТРИСОВКА
|
||||||
render() {
|
render() {
|
||||||
if (this.pie.length > 0) {
|
if (this.pie.length > 0) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={'pie full-size ' + (this.props.className || '')}
|
className={'pie full-size ' + (this.props.className || '')}
|
||||||
|
@ -104,19 +104,19 @@ const treeToTorrentFiles = (tree, torrent, toggles) => {
|
|||||||
leftIcon={!tree[file].__fileBT ? <FileFolder /> : contentIcon(fileTypeDetect({path: file}))}
|
leftIcon={!tree[file].__fileBT ? <FileFolder /> : contentIcon(fileTypeDetect({path: file}))}
|
||||||
rightToggle={
|
rightToggle={
|
||||||
newToggles.length > 0
|
newToggles.length > 0
|
||||||
?
|
?
|
||||||
<Toggle
|
<Toggle
|
||||||
toggled={newToggles.every( ({selected}) => selected )}
|
toggled={newToggles.every( ({selected}) => selected )}
|
||||||
onToggle={(e, checked) => {
|
onToggle={(e, checked) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
let toggleValues = {}
|
let toggleValues = {}
|
||||||
newToggles.forEach(({downloadIndex}) => toggleValues[downloadIndex] = checked)
|
newToggles.forEach(({downloadIndex}) => toggleValues[downloadIndex] = checked)
|
||||||
window.torrentSocket.emit('downloadSelectFiles', torrent, toggleValues)
|
window.torrentSocket.emit('downloadSelectFiles', torrent, toggleValues)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
/>);
|
/>);
|
||||||
|
|
||||||
|
@ -302,13 +302,13 @@ export default class Torrent extends Component {
|
|||||||
node.onclick = () => { return false }
|
node.onclick = () => { return false }
|
||||||
}}>
|
}}>
|
||||||
<div className='column' style={{height: 'auto', whiteSpace: 'normal', paddingTop: '0.30em'}}>
|
<div className='column' style={{height: 'auto', whiteSpace: 'normal', paddingTop: '0.30em'}}>
|
||||||
{
|
{
|
||||||
torrent.info && torrent.info.name
|
torrent.info && torrent.info.name
|
||||||
&&
|
&&
|
||||||
<div className='row w100p inline fs0-85' style={{color: 'grey', padding: '4px 0px 5px'}}>
|
<div className='row w100p inline fs0-85' style={{color: 'grey', padding: '4px 0px 5px'}}>
|
||||||
{torrent.info.name}
|
{torrent.info.name}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<div className='row w100p inline'>
|
<div className='row w100p inline'>
|
||||||
<div style={{color: torrent.contentCategory != 'xxx' ? (torrent.peer ? '#5252d1' : 'black') : (torrent.peer ? '#9083e2' : 'grey')}}>
|
<div style={{color: torrent.contentCategory != 'xxx' ? (torrent.peer ? '#5252d1' : 'black') : (torrent.peer ? '#9083e2' : 'grey')}}>
|
||||||
{
|
{
|
||||||
@ -320,17 +320,17 @@ export default class Torrent extends Component {
|
|||||||
torrent.path && torrent.path.length > 0
|
torrent.path && torrent.path.length > 0
|
||||||
?
|
?
|
||||||
torrent.path.map((path, index) => {
|
torrent.path.map((path, index) => {
|
||||||
const boldRe = /\<b\>(.+?)\<\/b\>/g;
|
const boldRe = /\<b\>(.+?)\<\/b\>/g;
|
||||||
let boldText;
|
let boldText;
|
||||||
let newPath = [];
|
let newPath = [];
|
||||||
let idx = 0;
|
let idx = 0;
|
||||||
while ((boldText = boldRe.exec(path)) !== null) {
|
while ((boldText = boldRe.exec(path)) !== null) {
|
||||||
newPath.push(<span>{path.substring(idx, boldText.index)}</span>);
|
newPath.push(<span>{path.substring(idx, boldText.index)}</span>);
|
||||||
newPath.push(<b>{boldText[1]}</b>);
|
newPath.push(<b>{boldText[1]}</b>);
|
||||||
idx = boldRe.lastIndex;
|
idx = boldRe.lastIndex;
|
||||||
}
|
}
|
||||||
newPath.push(<span>{path.substring(idx, path.length)}</span>);
|
newPath.push(<span>{path.substring(idx, path.length)}</span>);
|
||||||
return <div key={index} className='break-word fs0-75' style={{paddingTop: '0.3em', marginLeft: '0.6em'}}>{newPath}</div>
|
return <div key={index} className='break-word fs0-75' style={{paddingTop: '0.3em', marginLeft: '0.6em'}}>{newPath}</div>
|
||||||
})
|
})
|
||||||
:
|
:
|
||||||
null
|
null
|
||||||
|
@ -30,7 +30,7 @@ export default (props) => {
|
|||||||
{
|
{
|
||||||
info.trackers.includes('rutor')
|
info.trackers.includes('rutor')
|
||||||
&&
|
&&
|
||||||
<a href={`http://www.rutor.is/torrent/${info.rutorThreadId}`}><img src={RutorIcon} style={{height: 32}} /></a>
|
<a href={`http://www.rutor.is/torrent/${info.rutorThreadId}`}><img src={RutorIcon} style={{height: 32}} /></a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -74,24 +74,24 @@ module.exports = async (callback, mainWindow, sphinxApp) => {
|
|||||||
}
|
}
|
||||||
#one {
|
#one {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
#long {
|
#long {
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
#canBreak {
|
#canBreak {
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
const {ipcRenderer} = require('electron')
|
const {ipcRenderer} = require('electron')
|
||||||
ipcRenderer.on('reindex', (e, data) =>{
|
ipcRenderer.on('reindex', (e, data) =>{
|
||||||
document.getElementById('one').innerHTML = \`Updating \${data.torrent ? 'torrent': 'file'} \${data.index} of \${data.all} [\${data.field} index]\`
|
document.getElementById('one').innerHTML = \`Updating \${data.torrent ? 'torrent': 'file'} \${data.index} of \${data.all} [\${data.field} index]\`
|
||||||
if(data.longTime)
|
if(data.longTime)
|
||||||
document.getElementById('long').innerHTML = 'This patch is very long, may be some hours. So you can take some cup of tea, while we perform db patch.'
|
document.getElementById('long').innerHTML = 'This patch is very long, may be some hours. So you can take some cup of tea, while we perform db patch.'
|
||||||
if(data.canBreak)
|
if(data.canBreak)
|
||||||
document.getElementById('canBreak').innerHTML = 'You can break this patch, and continue when you will have time to patch, it will be resumed.'
|
document.getElementById('canBreak').innerHTML = 'You can break this patch, and continue when you will have time to patch, it will be resumed.'
|
||||||
})
|
})
|
||||||
ipcRenderer.on('optimize', (e, data) =>{
|
ipcRenderer.on('optimize', (e, data) =>{
|
||||||
document.getElementById('one').innerHTML = \`Optimization for \${data.field}...\`
|
document.getElementById('one').innerHTML = \`Optimization for \${data.field}...\`
|
||||||
@ -108,9 +108,9 @@ module.exports = async (callback, mainWindow, sphinxApp) => {
|
|||||||
c4.416,0.15,17.979,1.621,17.683-4.273c-0.292-5.897-11.491-3.241-13.854-6.487c-2.359-3.234-10.023-15.504-7.366-21.104
|
c4.416,0.15,17.979,1.621,17.683-4.273c-0.292-5.897-11.491-3.241-13.854-6.487c-2.359-3.234-10.023-15.504-7.366-21.104
|
||||||
c2.65-5.59,12.674-21.229,24.463-22.988c11.789-1.777,42.451,7.361,47.459,0c5.012-7.372-6.783-11.512-15.918-28.611
|
c2.65-5.59,12.674-21.229,24.463-22.988c11.789-1.777,42.451,7.361,47.459,0c5.012-7.372-6.783-11.512-15.918-28.611
|
||||||
C243.779,80.572,238.768,71.728,220.195,71.427z"/>
|
C243.779,80.572,238.768,71.728,220.195,71.427z"/>
|
||||||
<div id="one"></div>
|
<div id="one"></div>
|
||||||
<div id="long"></div>
|
<div id="long"></div>
|
||||||
<div id="canBreak"></div>
|
<div id="canBreak"></div>
|
||||||
</svg>
|
</svg>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
|
||||||
module.exports = function deleteFolderRecursive(path) {
|
module.exports = function deleteFolderRecursive(path) {
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
fs.readdirSync(path).forEach(function(file, index){
|
fs.readdirSync(path).forEach(function(file, index){
|
||||||
var curPath = path + "/" + file;
|
var curPath = path + "/" + file;
|
||||||
if (fs.lstatSync(curPath).isDirectory()) { // recurse
|
if (fs.lstatSync(curPath).isDirectory()) { // recurse
|
||||||
deleteFolderRecursive(curPath);
|
deleteFolderRecursive(curPath);
|
||||||
} else { // delete file
|
} else { // delete file
|
||||||
fs.unlinkSync(curPath);
|
fs.unlinkSync(curPath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fs.rmdirSync(path);
|
fs.rmdirSync(path);
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -105,10 +105,10 @@ module.exports = class Feed {
|
|||||||
const relativeTime = (maxTime - time) / maxTime
|
const relativeTime = (maxTime - time) / maxTime
|
||||||
return (
|
return (
|
||||||
relativeTime * relativeTime
|
relativeTime * relativeTime
|
||||||
+ good * 1.5 * relativeTime
|
+ good * 1.5 * relativeTime
|
||||||
+ comments * 4 * relativeTime
|
+ comments * 4 * relativeTime
|
||||||
- bad * 0.6 * relativeTime
|
- bad * 0.6 * relativeTime
|
||||||
+ rating(good, bad)
|
+ rating(good, bad)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -551,7 +551,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
|||||||
path,
|
path,
|
||||||
pathIndex: path,
|
pathIndex: path,
|
||||||
size
|
size
|
||||||
}, function(err, result) {
|
}, function(err, result) {
|
||||||
if(!result) {
|
if(!result) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return
|
return
|
||||||
|
@ -59,14 +59,14 @@ module.exports = class Rutor
|
|||||||
if(!this.dataDirectory)
|
if(!this.dataDirectory)
|
||||||
return
|
return
|
||||||
|
|
||||||
if(!this.rutorMap && fs.existsSync(this.dataDirectory + '/rutor/rutor.x.json'))
|
if(!this.rutorMap && fs.existsSync(this.dataDirectory + '/rutor/rutor.x.json'))
|
||||||
{
|
{
|
||||||
let data = JSON.parse(fs.readFileSync(this.dataDirectory + '/rutor/rutor.x.json'))
|
let data = JSON.parse(fs.readFileSync(this.dataDirectory + '/rutor/rutor.x.json'))
|
||||||
this.rutorMap = data.hashes
|
this.rutorMap = data.hashes
|
||||||
logT('rutor', 'add records to', Object.keys(this.rutorMap).length)
|
logT('rutor', 'add records to', Object.keys(this.rutorMap).length)
|
||||||
}
|
}
|
||||||
else if(!this.rutorMap)
|
else if(!this.rutorMap)
|
||||||
this.rutorMap = {}
|
this.rutorMap = {}
|
||||||
|
|
||||||
if(page > 10)
|
if(page > 10)
|
||||||
{
|
{
|
||||||
@ -87,18 +87,18 @@ module.exports = class Rutor
|
|||||||
|
|
||||||
const rutorMap = this.rutorMap
|
const rutorMap = this.rutorMap
|
||||||
$('#index tr').each(function(i, elem) {
|
$('#index tr').each(function(i, elem) {
|
||||||
const row = $(this)
|
const row = $(this)
|
||||||
const nameField = row.find('td').next()
|
const nameField = row.find('td').next()
|
||||||
if(!nameField)
|
if(!nameField)
|
||||||
return
|
return
|
||||||
let id = nameField.find('a').attr('href')
|
let id = nameField.find('a').attr('href')
|
||||||
if(!id)
|
if(!id)
|
||||||
return
|
return
|
||||||
id = id.match(/download\/([0-9]+)/)[1]
|
id = id.match(/download\/([0-9]+)/)[1]
|
||||||
id = parseInt(id)
|
id = parseInt(id)
|
||||||
const hash = magnetParse(nameField.find('a').next().attr('href'))
|
const hash = magnetParse(nameField.find('a').next().attr('href'))
|
||||||
|
|
||||||
rutorMap[hash] = id
|
rutorMap[hash] = id
|
||||||
});
|
});
|
||||||
|
|
||||||
await mkdirp(`${this.dataDirectory}/rutor`)
|
await mkdirp(`${this.dataDirectory}/rutor`)
|
||||||
@ -130,12 +130,12 @@ module.exports = class Rutor
|
|||||||
|
|
||||||
let contentCategory
|
let contentCategory
|
||||||
$('#details tr').each(function(i, elem) {
|
$('#details tr').each(function(i, elem) {
|
||||||
const row = $(this)
|
const row = $(this)
|
||||||
const field = row.find('td.header').text()
|
const field = row.find('td.header').text()
|
||||||
if(field == 'Категория')
|
if(field == 'Категория')
|
||||||
{
|
{
|
||||||
contentCategory = row.find('td').next().text().trim()
|
contentCategory = row.find('td').next().text().trim()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user