-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added in numbers and date converters for toybox
- Loading branch information
1 parent
4d75101
commit 75db4a4
Showing
18 changed files
with
1,260 additions
and
29 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ | |
"40001": "4.0.0", | ||
"40002": "4.0.1", | ||
"50000": "5.0.0", | ||
"50001": "5.0.1" | ||
"50001": "5.0.1", | ||
"50002": "5.0.2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<ips:template parameters="$dates"/> | ||
<div class="ipsPadding ipsClearfix" data-ipstoolboxtoyboxdates > | ||
|
||
<h4>Date</h4> | ||
<div class="ipsMargin_top"> | ||
<label> | ||
<input id="date" type="datetime-local" value="{$dates['date']}" data-input="dates"> | ||
</label> | ||
</div> | ||
|
||
<h4>Unix</h4> | ||
<div class="ipsMargin_top"> | ||
<label> | ||
<input id="unix" type="number" value="{$dates['unix']}" data-input="unix"> | ||
</label> | ||
</div> | ||
|
||
<h4>ISO 8601</h4> | ||
<div class="ipsMargin_top"> | ||
<label> | ||
<input id="iso" type="text" value="{$dates['iso']}" data-input="iso"> | ||
</label> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<ips:template parameters="$output"/> | ||
<div class="ipsPadding ipsClearfix" data-ipstoolboxtoyboxnumbers> | ||
<div id="error" class="ipsMessage ipsMessage_error{{if !isset($output['error']) }} ipsHide{{endif}}"> | ||
{{$error = $output['error'] ?? '';}} | ||
{$error|raw} | ||
</div> | ||
<h4>Decimal</h4> | ||
<div class="ipsMargin_top"> | ||
{{$dec = $output['decimal'] ?? 0;}} | ||
<label> | ||
<input id="decimal" type="number" value="{$dec}" data-input="decimal"> | ||
</label> | ||
</div> | ||
<h4>Hexadecimal</h4> | ||
<div class="ipsMargin_top"> | ||
{{$hexa = $output['hexa'] ?? 0;}} | ||
<label> | ||
<input id="hexa" type="text" value="{$hexa}" data-input="hexa"> | ||
</label> | ||
</div> | ||
<h4>Ocatal</h4> | ||
<div class="ipsMargin_top"> | ||
<label> | ||
{{$octal = $output['octal'] ?? 0;}} | ||
<input id="octal" type="number" value="{$octal}" data-input="octal"> | ||
</label> | ||
</div> | ||
<h4>Binary</h4> | ||
<div class="ipsMargin_top"> | ||
<label> | ||
{{$binary = $output['binary'] ?? 0;}} | ||
<input id="binary" type="text" value="{$binary}" data-input="binary"> | ||
</label> | ||
</div> | ||
</div> |
69 changes: 69 additions & 0 deletions
69
dev/js/front/controllers/profiler/ips.ui.toolbox.toyboxdates.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
;( function($, _, undefined){ | ||
"use strict"; | ||
ips.createModule('ips.ui.toolbox.toyboxdates', () => { | ||
/** | ||
* Respond to a dialog trigger | ||
* | ||
* @param {element} elem The element this widget is being created on | ||
* @param {object} options The options passed | ||
* @param {event} e if lazyload, event that is fire | ||
* @returns {void} | ||
*/ | ||
const respond = (elem, options, e) => { | ||
let el = $(elem); | ||
if (!el.data('_loadedToyboxdates')) { | ||
let mobject = _objectToyboxdates(el, options); | ||
mobject.init(); | ||
el.data('_loadedToyboxdates', mobject); | ||
} | ||
}, | ||
/** | ||
* Retrieve the instance (if any) on the given element | ||
* | ||
* @param {element} elem The element to check | ||
* @returns {mixed} The instance or undefined | ||
*/ | ||
getObj = (elem) => { | ||
if( $( elem ).data('_loadedToyboxdates') ){ | ||
return $( elem ).data('_loadedToyboxdates'); | ||
} | ||
return undefined; | ||
}; | ||
|
||
// Register this module as a widget to enable the data API and | ||
// jQuery plugin functionality | ||
ips.ui.registerWidget( 'toolboxtoyboxdates', ips.ui.toolbox.toyboxdates, [] ); | ||
|
||
// Expose public methods | ||
return { | ||
respond: respond, | ||
getObj: getObj | ||
}; | ||
}); | ||
const _objectToyboxdates = function(elem, options) { | ||
let ajax = ips.getAjax(), | ||
init = () => { | ||
elem.on('keyup input propertychange change','[data-input]',_process); | ||
}, | ||
_process = (e) => { | ||
let target = $(e.currentTarget), | ||
type = target.attr('data-input'), | ||
number = target.val(), | ||
url = ips.getSetting('baseURL')+'index.php?app=toolbox&module=bt&controller=bt&do=dates&type='+type+'&time='+number; | ||
ajax({ | ||
type: "GET", | ||
url: url, | ||
bypassRedirect: true, | ||
success: function (data) { | ||
|
||
elem.find('#unix').val(data.unix); | ||
elem.find('#iso').val(data.iso); | ||
elem.find('#date').val(data.date); | ||
} | ||
}); | ||
}; | ||
return { | ||
init: init | ||
} | ||
}; | ||
}(jQuery, _)); |
77 changes: 77 additions & 0 deletions
77
dev/js/front/controllers/profiler/ips.ui.toolbox.toyboxnumbers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
;( function($, _, undefined){ | ||
"use strict"; | ||
ips.createModule('ips.ui.toolbox.toyboxnumbers', () => { | ||
/** | ||
* Respond to a dialog trigger | ||
* | ||
* @param {element} elem The element this widget is being created on | ||
* @param {object} options The options passed | ||
* @param {event} e if lazyload, event that is fire | ||
* @returns {void} | ||
*/ | ||
const respond = (elem, options, e) => { | ||
let el = $(elem); | ||
if (!el.data('_loadedToyboxnumbers')) { | ||
let mobject = _objectToyboxnumbers(el, options); | ||
mobject.init(); | ||
el.data('_loadedToyboxnumbers', mobject); | ||
} | ||
}, | ||
/** | ||
* Retrieve the instance (if any) on the given element | ||
* | ||
* @param {element} elem The element to check | ||
* @returns {mixed} The instance or undefined | ||
*/ | ||
getObj = (elem) => { | ||
if( $( elem ).data('_loadedToyboxnumbers') ){ | ||
return $( elem ).data('_loadedToyboxnumbers'); | ||
} | ||
return undefined; | ||
}; | ||
|
||
// Register this module as a widget to enable the data API and | ||
// jQuery plugin functionality | ||
ips.ui.registerWidget( 'toolboxtoyboxnumbers', ips.ui.toolbox.toyboxnumbers, [] ); | ||
|
||
// Expose public methods | ||
return { | ||
respond: respond, | ||
getObj: getObj | ||
}; | ||
}); | ||
const _objectToyboxnumbers = function(elem, options) { | ||
let ajax = ips.getAjax(), | ||
init = () => { | ||
elem.on('keyup input propertychange','[data-input]',_process); | ||
}, | ||
_process = (e) => { | ||
let target = $(e.currentTarget), | ||
type = target.attr('data-input'), | ||
number = target.val(), | ||
url = ips.getSetting('baseURL')+'index.php?app=toolbox&module=bt&controller=bt&do=numbers&type='+type+'&number='+number; | ||
ajax({ | ||
type: "GET", | ||
url: url, | ||
bypassRedirect: true, | ||
success: function (data) { | ||
_toolbox.l(data); | ||
|
||
if(data.hasOwnProperty('error')){ | ||
elem.find('#error').removeClass('ipsHide').html(data.error); | ||
} | ||
else{ | ||
elem.find('#error').addClass('ipsHide'); | ||
elem.find('#decimal').val(data.decimal); | ||
elem.find('#hexa').val(data.hexa); | ||
elem.find('#octal').val(data.octal); | ||
elem.find('#binary').val(data.binary); | ||
} | ||
} | ||
}); | ||
}; | ||
return { | ||
init: init | ||
} | ||
}; | ||
}(jQuery, _)); |
Oops, something went wrong.