Saves the value of the edit input and saves it to the db
@param {HTMLElement} todoEl The todo element to edit
@returns {void}
779675
function(todoEl) {
			var todoId = getClosestTodoId(todoEl),
				editInputEl = todoEl.querySelector('.edit'),
				newTitle = (editInputEl.value).trim();

			todoEl.querySelector('label').textContent = newTitle;
			todosDB.edit(todoId, newTitle);
		}
246214
function insertTemplate( html ) {
			var dialog = CKEDITOR.dialog.getCurrent(),
				isReplace = dialog.getValueOf( 'selectTpl', 'chkInsertOpt' );

			if ( isReplace ) {
				editor.fire( 'saveSnapshot' );
				// Everything should happen after the document is loaded (#4073).
				editor.setData( html, function() {
					dialog.hide();

					// Place the cursor at the first editable place.
					var range = editor.createRange();
					range.moveToElementEditStart( editor.editable() );
					range.select();
					setTimeout( function() {
						editor.fire( 'saveSnapshot' );
					}, 0 );

				} );
			} else {
				editor.insertHtml( html );
				dialog.hide();
			}
		}
395467
function tlid__toDate(str) {
  // var dt = new Date(str); //@s 181223 Wont work as it require "-"
  var tlidValue = tlid__xtr(str);
  var r = "";

  var y = "20" + getchk_sub(tlidValue, 0, 2); // will bug in 82 years, well, I am not pessimistic here but possibly will not be there or if I do, I wont care so much... I must add a reminder for 2099/12/31 to update tlid.todate.... ;)

  var m = getchk_sub(tlidValue, 2, 4) - 1;
  var d = getchk_sub(tlidValue, 4, 6);

  r = `${y}/${m != "" ? m : 1}/${d != "" ? d : 1}`;

  if (debugDt) console.log(`Year: ${y}`);
  if (debugDt) console.log(`Month: ${m}`);
  if (debugDt) console.log(`Day: ${d}`);
  var h = "00";
  var M = "00";
  var s = "00";
  var ms = "000";

  try {

    h = getchk_sub(tlidValue, 6, 8);
    if (debugDt) console.log(`Hour: ${h}`);




    M = getchk_sub(tlidValue, 8, 10);
    if (debugDt) console.log(`Minutes: ${M}`);



    s = getchk_sub(tlidValue, 10, 12);
    if (debugDt) console.log(`Seconds: ${s}`);



    ms = getchk_sub(tlidValue, 12, 13);
    ms = getchk_sub(tlidValue, 12, 14);
    ms = getchk_sub(tlidValue, 12, 15);
    ms = getchk_sub(tlidValue, 12, 16);

    if (debugDt) console.log(`MiliSeconds: ${ms}`);


  } catch (error) {

  }
  if (debugDt) console.log("R: " + r);

  var dt = new Date(r);

  if (y != "")
    if (m != "")
      if (d != "")
        if (h != "")
          if (M != "")
            if (s != "")
              if (ms != "")
                dt = new Date(Date.UTC(y, m, d, h, M, s, ms));
              else
                dt = new Date(Date.UTC(y, m, d, h, M, s));
            else
              dt = new Date(Date.UTC(y, m, d, h, M));
          else
            dt = new Date(Date.UTC(y, m, d, h));
        else
          dt = new Date(Date.UTC(y, m, d));
      else
        dt = new Date(Date.UTC(y, m));
    else
      dt = new Date(Date.UTC(y));

  if (debugDt) console.log("TZ: " + dt.getTimezoneOffset());

  return dt;
}
1238421
function() {
      this.formattedContainer = inputEx.cn('div', {className: 'inputEx-InPlaceEdit-visu'});
      
      if( lang.isFunction(this.options.formatDom) ) {
         this.formattedContainer.appendChild( this.options.formatDom(this.options.value) );
      }
      else if( lang.isFunction(this.options.formatValue) ) {
         this.formattedContainer.innerHTML = this.options.formatValue(this.options.value);
      }
      else {
         this.formattedContainer.innerHTML = lang.isUndefined(this.options.value) ? inputEx.messages.emptyInPlaceEdit: this.options.value;
      }
      
      this.fieldContainer.appendChild(this.formattedContainer);
      
   }
828508
function(shouldParseHtml) {
      var textareaValue = this.textarea.getValue(false, false);
      if (textareaValue) {
        this.composer.setValue(textareaValue, shouldParseHtml);
      } else {
        this.composer.clear();
        this.editor.fire("set_placeholder");
      }
    }
920334
function() {
			// Clear the todo list first
			this.clearList();

			var todos = todosDB.getList(),
				todo;

			// Render todos - factor in the current filter as well
			for (var i = 0, len = todos.length; i < len; i++) {
				todo = todos[i];

				if (!filter
						|| (filter === 'incomplete' && !todo.completed)
						|| (filter === 'complete' && todo.completed)) {
					this.addTodoItem(todo.id, todo.title, todo.completed);

				}
			}
		}
1066281
function _onRemoteEdit(event, res) {
        // res = {nodeId, name, value}

        // detach from DOM change events
        if (res.value === "0") {
            Inspector.DOM.off(".EditAgent");
            return;
        }

        // find and store the edited node
        var node = DOMAgent.nodeWithId(res.nodeId);
        node = node.children[0];
        if (!node.location) {
            return;
        }
        _editedNode = node;

        // attach to character data modified events
        Inspector.DOM.on("characterDataModified.EditAgent", _onCharacterDataModified);
    }
1346753
function todolist(node)
{
  /* scope `this` for events to access data set */
  var self = this;
  
  /* ATTRIBUTES */
  
  /* where each added item is stored, when this changes based on items the html list of todolist_items will change */
  this.items = [];
  
  /* the amount of completed tasks */
  this.complete = 0;
  
  /* the total number of tasks */
  this.total = 0;
  
  /* current input text */
  this.text = "";
  
  /* ERRORS */
  
  /* whether to show an error or not */
  this.isError = false;
  
  /* the message for this error */
  this.error = "";
  
  /* EVENTS */
  
  /* each sort button fires this */
  this.onSort = function(sorter)
  {
    /* we want to distinguish the from the rest as they are always active */
    var sorts = ['Descending','Ascending'];
    
    /* loop through sorters array */
    for(var x=0,len=self.sorters.length;x<len;x++)
    {
      /* check if Descending or Ascending sort method, if not then say if this sorter has been clicked or not, reset all others */
      if(sorts.indexOf(sorter) === -1 && sorts.indexOf(self.sorters[x].title) === -1)
      {
        self.sorters[x].active = (self.sorters[x].title === sorter);
      }
      
      /* if Descending or Ascending was clicked, check between them which is active */
      else if(sorts.indexOf(sorter) !== -1 && sorts.indexOf(self.sorters[x].title) !== -1)
      {
        self.sorters[x].active = (self.sorters[x].title === sorter);
      }
    }
    
    /* this runs the main sorting method, You will find these attached to prototype at the bottom of the page, based on sorter text clicked */
    self[sorter](self.items);
  }
  
  /* this input keyup fires this */
  this.onAdd = function(e)
  {
    /* keycode that was clicked */
    var keyCode = (e.which || e.keyCode),
        
        /* a list of just the titles of the items */
        itemtitles = self.items.map(function(item){return item.title;});
    
    /* reset error so it will no longer show */
    self.isError = false;
    
    /* if the key pressed was 'enter' key */
    if(keyCode === 13)
    {
      /* check if entered text doesnt already exist in the list, if it does throw an error */
      if(itemtitles.indexOf(self.text) !== -1)
      {
        self.isError = true;
        self.error = "This already exists!";
      }
      
      /* if no error push new item into the items array */
      if(!self.isError)
      {
        /* these will be all passed properties to the todolist_items component */
        self.items.push({
          title:self.text,
          hide:false,
          complete:false,
          favorite:false,
          onComplete:self.onComplete,
          onDelete:self.onDelete
        });
        
        /* increment total */
        self.total += 1;
        
        /* reset input */
        self.text = "";
      }
    }
  }
  
  /* passed to each todolist_items component to fire when a checkbox is clicked */
  this.onComplete = function(v)
  {
    /* if checkbox is active we add one else we subtract one */
    self.complete += ((typeof v === 'string' ? (v === 'true') : !!v) ? 1 : -1);
  }
  
  /* passed to each todolist_items component to fire when the trashcan is clicked */
  this.onDelete = function(title)
  {
    /* get the index of this item */
    var id = self.items.map(function(item){return item.title;}).indexOf(title);
    
    /* if this item was completed, subtract complete */
    if((typeof self.items[id].complete === 'string' ? (self.items[id].complete === 'true') : !!self.items[id].complete)) self.complete -= 1;
    
    /* delete the item from the array, splice also works, del is just shorter */
    self.items.del(id);
    
    /* subtract from total # of todo tasks */
    self.total -= 1;
  }
  
  /* the sorting items, array with data that is used to create the sortitems looped components, onSort method is passed to be used when user clicks each item */
  this.sorters = [
    {title:'All',active:true,onSort:this.onSort},
    {title:'Todo',active:false,onSort:this.onSort},
    {title:'Completed',active:false,onSort:this.onSort},
    {title:'Favorites',active:false,onSort:this.onSort},
    {title:'Ascending',active:false,onSort:this.onSort},
    {title:'Descending',active:false,onSort:this.onSort}
  ];
  
  /* a simple filter to change the css so that the error is not shown when !isError */
  this.filters.toDisplay = function(v)
  {
    return (!v ? 'none' : 'inherit');
  }
  
  
  this.completeclick = function()
  {
    self.getdata();
  }
}
54674
function(value, sendUpdatedEvt) {
		// + check : if Null or Undefined we put '' in the stringField
		this.el.value = ( lang.isNull(value) || lang.isUndefined(value) ) ? '' : value;

      // call parent class method to set style and fire updatedEvt
      inputEx.StringField.superclass.setValue.call(this, value, sendUpdatedEvt);
   }
218861
function () {
                var jsonStr = localStorage.getItem('todos'),
                    models;
                if (jsonStr) {
                    models = JSON.parse(jsonStr);
                    if (models && models.length) {
                        this.reset(models);
                    }
                }
                return this;
            }
515318
function(todo) {
			var view = new window.app.TodoView({model: todo, el: $('#todo-template li').clone()});
			$("#todo-list").append(view.render().el);
		}
1232501
function(value, sendUpdatedEvt) {
	   if(this.editor) {
	      var iframeId = this.el.id+"_editor";
	      
	      // if editor iframe not rendered
	      if (!YAHOO.util.Dom.get(iframeId)) {
	         // put value in textarea : will be processed by this.editor._setInitialContent (clean html, etc...)
	         this.el.value = value;
	         
	      } else {
	         this.editor.setEditorHTML(value);
         }
      }
	   
   	if(sendUpdatedEvt !== false) {
   	   // fire update event
         this.fireUpdatedEvt();
      }
	}
1047739
function (value, sendUpdatedEvt) {
			
			var a, firstVal, secondVal, i;
			
			a = value.split(this.options.valueSeparator);
			
			this.selects[0].setValue(a[0], false);
			this.updateSecondSelectChoices();
			this.selects[1].setValue(a[1], false);
			
			// Call Field.setValue to set class and fire updated event
			inputEx.SelectTwiceField.superclass.setValue.call(this, value, sendUpdatedEvt);
		}
1055220
function insert(elem) {
        try {
            $(exports).triggerHandler('insert', [elem]);
        } catch (err) {
            console.error(err);
        }
        var writer = new Writer();
        elem.save(writer);
        _currentOperation.ops.push({op: OP_INSERT, arg: writer.current});
    }
99825
function(o, callback) {
    var self = this;

    // Validate, 
    var err = this.validateProperties(o);
    
    if (err) callback.call(self, err);
    
    else {

      // Convert object types to strings
      this.convertTypes(o);

      // Set model defaults
      this.setDefaults(o);

      // Convert `id` to `_id`
      convertMongoID(o);

      // Save data into the database
      this.driver.insertInto({
        collection: this.context,
        values: o
      }, function(err, docs) {
        if (err) callback.call(self, err, null);
        else {
          callback.call(self, null, docs[0]._id);
        }
      });
      
    }
    
  }
1121855
function (id, callback) {
        var todos = data.todos;

        for (var i = 0; i < todos.length; i++) {
          if (todos[i].id == id) {
            todos.splice(i, 1);
            break;
          }
        }

        flush();
        callback.call(undefined, data.todos);
      }
1265436
function editorUpdate() {
    if (editor.binding) {
      if ('hold' === generator.clientUpdateFragmentText(editor.binding, editor.$edit.val())) {
        editor.holding = true;
      }
    }
  }