Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
61a2640a
Commit
61a2640a
authored
13 years ago
by
Michael Hamann
Browse files
Options
Downloads
Patches
Plain Diff
Undo whitespace changes in readded (old) js files
parent
2ec63414
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/scripts/drag.js
+30
-30
30 additions, 30 deletions
lib/scripts/drag.js
lib/scripts/helpers.js
+75
-75
75 additions, 75 deletions
lib/scripts/helpers.js
with
105 additions
and
105 deletions
lib/scripts/drag.js
+
30
−
30
View file @
61a2640a
/**
* Makes a DOM object draggable
*
* If you just want to move objects around, use drag.attach. For full
* customization, drag can be used as a javascript prototype, it is
* inheritance-aware.
*
* @link http://nofunc.org/Drag_Drop/
*/
* Makes a DOM object draggable
*
* If you just want to move objects around, use drag.attach. For full
* customization, drag can be used as a javascript prototype, it is
* inheritance-aware.
*
* @link http://nofunc.org/Drag_Drop/
*/
var
drag
=
{
obj
:
null
,
handle
:
null
,
oX
:
0
,
// object X position
oY
:
0
,
// object Y position
eX
:
0
,
// event X delta
eY
:
0
,
// event Y delta
oX
:
0
,
// object X position
oY
:
0
,
// object Y position
eX
:
0
,
// event X delta
eY
:
0
,
// event Y delta
/**
* Attaches the needed handlers to the given object
*
* This can be called for multiple objects, the right one is later
* determined from the event itself. The handle is optional
*
* @param DOMObject obj The object that should be draggable
* @param DOMObject handle A handle on which the obj can be dragged
*/
* Attaches the needed handlers to the given object
*
* This can be called for multiple objects, the right one is later
* determined from the event itself. The handle is optional
*
* @param DOMObject obj
The object that should be draggable
* @param DOMObject handle A handle on which the obj can be dragged
*/
attach
:
function
(
obj
,
handle
)
{
if
(
handle
){
handle
.
dragobject
=
obj
;
...
...
@@ -35,8 +35,8 @@ var drag = {
},
/**
* Starts the dragging operation
*/
* Starts the dragging operation
*/
start
:
function
(
e
){
this
.
handle
=
e
.
target
;
if
(
this
.
handle
.
dragobject
){
...
...
@@ -46,7 +46,7 @@ var drag = {
}
this
.
handle
.
className
+=
'
ondrag
'
;
this
.
obj
.
className
+=
'
ondrag
'
;
this
.
obj
.
className
+=
'
ondrag
'
;
this
.
oX
=
parseInt
(
this
.
obj
.
style
.
left
);
this
.
oY
=
parseInt
(
this
.
obj
.
style
.
top
);
...
...
@@ -62,11 +62,11 @@ var drag = {
},
/**
* Ends the dragging operation
*/
* Ends the dragging operation
*/
stop
:
function
(){
this
.
handle
.
className
=
this
.
handle
.
className
.
replace
(
/
?
ondrag/
,
''
);
this
.
obj
.
className
=
this
.
obj
.
className
.
replace
(
/
?
ondrag/
,
''
);
this
.
obj
.
className
=
this
.
obj
.
className
.
replace
(
/
?
ondrag/
,
''
);
removeEvent
(
document
,
'
mousemove
'
,
this
.
mousehandlers
[
0
]);
removeEvent
(
document
,
'
mouseup
'
,
this
.
mousehandlers
[
1
]);
this
.
obj
=
null
;
...
...
@@ -74,12 +74,12 @@ var drag = {
},
/**
* Moves the object during the dragging operation
*/
* Moves the object during the dragging operation
*/
drag
:
function
(
e
)
{
if
(
this
.
obj
)
{
this
.
obj
.
style
.
top
=
(
e
.
pageY
+
this
.
oY
-
this
.
eY
+
'
px
'
);
this
.
obj
.
style
.
top
=
(
e
.
pageY
+
this
.
oY
-
this
.
eY
+
'
px
'
);
this
.
obj
.
style
.
left
=
(
e
.
pageX
+
this
.
oX
-
this
.
eX
+
'
px
'
);
}
}
};
\ No newline at end of file
};
This diff is collapsed.
Click to expand it.
lib/scripts/helpers.js
+
75
−
75
View file @
61a2640a
/**
* Differrent helper functions
*
* @author Ilya Lebedev <ilya@lebedev.net>
* @license LGPL
*/
* Differrent helper functions
*
* @author Ilya Lebedev <ilya@lebedev.net>
* @license LGPL
*/
//-----------------------------------------------------------------------------
// Variable/property checks
//
Variable/property checks
//-----------------------------------------------------------------------------
/**
*
Checks if property is undefined
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is undefined
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isUndefined
(
prop
/* :Object */
)
/* :Boolean */
{
return
(
typeof
prop
==
'
undefined
'
);
}
/**
*
Checks if property is function
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is function
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isFunction
(
prop
/* :Object */
)
/* :Boolean */
{
return
(
typeof
prop
==
'
function
'
);
}
/**
*
Checks if property is string
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is string
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isString
(
prop
/* :Object */
)
/* :Boolean */
{
return
(
typeof
prop
==
'
string
'
);
}
/**
*
Checks if property is number
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is number
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isNumber
(
prop
/* :Object */
)
/* :Boolean */
{
return
(
typeof
prop
==
'
number
'
);
}
/**
*
Checks if property is the calculable number
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is the calculable number
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isNumeric
(
prop
/* :Object */
)
/* :Boolean */
{
return
isNumber
(
prop
)
&&!
isNaN
(
prop
)
&&
isFinite
(
prop
);
}
/**
*
Checks if property is array
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is array
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isArray
(
prop
/* :Object */
)
/* :Boolean */
{
return
(
prop
instanceof
Array
);
}
/**
*
Checks if property is regexp
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is regexp
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isRegExp
(
prop
/* :Object */
)
/* :Boolean */
{
return
(
prop
instanceof
RegExp
);
}
/**
*
Checks if property is a boolean value
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is a boolean value
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isBoolean
(
prop
/* :Object */
)
/* :Boolean */
{
return
(
'
boolean
'
==
typeof
prop
);
}
/**
*
Checks if property is a scalar value (value that could be used as the hash key)
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is a scalar value (value that could be used as the hash key)
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isScalar
(
prop
/* :Object */
)
/* :Boolean */
{
return
isNumeric
(
prop
)
||
isString
(
prop
);
}
/**
*
Checks if property is empty
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
*
Checks if property is empty
*
*
@param {Object} prop value to check
*
@return {Boolean} true if matched
*
@scope public
*/
function
isEmpty
(
prop
/* :Object */
)
/* :Boolean */
{
if
(
isBoolean
(
prop
))
return
false
;
if
(
isRegExp
(
prop
)
&&
new
RegExp
(
""
).
toString
()
==
prop
.
toString
())
return
true
;
...
...
@@ -115,12 +115,12 @@ function isEmpty (prop /* :Object */) /* :Boolean */ {
}
/**
*
Checks if property is derived from prototype, applies method if it is not exists
*
*
@param string property name
*
@return bool true if prototyped
*
@access public
*/
*
Checks if property is derived from prototype, applies method if it is not exists
*
*
@param string property name
*
@return bool true if prototyped
*
@access public
*/
if
(
'
undefined
'
==
typeof
Object
.
hasOwnProperty
)
{
Object
.
prototype
.
hasOwnProperty
=
function
(
prop
)
{
return
!
(
'
undefined
'
==
typeof
this
[
prop
]
||
this
.
constructor
&&
this
.
constructor
.
prototype
[
prop
]
&&
this
[
prop
]
===
this
.
constructor
.
prototype
[
prop
]);
...
...
@@ -128,8 +128,8 @@ if ('undefined' == typeof Object.hasOwnProperty) {
}
/**
* Very simplistic Flash plugin check, probably works for Flash 8 and higher only
*/
* Very simplistic Flash plugin check, probably works for Flash 8 and higher only
*/
function
hasFlash
(
version
){
var
ver
=
0
;
try
{
...
...
@@ -143,4 +143,4 @@ function hasFlash(version){
if
(
ver
>=
version
)
return
true
;
return
false
;
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment