Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gpt
large_projects
gitlabhq1
Commits
d5d84828
Commit
d5d84828
authored
7 years ago
by
Jacob Schatz
Browse files
Options
Download
Email Patches
Plain Diff
Fixes no this eslint error on new version of eslint.
parent
9c5ba799
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
97 deletions
+100
-97
app/assets/javascripts/commit/image_file.js
app/assets/javascripts/commit/image_file.js
+100
-97
No files found.
app/assets/javascripts/commit/image_file.js
View file @
d5d84828
...
...
@@ -23,6 +23,106 @@ export default class ImageFile {
});
};
})(
this
));
this
.
initViews
();
}
initViews
()
{
this
.
views
=
{
'
two-up
'
:
function
()
{
return
$
(
'
.two-up.view .wrap
'
,
this
.
file
).
each
((
function
(
_this
)
{
return
function
(
index
,
wrap
)
{
$
(
'
img
'
,
wrap
).
each
(
function
()
{
var
currentWidth
;
currentWidth
=
$
(
this
).
width
();
if
(
currentWidth
>
availWidth
/
2
)
{
return
$
(
this
).
width
(
availWidth
/
2
);
}
});
return
_this
.
requestImageInfo
(
$
(
'
img
'
,
wrap
),
function
(
width
,
height
)
{
$
(
'
.image-info .meta-width
'
,
wrap
).
text
(
width
+
"
px
"
);
$
(
'
.image-info .meta-height
'
,
wrap
).
text
(
height
+
"
px
"
);
return
$
(
'
.image-info
'
,
wrap
).
removeClass
(
'
hide
'
);
});
};
})(
this
));
},
'
swipe
'
:
function
()
{
var
maxHeight
,
maxWidth
;
maxWidth
=
0
;
maxHeight
=
0
;
return
$
(
'
.swipe.view
'
,
this
.
file
).
each
((
function
(
_this
)
{
return
function
(
index
,
view
)
{
var
$swipeWrap
,
$swipeBar
,
$swipeFrame
,
wrapPadding
,
ref
;
ref
=
_this
.
prepareFrames
(
view
),
maxWidth
=
ref
[
0
],
maxHeight
=
ref
[
1
];
$swipeFrame
=
$
(
'
.swipe-frame
'
,
view
);
$swipeWrap
=
$
(
'
.swipe-wrap
'
,
view
);
$swipeBar
=
$
(
'
.swipe-bar
'
,
view
);
$swipeFrame
.
css
({
width
:
maxWidth
+
16
,
height
:
maxHeight
+
28
});
$swipeWrap
.
css
({
width
:
maxWidth
+
1
,
height
:
maxHeight
+
2
});
// Set swipeBar left position to match image frame
$swipeBar
.
css
({
left
:
1
});
wrapPadding
=
parseInt
(
$swipeWrap
.
css
(
'
right
'
).
replace
(
'
px
'
,
''
),
10
);
_this
.
initDraggable
(
$swipeBar
,
wrapPadding
,
function
(
e
,
left
)
{
if
(
left
>
0
&&
left
<
$swipeFrame
.
width
()
-
(
wrapPadding
*
2
))
{
$swipeWrap
.
width
((
maxWidth
+
1
)
-
left
);
$swipeBar
.
css
(
'
left
'
,
left
);
}
});
};
})(
this
));
},
'
onion-skin
'
:
function
()
{
var
dragTrackWidth
,
maxHeight
,
maxWidth
;
maxWidth
=
0
;
maxHeight
=
0
;
dragTrackWidth
=
$
(
'
.drag-track
'
,
this
.
file
).
width
()
-
$
(
'
.dragger
'
,
this
.
file
).
width
();
return
$
(
'
.onion-skin.view
'
,
this
.
file
).
each
((
function
(
_this
)
{
return
function
(
index
,
view
)
{
var
$frame
,
$track
,
$dragger
,
$frameAdded
,
framePadding
,
ref
,
dragging
=
false
;
ref
=
_this
.
prepareFrames
(
view
),
maxWidth
=
ref
[
0
],
maxHeight
=
ref
[
1
];
$frame
=
$
(
'
.onion-skin-frame
'
,
view
);
$frameAdded
=
$
(
'
.frame.added
'
,
view
);
$track
=
$
(
'
.drag-track
'
,
view
);
$dragger
=
$
(
'
.dragger
'
,
$track
);
$frame
.
css
({
width
:
maxWidth
+
16
,
height
:
maxHeight
+
28
});
$
(
'
.swipe-wrap
'
,
view
).
css
({
width
:
maxWidth
+
1
,
height
:
maxHeight
+
2
});
$dragger
.
css
({
left
:
dragTrackWidth
});
$frameAdded
.
css
(
'
opacity
'
,
1
);
framePadding
=
parseInt
(
$frameAdded
.
css
(
'
right
'
).
replace
(
'
px
'
,
''
),
10
);
_this
.
initDraggable
(
$dragger
,
framePadding
,
function
(
e
,
left
)
{
var
opacity
=
left
/
dragTrackWidth
;
if
(
opacity
>=
0
&&
opacity
<=
1
)
{
$dragger
.
css
(
'
left
'
,
left
);
$frameAdded
.
css
(
'
opacity
'
,
opacity
);
}
});
};
})(
this
));
}
};
}
initViewModes
()
{
...
...
@@ -94,103 +194,6 @@ export default class ImageFile {
});
return
[
maxWidth
,
maxHeight
];
}
// eslint-disable-next-line
views
=
{
'
two-up
'
:
function
()
{
return
$
(
'
.two-up.view .wrap
'
,
this
.
file
).
each
((
function
(
_this
)
{
return
function
(
index
,
wrap
)
{
$
(
'
img
'
,
wrap
).
each
(
function
()
{
var
currentWidth
;
currentWidth
=
$
(
this
).
width
();
if
(
currentWidth
>
availWidth
/
2
)
{
return
$
(
this
).
width
(
availWidth
/
2
);
}
});
return
_this
.
requestImageInfo
(
$
(
'
img
'
,
wrap
),
function
(
width
,
height
)
{
$
(
'
.image-info .meta-width
'
,
wrap
).
text
(
width
+
"
px
"
);
$
(
'
.image-info .meta-height
'
,
wrap
).
text
(
height
+
"
px
"
);
return
$
(
'
.image-info
'
,
wrap
).
removeClass
(
'
hide
'
);
});
};
})(
this
));
},
'
swipe
'
:
function
()
{
var
maxHeight
,
maxWidth
;
maxWidth
=
0
;
maxHeight
=
0
;
return
$
(
'
.swipe.view
'
,
this
.
file
).
each
((
function
(
_this
)
{
return
function
(
index
,
view
)
{
var
$swipeWrap
,
$swipeBar
,
$swipeFrame
,
wrapPadding
,
ref
;
ref
=
_this
.
prepareFrames
(
view
),
maxWidth
=
ref
[
0
],
maxHeight
=
ref
[
1
];
$swipeFrame
=
$
(
'
.swipe-frame
'
,
view
);
$swipeWrap
=
$
(
'
.swipe-wrap
'
,
view
);
$swipeBar
=
$
(
'
.swipe-bar
'
,
view
);
$swipeFrame
.
css
({
width
:
maxWidth
+
16
,
height
:
maxHeight
+
28
});
$swipeWrap
.
css
({
width
:
maxWidth
+
1
,
height
:
maxHeight
+
2
});
// Set swipeBar left position to match image frame
$swipeBar
.
css
({
left
:
1
});
wrapPadding
=
parseInt
(
$swipeWrap
.
css
(
'
right
'
).
replace
(
'
px
'
,
''
),
10
);
_this
.
initDraggable
(
$swipeBar
,
wrapPadding
,
function
(
e
,
left
)
{
if
(
left
>
0
&&
left
<
$swipeFrame
.
width
()
-
(
wrapPadding
*
2
))
{
$swipeWrap
.
width
((
maxWidth
+
1
)
-
left
);
$swipeBar
.
css
(
'
left
'
,
left
);
}
});
};
})(
this
));
},
'
onion-skin
'
:
function
()
{
var
dragTrackWidth
,
maxHeight
,
maxWidth
;
maxWidth
=
0
;
maxHeight
=
0
;
dragTrackWidth
=
$
(
'
.drag-track
'
,
this
.
file
).
width
()
-
$
(
'
.dragger
'
,
this
.
file
).
width
();
return
$
(
'
.onion-skin.view
'
,
this
.
file
).
each
((
function
(
_this
)
{
return
function
(
index
,
view
)
{
var
$frame
,
$track
,
$dragger
,
$frameAdded
,
framePadding
,
ref
,
dragging
=
false
;
ref
=
_this
.
prepareFrames
(
view
),
maxWidth
=
ref
[
0
],
maxHeight
=
ref
[
1
];
$frame
=
$
(
'
.onion-skin-frame
'
,
view
);
$frameAdded
=
$
(
'
.frame.added
'
,
view
);
$track
=
$
(
'
.drag-track
'
,
view
);
$dragger
=
$
(
'
.dragger
'
,
$track
);
$frame
.
css
({
width
:
maxWidth
+
16
,
height
:
maxHeight
+
28
});
$
(
'
.swipe-wrap
'
,
view
).
css
({
width
:
maxWidth
+
1
,
height
:
maxHeight
+
2
});
$dragger
.
css
({
left
:
dragTrackWidth
});
$frameAdded
.
css
(
'
opacity
'
,
1
);
framePadding
=
parseInt
(
$frameAdded
.
css
(
'
right
'
).
replace
(
'
px
'
,
''
),
10
);
_this
.
initDraggable
(
$dragger
,
framePadding
,
function
(
e
,
left
)
{
var
opacity
=
left
/
dragTrackWidth
;
if
(
opacity
>=
0
&&
opacity
<=
1
)
{
$dragger
.
css
(
'
left
'
,
left
);
$frameAdded
.
css
(
'
opacity
'
,
opacity
);
}
});
};
})(
this
));
}
}
requestImageInfo
(
img
,
callback
)
{
const
domImg
=
img
.
get
(
0
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment