summaryrefslogtreecommitdiff
path: root/lib/scripts
diff options
context:
space:
mode:
authorMichal Rezler <rezlemic@fel.cvut.cz>2011-03-27 13:57:35 +0200
committerMichal Rezler <rezlemic@fel.cvut.cz>2011-03-27 13:57:35 +0200
commit11bf24d856a6a4cb606bc6fe10ebcbd844f4127f (patch)
treef5254cfa12a72b660f2907660b0d2317f73795fa /lib/scripts
parentfdfb9c6a2877dcbadeab697aad779bea76780965 (diff)
downloadrpg-11bf24d856a6a4cb606bc6fe10ebcbd844f4127f.tar.gz
rpg-11bf24d856a6a4cb606bc6fe10ebcbd844f4127f.tar.bz2
helpers.js was removed - it basically contained functions they are implemented in jQuery library
Diffstat (limited to 'lib/scripts')
-rw-r--r--lib/scripts/edit.js2
-rw-r--r--lib/scripts/helpers.js146
-rw-r--r--lib/scripts/media.js22
-rw-r--r--lib/scripts/toolbar.js4
4 files changed, 24 insertions, 150 deletions
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js
index 45c1fb111..8516fd186 100644
--- a/lib/scripts/edit.js
+++ b/lib/scripts/edit.js
@@ -90,7 +90,7 @@ function createPicker(id,props,edid){
btn.appendChild(ico);
addEvent(btn,'click',bind(pickerInsert,key,edid));
picker.appendChild(btn);
- }else if(isString(list[key])){
+ }else if(typeof (list[key]) == 'string'){
// a list of text -> treat as text picker
var btn = document.createElement('button');
btn.className = 'pickerbutton';
diff --git a/lib/scripts/helpers.js b/lib/scripts/helpers.js
deleted file mode 100644
index 129964d29..000000000
--- a/lib/scripts/helpers.js
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- * Differrent helper functions
- *
- * @author Ilya Lebedev <ilya@lebedev.net>
- * @license LGPL
- */
-//-----------------------------------------------------------------------------
-// Variable/property checks
-//-----------------------------------------------------------------------------
-/**
- * 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
- */
-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
- */
-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
- */
-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
- */
-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
- */
-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
- */
-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
- */
-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
- */
-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
- */
-function isEmpty (prop /* :Object */) /* :Boolean */ {
- if (isBoolean(prop)) return false;
- if (isRegExp(prop) && new RegExp("").toString() == prop.toString()) return true;
- if (isString(prop) || isNumber(prop)) return !prop;
- if (Boolean(prop)&&false != prop) {
- for (var i in prop) if(prop.hasOwnProperty(i)) return false;
- }
- return true;
-}
-
-/**
- * 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]);
- };
-}
-
-/**
- * Very simplistic Flash plugin check, probably works for Flash 8 and higher only
- */
-function hasFlash(version){
- var ver = 0;
- try{
- if(navigator.plugins != null && navigator.plugins.length > 0){
- ver = navigator.plugins["Shockwave Flash"].description.split(' ')[2].split('.')[0];
- }else{
- var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
- ver = axo.GetVariable("$version").split(' ')[1].split(',')[0];
- }
- }catch(e){ }
-
- if(ver >= version) return true;
- return false;
-}
diff --git a/lib/scripts/media.js b/lib/scripts/media.js
index a9b8b49da..f407aa2f7 100644
--- a/lib/scripts/media.js
+++ b/lib/scripts/media.js
@@ -11,7 +11,7 @@
* @author Pierre Spring <pierre.spring@caillou.ch>
*/
(function ($) {
- var toggle, list, prepare_content, insert, confirmattach, attachoptions, initpopup, updatehide, setalign, setsize, inSet, outSet, media_manager;
+ var toggle, list, prepare_content, insert, confirmattach, attachoptions, initpopup, updatehide, setalign, setsize, inSet, outSet, media_manager, hasFlash;
var media_manager = {
keepopen: false,
@@ -156,6 +156,26 @@
btn.value = LANG['mediainsert'];
btnp.appendChild(btn);
};
+
+ // moved from helpers.js temporarily here
+ /**
+ * Very simplistic Flash plugin check, probably works for Flash 8 and higher only
+ *
+ */
+ hasFlash = function(version){
+ var ver = 0;
+ try{
+ if(navigator.plugins != null && navigator.plugins.length > 0){
+ ver = navigator.plugins["Shockwave Flash"].description.split(' ')[2].split('.')[0];
+ }else{
+ var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+ ver = axo.GetVariable("$version").split(' ')[1].split(',')[0];
+ }
+ }catch(e){ }
+
+ if(ver >= version) return true;
+ return false;
+ };
/**
* Insert the clicked image into the opener's textarea
diff --git a/lib/scripts/toolbar.js b/lib/scripts/toolbar.js
index 795e105df..9b6afef30 100644
--- a/lib/scripts/toolbar.js
+++ b/lib/scripts/toolbar.js
@@ -42,7 +42,7 @@ function initToolbar(tbid,edid,tb, allowblock){
// type is a tb function -> assign it as onclick
actionFunc = 'tb_'+tb[i]['type'];
- if( isFunction(window[actionFunc]) ){
+ if( jQuery.isFunction(window[actionFunc]) ){
addEvent(btn,'click', bind(window[actionFunc],btn,tb[i],edid));
toolbar.appendChild(btn);
continue;
@@ -50,7 +50,7 @@ function initToolbar(tbid,edid,tb, allowblock){
// type is a init function -> execute it
actionFunc = 'addBtnAction'+tb[i]['type'].charAt(0).toUpperCase()+tb[i]['type'].substring(1);
- if( isFunction(window[actionFunc]) ){
+ if( jQuery.isFunction(window[actionFunc]) ){
if(window[actionFunc](btn, tb[i], edid)){
toolbar.appendChild(btn);
}