Update docs
This commit is contained in:
parent
ed64186a58
commit
9aa6a96b88
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
docs/symbols/$_.indexedDB.html
Normal file → Executable file
2
docs/symbols/$_.indexedDB.html
Normal file → Executable file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@
|
|||||||
<span class='line'> 2</span> Kis JS Keep It Simple JS Library
|
<span class='line'> 2</span> Kis JS Keep It Simple JS Library
|
||||||
<span class='line'> 3</span> Copyright Timothy J. Warren
|
<span class='line'> 3</span> Copyright Timothy J. Warren
|
||||||
<span class='line'> 4</span> License Public Domain
|
<span class='line'> 4</span> License Public Domain
|
||||||
<span class='line'> 5</span> Version 0.5.0
|
<span class='line'> 5</span> Version 0.6.0
|
||||||
<span class='line'> 6</span> */</span><span class="WHIT">
|
<span class='line'> 6</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 7</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 7</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 8</span>
|
<span class='line'> 8</span>
|
||||||
@ -27,9 +27,9 @@
|
|||||||
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 21</span>
|
<span class='line'> 21</span>
|
||||||
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$_</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">dcopy</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$_</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">dcopy</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 23</span> </span><span class="WHIT">
|
<span class='line'> 23</span>
|
||||||
<span class='line'> 24</span>
|
<span class='line'> 24</span>
|
||||||
<span class='line'> 25</span> </span><span class="COMM">/**
|
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 26</span> * $_
|
<span class='line'> 26</span> * $_
|
||||||
<span class='line'> 27</span> *
|
<span class='line'> 27</span> *
|
||||||
<span class='line'> 28</span> * Constructor function
|
<span class='line'> 28</span> * Constructor function
|
||||||
@ -45,36 +45,36 @@
|
|||||||
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="COMM">//Defines a "global" selector for that instance</span><span class="WHIT">
|
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="COMM">//Defines a "global" selector for that instance</span><span class="WHIT">
|
||||||
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">$_.el</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">$_.el</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 42</span> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">$_.el</span><span class="WHIT">
|
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">$_.el</span><span class="WHIT">
|
||||||
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">document.documentElement</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">document.documentElement</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||||
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"object"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"object"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 49</span> </span><span class="WHIT">
|
<span class='line'> 49</span>
|
||||||
<span class='line'> 50</span> </span><span class="COMM">// Add the selector to the prototype</span><span class="WHIT">
|
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="COMM">// Add the selector to the prototype</span><span class="WHIT">
|
||||||
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="NAME">$_.prototype.el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="NAME">$_.prototype.el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 52</span>
|
<span class='line'> 52</span>
|
||||||
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="COMM">// Make a copy before adding properties</span><span class="WHIT">
|
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="COMM">// Make a copy before adding properties</span><span class="WHIT">
|
||||||
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">dcopy</span><span class="PUNC">(</span><span class="NAME">$_</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">dcopy</span><span class="PUNC">(</span><span class="NAME">$_</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 55</span>
|
<span class='line'> 55</span>
|
||||||
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="COMM">// Give sel to each extension.</span><span class="WHIT">
|
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="COMM">// Give sel to each extension.</span><span class="WHIT">
|
||||||
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 58</span> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"object"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"object"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 63</span> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 64</span>
|
<span class='line'> 64</span>
|
||||||
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="NAME">self.el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="NAME">self.el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 66</span> </span><span class="WHIT">
|
<span class='line'> 66</span>
|
||||||
<span class='line'> 67</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 69</span> </span><span class="WHIT">
|
<span class='line'> 69</span>
|
||||||
<span class='line'> 70</span> </span><span class="COMM">/**
|
<span class='line'> 70</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 71</span> * Simple DOM selector function
|
<span class='line'> 71</span> * Simple DOM selector function
|
||||||
<span class='line'> 72</span> *
|
<span class='line'> 72</span> *
|
||||||
<span class='line'> 73</span> * @memberOf $_
|
<span class='line'> 73</span> * @memberOf $_
|
||||||
@ -86,15 +86,15 @@
|
|||||||
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="NAME">$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="NAME">$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 82</span> </span><span class="WHIT">
|
<span class='line'> 82</span>
|
||||||
<span class='line'> 83</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 84</span> </span><span class="WHIT">
|
<span class='line'> 84</span>
|
||||||
<span class='line'> 85</span> </span><span class="COMM">//Check for a context of a specific element, otherwise, just run on the document</span><span class="WHIT">
|
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="COMM">//Check for a context of a specific element, otherwise, just run on the document</span><span class="WHIT">
|
||||||
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">context</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">context.nodeType</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">context</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">context.nodeType</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 87</span> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">context</span><span class="WHIT">
|
<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">context</span><span class="WHIT">
|
||||||
<span class='line'> 88</span> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 89</span> </span><span class="WHIT">
|
<span class='line'> 89</span>
|
||||||
<span class='line'> 90</span> </span><span class="COMM">//Pick the quickest method for each kind of selector</span><span class="WHIT">
|
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="COMM">//Pick the quickest method for each kind of selector</span><span class="WHIT">
|
||||||
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a.match</span><span class="PUNC">(</span><span class="REGX">/^#([\w\-]+$)/</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a.match</span><span class="PUNC">(</span><span class="REGX">/^#([\w\-]+$)/</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">a.split</span><span class="PUNC">(</span><span class="STRN">'#'</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">a.split</span><span class="PUNC">(</span><span class="STRN">'#'</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
@ -103,12 +103,12 @@
|
|||||||
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">c.querySelectorAll</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">c.querySelectorAll</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 99</span> </span><span class="WHIT">
|
<span class='line'> 99</span>
|
||||||
<span class='line'>100</span> </span><span class="COMM">//Return the single object if applicable</span><span class="WHIT">
|
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="COMM">//Return the single object if applicable</span><span class="WHIT">
|
||||||
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">x.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">x.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>103</span> </span><span class="WHIT">
|
<span class='line'>103</span>
|
||||||
<span class='line'>104</span> </span><span class="COMM">/**
|
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>105</span> * Deep copy/prototypical constructor function
|
<span class='line'>105</span> * Deep copy/prototypical constructor function
|
||||||
<span class='line'>106</span> *
|
<span class='line'>106</span> *
|
||||||
<span class='line'>107</span> * @param object obj
|
<span class='line'>107</span> * @param object obj
|
||||||
@ -119,38 +119,38 @@
|
|||||||
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="NAME">dcopy</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="NAME">dcopy</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">F</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">F</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>115</span> </span><span class="WHIT">
|
<span class='line'>115</span>
|
||||||
<span class='line'>116</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>116</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>120</span> </span><span class="WHIT">
|
<span class='line'>120</span>
|
||||||
<span class='line'>121</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">Object.create</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">Object.create</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Object.create</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Object.create</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>125</span> </span><span class="WHIT">
|
<span class='line'>125</span>
|
||||||
<span class='line'>126</span> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>126</span> </span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>127</span> </span><span class="WHIT">
|
<span class='line'>127</span>
|
||||||
<span class='line'>128</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"object"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"function"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>128</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"object"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"function"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>130</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>130</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>131</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>131</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>132</span> </span><span class="WHIT">
|
<span class='line'>132</span>
|
||||||
<span class='line'>133</span> </span><span class="COMM">/**
|
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>134</span> * @private
|
<span class='line'>134</span> * @private
|
||||||
<span class='line'>135</span> */</span><span class="WHIT">
|
<span class='line'>135</span> */</span><span class="WHIT">
|
||||||
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="NAME">F</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="NAME">F</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>137</span> </span><span class="WHIT">
|
<span class='line'>137</span>
|
||||||
<span class='line'>138</span> </span><span class="NAME">F.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="NAME">F.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>139</span> </span><span class="WHIT">
|
<span class='line'>139</span>
|
||||||
<span class='line'>140</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">F</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">F</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>141</span> </span><span class="WHIT">
|
<span class='line'>141</span>
|
||||||
<span class='line'>142</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>143</span> </span><span class="WHIT">
|
<span class='line'>143</span>
|
||||||
<span class='line'>144</span> </span><span class="COMM">/**
|
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>145</span> * Adds the property `obj` to the $_ object, calling it `name`
|
<span class='line'>145</span> * Adds the property `obj` to the $_ object, calling it `name`
|
||||||
<span class='line'>146</span> *
|
<span class='line'>146</span> *
|
||||||
<span class='line'>147</span> * @param string name
|
<span class='line'>147</span> * @param string name
|
||||||
<span class='line'>148</span> * @param object obj
|
<span class='line'>148</span> * @param object obj
|
||||||
<span class='line'>149</span> */</span><span class="WHIT">
|
<span class='line'>149</span> */</span><span class="WHIT">
|
||||||
@ -159,8 +159,8 @@
|
|||||||
<span class='line'>152</span> </span><span class="WHIT"> </span><span class="NAME">obj.el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>152</span> </span><span class="WHIT"> </span><span class="NAME">obj.el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="NAME">$_</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="NAME">$_</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>155</span> </span><span class="WHIT">
|
<span class='line'>155</span>
|
||||||
<span class='line'>156</span> </span><span class="COMM">/**
|
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>157</span> * Iterates over a $_ object, applying a callback to each item
|
<span class='line'>157</span> * Iterates over a $_ object, applying a callback to each item
|
||||||
<span class='line'>158</span> *
|
<span class='line'>158</span> *
|
||||||
<span class='line'>159</span> * @name $_.each
|
<span class='line'>159</span> * @name $_.each
|
||||||
@ -190,28 +190,28 @@
|
|||||||
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>185</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>185</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>186</span> </span><span class="WHIT">
|
<span class='line'>186</span>
|
||||||
<span class='line'>187</span> </span><span class="COMM">/**
|
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>188</span> * Retrieves the type of the passed variable
|
<span class='line'>188</span> * Retrieves the type of the passed variable
|
||||||
<span class='line'>189</span> *
|
<span class='line'>189</span> *
|
||||||
<span class='line'>190</span> * @param mixed obj
|
<span class='line'>190</span> * @param mixed obj
|
||||||
<span class='line'>191</span> * @return string
|
<span class='line'>191</span> * @return string
|
||||||
<span class='line'>192</span> * @type string
|
<span class='line'>192</span> * @type string
|
||||||
<span class='line'>193</span> */</span><span class="WHIT">
|
<span class='line'>193</span> */</span><span class="WHIT">
|
||||||
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="NAME">$_.type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="NAME">$_.type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>195</span> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>195</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>196</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">call</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>196</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">call</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>197</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>197</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="COMM">//fallback on 'typeof' for truthy primitive values</span><span class="WHIT">
|
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="COMM">//fallback on 'typeof' for truthy primitive values</span><span class="WHIT">
|
||||||
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>201</span> </span><span class="WHIT">
|
<span class='line'>201</span>
|
||||||
<span class='line'>202</span> </span><span class="COMM">//Strip x from [object x] and return </span><span class="WHIT">
|
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="COMM">//Strip x from [object x] and return</span><span class="WHIT">
|
||||||
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toString.call</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">match</span><span class="PUNC">(</span><span class="REGX">/\s([a-z|A-Z]+)/</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toString.call</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">match</span><span class="PUNC">(</span><span class="REGX">/\s([a-z|A-Z]+)/</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>205</span>
|
<span class='line'>205</span>
|
||||||
<span class='line'>206</span> </span><span class="WHIT"> </span><span class="COMM">//Set global variables</span><span class="WHIT">
|
<span class='line'>206</span> </span><span class="WHIT"> </span><span class="COMM">//Set global variables</span><span class="WHIT">
|
||||||
<span class='line'>207</span> </span><span class="WHIT"> </span><span class="NAME">$_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.$_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.$_</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">$_</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>207</span> </span><span class="WHIT"> </span><span class="NAME">$_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.$_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.$_</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">$_</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="NAME">$_.$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="NAME">$_.$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>209</span> </span><span class="WHIT">
|
<span class='line'>209</span>
|
||||||
<span class='line'>210</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
<span class='line'>210</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
@ -18,8 +18,8 @@
|
|||||||
<span class='line'> 11</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">(</span><span class="STRN">"classList"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"a"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 11</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">(</span><span class="STRN">"classList"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"a"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 12</span> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 12</span> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">view</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">view</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 14</span> </span><span class="WHIT">
|
<span class='line'> 14</span>
|
||||||
<span class='line'> 15</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">classListProp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"classList"</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">classListProp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"classList"</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="NAME">protoProp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"prototype"</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="NAME">protoProp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"prototype"</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">elemCtrProto</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">view.HTMLElement</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">view.Element</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">protoProp</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">elemCtrProto</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">view.HTMLElement</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">view.Element</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">protoProp</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="NAME">objCtr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="NAME">objCtr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
@ -174,7 +174,7 @@
|
|||||||
<span class='line'>167</span>
|
<span class='line'>167</span>
|
||||||
<span class='line'>168</span> </span><span class="COMM">/**
|
<span class='line'>168</span> </span><span class="COMM">/**
|
||||||
<span class='line'>169</span> * DOM
|
<span class='line'>169</span> * DOM
|
||||||
<span class='line'>170</span> *
|
<span class='line'>170</span> *
|
||||||
<span class='line'>171</span> * Dom manipulation module
|
<span class='line'>171</span> * Dom manipulation module
|
||||||
<span class='line'>172</span> */</span><span class="WHIT">
|
<span class='line'>172</span> */</span><span class="WHIT">
|
||||||
<span class='line'>173</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>173</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
@ -182,8 +182,8 @@
|
|||||||
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>176</span>
|
<span class='line'>176</span>
|
||||||
<span class='line'>177</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>177</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>178</span> </span><span class="WHIT">
|
<span class='line'>178</span>
|
||||||
<span class='line'>179</span> </span><span class="COMM">//Private function for getting/setting attributes/properties</span><span class="WHIT">
|
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="COMM">//Private function for getting/setting attributes/properties</span><span class="WHIT">
|
||||||
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_attr</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_attr</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>182</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>182</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
@ -216,7 +216,7 @@
|
|||||||
<span class='line'>209</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>209</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>210</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>210</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>211</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Element does not have the selected attribute"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>211</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Element does not have the selected attribute"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>212</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>212</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>214</span>
|
<span class='line'>214</span>
|
||||||
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="COMM">//No value to set? Return the current value</span><span class="WHIT">
|
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="COMM">//No value to set? Return the current value</span><span class="WHIT">
|
||||||
@ -235,8 +235,8 @@
|
|||||||
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||||
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>232</span> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
@ -246,13 +246,13 @@
|
|||||||
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||||
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>242</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>242</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>243</span> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>243</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>244</span>
|
<span class='line'>244</span>
|
||||||
<span class='line'>245</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>245</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>247</span> </span><span class="WHIT">
|
<span class='line'>247</span>
|
||||||
<span class='line'>248</span> </span><span class="COMM">/**
|
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>249</span> * Change css property name to it's
|
<span class='line'>249</span> * Change css property name to it's
|
||||||
<span class='line'>250</span> * javascript camel case equivalent
|
<span class='line'>250</span> * javascript camel case equivalent
|
||||||
<span class='line'>251</span> */</span><span class="WHIT">
|
<span class='line'>251</span> */</span><span class="WHIT">
|
||||||
@ -266,8 +266,8 @@
|
|||||||
<span class='line'>259</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>259</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>260</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>260</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>261</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">equi</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>261</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">equi</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>262</span> </span><span class="WHIT">
|
<span class='line'>262</span>
|
||||||
<span class='line'>263</span> </span><span class="COMM">//Camel-case</span><span class="WHIT">
|
<span class='line'>263</span> </span><span class="WHIT"> </span><span class="COMM">//Camel-case</span><span class="WHIT">
|
||||||
<span class='line'>264</span> </span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_toCamel</span><span class="PUNC">(</span><span class="NAME">prop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>264</span> </span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_toCamel</span><span class="PUNC">(</span><span class="NAME">prop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>265</span>
|
<span class='line'>265</span>
|
||||||
<span class='line'>266</span> </span><span class="WHIT"> </span><span class="COMM">//Equivalent properties for 'special' browsers</span><span class="WHIT">
|
<span class='line'>266</span> </span><span class="WHIT"> </span><span class="COMM">//Equivalent properties for 'special' browsers</span><span class="WHIT">
|
||||||
@ -276,9 +276,9 @@
|
|||||||
<span class='line'>269</span> </span><span class="WHIT"> </span><span class="NAME">outerWidth</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"offsetWidth"</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>269</span> </span><span class="WHIT"> </span><span class="NAME">outerWidth</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"offsetWidth"</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>270</span> </span><span class="WHIT"> </span><span class="NAME">top</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"posTop"</span><span class="WHIT">
|
<span class='line'>270</span> </span><span class="WHIT"> </span><span class="NAME">top</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"posTop"</span><span class="WHIT">
|
||||||
<span class='line'>271</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>271</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>272</span> </span><span class="WHIT">
|
<span class='line'>272</span>
|
||||||
<span class='line'>273</span>
|
<span class='line'>273</span>
|
||||||
<span class='line'>274</span> </span><span class="COMM">//If you don't define a value, try returning the existing value</span><span class="WHIT">
|
<span class='line'>274</span> </span><span class="WHIT"> </span><span class="COMM">//If you don't define a value, try returning the existing value</span><span class="WHIT">
|
||||||
<span class='line'>275</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>275</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>276</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>276</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>277</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>277</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
@ -294,23 +294,23 @@
|
|||||||
<span class='line'>287</span> </span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>287</span> </span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>288</span>
|
<span class='line'>288</span>
|
||||||
<span class='line'>289</span> </span><span class="WHIT"> </span><span class="COMM">//Short circuit</span><span class="WHIT">
|
<span class='line'>289</span> </span><span class="WHIT"> </span><span class="COMM">//Short circuit</span><span class="WHIT">
|
||||||
<span class='line'>290</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>290</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>291</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>291</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>292</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>292</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>293</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>293</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>294</span> </span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>294</span> </span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>296</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>296</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>297</span> </span><span class="WHIT">
|
<span class='line'>297</span>
|
||||||
<span class='line'>298</span> </span><span class="COMM">//No matches? Well, lets log it for now</span><span class="WHIT">
|
<span class='line'>298</span> </span><span class="WHIT"> </span><span class="COMM">//No matches? Well, lets log it for now</span><span class="WHIT">
|
||||||
<span class='line'>299</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Property "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" nor an equivalent seems to exist"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>299</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Property "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" nor an equivalent seems to exist"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>300</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>300</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>301</span> </span><span class="WHIT">
|
<span class='line'>301</span>
|
||||||
<span class='line'>302</span> </span><span class="COMM">// --------------------------------------------------------------------------</span><span class="WHIT">
|
<span class='line'>302</span> </span><span class="WHIT"> </span><span class="COMM">// --------------------------------------------------------------------------</span><span class="WHIT">
|
||||||
<span class='line'>303</span>
|
<span class='line'>303</span>
|
||||||
<span class='line'>304</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>304</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>305</span> * DOM
|
<span class='line'>305</span> * DOM
|
||||||
<span class='line'>306</span> *
|
<span class='line'>306</span> *
|
||||||
<span class='line'>307</span> * Dom manipulation module
|
<span class='line'>307</span> * Dom manipulation module
|
||||||
<span class='line'>308</span> * @namespace
|
<span class='line'>308</span> * @namespace
|
||||||
<span class='line'>309</span> * @memberOf $_
|
<span class='line'>309</span> * @memberOf $_
|
||||||
@ -320,7 +320,7 @@
|
|||||||
<span class='line'>313</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>313</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>314</span> * Adds a class to the element(s) specified by the current
|
<span class='line'>314</span> * Adds a class to the element(s) specified by the current
|
||||||
<span class='line'>315</span> * selector
|
<span class='line'>315</span> * selector
|
||||||
<span class='line'>316</span> *
|
<span class='line'>316</span> *
|
||||||
<span class='line'>317</span> * @name addClass
|
<span class='line'>317</span> * @name addClass
|
||||||
<span class='line'>318</span> * @memberOf $_.dom
|
<span class='line'>318</span> * @memberOf $_.dom
|
||||||
<span class='line'>319</span> * @function
|
<span class='line'>319</span> * @function
|
||||||
@ -335,7 +335,7 @@
|
|||||||
<span class='line'>328</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>328</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>329</span> * Removes a class from the element(s) specified by the current
|
<span class='line'>329</span> * Removes a class from the element(s) specified by the current
|
||||||
<span class='line'>330</span> * selector
|
<span class='line'>330</span> * selector
|
||||||
<span class='line'>331</span> *
|
<span class='line'>331</span> *
|
||||||
<span class='line'>332</span> * @name removeClass
|
<span class='line'>332</span> * @name removeClass
|
||||||
<span class='line'>333</span> * @memberOf $_.dom
|
<span class='line'>333</span> * @memberOf $_.dom
|
||||||
<span class='line'>334</span> * @function
|
<span class='line'>334</span> * @function
|
||||||
@ -349,7 +349,7 @@
|
|||||||
<span class='line'>342</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>342</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>343</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>343</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>344</span> * Hides the element(s) specified by the current selector
|
<span class='line'>344</span> * Hides the element(s) specified by the current selector
|
||||||
<span class='line'>345</span> *
|
<span class='line'>345</span> *
|
||||||
<span class='line'>346</span> * @name hide
|
<span class='line'>346</span> * @name hide
|
||||||
<span class='line'>347</span> * @memberOf $_.dom
|
<span class='line'>347</span> * @memberOf $_.dom
|
||||||
<span class='line'>348</span> * @function
|
<span class='line'>348</span> * @function
|
||||||
@ -359,11 +359,11 @@
|
|||||||
<span class='line'>352</span> </span><span class="WHIT"> </span><span class="NAME">this.css</span><span class="PUNC">(</span><span class="STRN">'display'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'none'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>352</span> </span><span class="WHIT"> </span><span class="NAME">this.css</span><span class="PUNC">(</span><span class="STRN">'display'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'none'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>353</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>353</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>354</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>354</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>355</span> * Shows the element(s) specified by the current selector.
|
<span class='line'>355</span> * Shows the element(s) specified by the current selector.
|
||||||
<span class='line'>356</span> * if type is specified, the element will have it's style
|
<span class='line'>356</span> * if type is specified, the element will have it's style
|
||||||
<span class='line'>357</span> * property set to "display:[your type]". If type is not
|
<span class='line'>357</span> * property set to "display:[your type]". If type is not
|
||||||
<span class='line'>358</span> * specified, the element is set to "display:block".
|
<span class='line'>358</span> * specified, the element is set to "display:block".
|
||||||
<span class='line'>359</span> *
|
<span class='line'>359</span> *
|
||||||
<span class='line'>360</span> * @name show
|
<span class='line'>360</span> * @name show
|
||||||
<span class='line'>361</span> * @memberOf $_.dom
|
<span class='line'>361</span> * @memberOf $_.dom
|
||||||
<span class='line'>362</span> * @function
|
<span class='line'>362</span> * @function
|
||||||
@ -379,8 +379,8 @@
|
|||||||
<span class='line'>372</span> </span><span class="WHIT"> </span><span class="NAME">this.css</span><span class="PUNC">(</span><span class="STRN">"display"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>372</span> </span><span class="WHIT"> </span><span class="NAME">this.css</span><span class="PUNC">(</span><span class="STRN">"display"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>373</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>373</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>374</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>374</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>375</span> * Sets attributes on element(s) specified by the current
|
<span class='line'>375</span> * Sets attributes on element(s) specified by the current
|
||||||
<span class='line'>376</span> * selector, or, if name is not specified, returns the
|
<span class='line'>376</span> * selector, or, if name is not specified, returns the
|
||||||
<span class='line'>377</span> * value of the attribute of the element specified by the
|
<span class='line'>377</span> * value of the attribute of the element specified by the
|
||||||
<span class='line'>378</span> * current selector.
|
<span class='line'>378</span> * current selector.
|
||||||
<span class='line'>379</span> *
|
<span class='line'>379</span> *
|
||||||
@ -416,7 +416,7 @@
|
|||||||
<span class='line'>409</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>409</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>410</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>410</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>411</span> * Sets or retrieves the text content of the element
|
<span class='line'>411</span> * Sets or retrieves the text content of the element
|
||||||
<span class='line'>412</span> * specified by the current selector. If a value is
|
<span class='line'>412</span> * specified by the current selector. If a value is
|
||||||
<span class='line'>413</span> * passed, it will set that value on the current element,
|
<span class='line'>413</span> * passed, it will set that value on the current element,
|
||||||
<span class='line'>414</span> * otherwise it will return the value of the current element
|
<span class='line'>414</span> * otherwise it will return the value of the current element
|
||||||
<span class='line'>415</span> *
|
<span class='line'>415</span> *
|
||||||
@ -430,20 +430,20 @@
|
|||||||
<span class='line'>423</span> </span><span class="WHIT"> </span><span class="NAME">text</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>423</span> </span><span class="WHIT"> </span><span class="NAME">text</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>424</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>424</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>425</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">set</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>425</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">set</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>426</span> </span><span class="WHIT">
|
<span class='line'>426</span>
|
||||||
<span class='line'>427</span> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.el</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>427</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.el</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>428</span> </span><span class="WHIT">
|
<span class='line'>428</span>
|
||||||
<span class='line'>429</span> </span><span class="NAME">set</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>429</span> </span><span class="WHIT"> </span><span class="NAME">set</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>430</span> </span><span class="WHIT">
|
<span class='line'>430</span>
|
||||||
<span class='line'>431</span> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.textContent</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>431</span> </span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.textContent</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>432</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"textContent"</span><span class="WHIT">
|
<span class='line'>432</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"textContent"</span><span class="WHIT">
|
||||||
<span class='line'>433</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.innerText</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>433</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.innerText</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>434</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"innerText"</span><span class="WHIT">
|
<span class='line'>434</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"innerText"</span><span class="WHIT">
|
||||||
<span class='line'>435</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"innerHTML"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>435</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"innerHTML"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>436</span>
|
<span class='line'>436</span>
|
||||||
<span class='line'>437</span> </span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>437</span> </span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>438</span> </span><span class="WHIT">
|
<span class='line'>438</span>
|
||||||
<span class='line'>439</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">set</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>439</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">set</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>440</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>440</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>441</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>441</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>442</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>442</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
@ -455,7 +455,7 @@
|
|||||||
<span class='line'>448</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>448</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>449</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>449</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>450</span> * Sets or retrieves a css property of the element
|
<span class='line'>450</span> * Sets or retrieves a css property of the element
|
||||||
<span class='line'>451</span> * specified by the current selector. If a value is
|
<span class='line'>451</span> * specified by the current selector. If a value is
|
||||||
<span class='line'>452</span> * passed, it will set that value on the current element,
|
<span class='line'>452</span> * passed, it will set that value on the current element,
|
||||||
<span class='line'>453</span> * otherwise it will return the value of the css property
|
<span class='line'>453</span> * otherwise it will return the value of the css property
|
||||||
<span class='line'>454</span> * on the current element
|
<span class='line'>454</span> * on the current element
|
||||||
@ -475,14 +475,14 @@
|
|||||||
<span class='line'>468</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>468</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>469</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">this.el</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>469</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">this.el</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>470</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>470</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>471</span> </span><span class="WHIT">
|
<span class='line'>471</span>
|
||||||
<span class='line'>472</span> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>472</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>473</span> </span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>473</span> </span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>474</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>474</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>475</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>475</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>476</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>476</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>477</span> * Adds to the innerHTML of the current element, after the last child.
|
<span class='line'>477</span> * Adds to the innerHTML of the current element, after the last child.
|
||||||
<span class='line'>478</span> *
|
<span class='line'>478</span> *
|
||||||
<span class='line'>479</span> * @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
|
<span class='line'>479</span> * @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
|
||||||
<span class='line'>480</span> * @name append
|
<span class='line'>480</span> * @name append
|
||||||
<span class='line'>481</span> * @memberOf $_.dom
|
<span class='line'>481</span> * @memberOf $_.dom
|
||||||
@ -502,7 +502,7 @@
|
|||||||
<span class='line'>495</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>495</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>496</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>496</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>497</span> * Adds to the innerHTML of the selected element, before the current children
|
<span class='line'>497</span> * Adds to the innerHTML of the selected element, before the current children
|
||||||
<span class='line'>498</span> *
|
<span class='line'>498</span> *
|
||||||
<span class='line'>499</span> * @name prepend
|
<span class='line'>499</span> * @name prepend
|
||||||
<span class='line'>500</span> * @memberOf $_.dom
|
<span class='line'>500</span> * @memberOf $_.dom
|
||||||
<span class='line'>501</span> * @function
|
<span class='line'>501</span> * @function
|
||||||
@ -531,18 +531,17 @@
|
|||||||
<span class='line'>524</span> */</span><span class="WHIT">
|
<span class='line'>524</span> */</span><span class="WHIT">
|
||||||
<span class='line'>525</span> </span><span class="WHIT"> </span><span class="NAME">html</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>525</span> </span><span class="WHIT"> </span><span class="NAME">html</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>526</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>526</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>527</span> </span><span class="WHIT">
|
<span class='line'>527</span>
|
||||||
<span class='line'>528</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>528</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>529</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>529</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>530</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>530</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>531</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>531</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>532</span> </span><span class="WHIT">
|
<span class='line'>532</span>
|
||||||
<span class='line'>533</span> </span><span class="COMM">//If the parameter is undefined, just return the current value</span><span class="WHIT">
|
<span class='line'>533</span> </span><span class="WHIT"> </span><span class="COMM">//If the parameter is undefined, just return the current value</span><span class="WHIT">
|
||||||
<span class='line'>534</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>534</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>535</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>535</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>536</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>536</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>537</span>
|
<span class='line'>537</span>
|
||||||
<span class='line'>538</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'dom'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>538</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'dom'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>539</span> </span><span class="WHIT">
|
<span class='line'>539</span>
|
||||||
<span class='line'>540</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>540</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
||||||
<span class='line'>541</span> </span></pre></body></html>
|
|
@ -13,8 +13,8 @@
|
|||||||
<span class='line'> 6</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 6</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 7</span>
|
<span class='line'> 7</span>
|
||||||
<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 9</span> </span><span class="WHIT">
|
<span class='line'> 9</span>
|
||||||
<span class='line'> 10</span> </span><span class="COMM">// Don't bother even defining the object if the XMLHttpRequest isn't available</span><span class="WHIT">
|
<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="COMM">// Don't bother even defining the object if the XMLHttpRequest isn't available</span><span class="WHIT">
|
||||||
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">window.XMLHttpRequest</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">window.XMLHttpRequest</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
@ -23,10 +23,10 @@
|
|||||||
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ajax</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ajax</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">_do</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isPost</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">_do</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isPost</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 20</span> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XMLHttpRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XMLHttpRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 21</span> </span><span class="WHIT">
|
<span class='line'> 21</span>
|
||||||
<span class='line'> 22</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 25</span> * @private
|
<span class='line'> 25</span> * @private
|
||||||
@ -37,8 +37,8 @@
|
|||||||
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isPost</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"POST"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"GET"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isPost</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"POST"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"GET"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 31</span>
|
<span class='line'> 31</span>
|
||||||
<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"GET"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"?"</span><span class="PUNC">+</span><span class="NAME">this._serialize</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"GET"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"?"</span><span class="PUNC">+</span><span class="NAME">this._serialize</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 33</span> </span><span class="WHIT">
|
<span class='line'> 33</span>
|
||||||
<span class='line'> 34</span> </span><span class="NAME">request.open</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="NAME">request.open</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 35</span>
|
<span class='line'> 35</span>
|
||||||
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">request.onreadystatechange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">request.onreadystatechange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
@ -89,7 +89,7 @@
|
|||||||
<span class='line'> 82</span>
|
<span class='line'> 82</span>
|
||||||
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 84</span> * Sends a GET type ajax request
|
<span class='line'> 84</span> * Sends a GET type ajax request
|
||||||
<span class='line'> 85</span> *
|
<span class='line'> 85</span> *
|
||||||
<span class='line'> 86</span> * @name get
|
<span class='line'> 86</span> * @name get
|
||||||
<span class='line'> 87</span> * @function
|
<span class='line'> 87</span> * @function
|
||||||
<span class='line'> 88</span> * @memberOf $_
|
<span class='line'> 88</span> * @memberOf $_
|
||||||
@ -100,10 +100,10 @@
|
|||||||
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'get'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'get'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="NAME">ajax._do</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="NAME">ajax._do</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 96</span> </span><span class="WHIT">
|
<span class='line'> 96</span>
|
||||||
<span class='line'> 97</span> </span><span class="COMM">/**
|
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 98</span> * Sends a POST type ajax request
|
<span class='line'> 98</span> * Sends a POST type ajax request
|
||||||
<span class='line'> 99</span> *
|
<span class='line'> 99</span> *
|
||||||
<span class='line'>100</span> * @name post
|
<span class='line'>100</span> * @name post
|
||||||
<span class='line'>101</span> * @function
|
<span class='line'>101</span> * @function
|
||||||
<span class='line'>102</span> * @memberOf $_
|
<span class='line'>102</span> * @memberOf $_
|
||||||
@ -114,4 +114,5 @@
|
|||||||
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'post'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'post'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="NAME">ajax._do</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="NAME">ajax._do</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>110</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
<span class='line'>110</span> </span><span class="WHIT">
|
||||||
|
<span class='line'>111</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
@ -9,255 +9,254 @@
|
|||||||
<span class='line'> 2</span> * Event
|
<span class='line'> 2</span> * Event
|
||||||
<span class='line'> 3</span> *
|
<span class='line'> 3</span> *
|
||||||
<span class='line'> 4</span> * Event api wrapper
|
<span class='line'> 4</span> * Event api wrapper
|
||||||
<span class='line'> 5</span> */</span><span class="WHIT">
|
<span class='line'> 5</span> * @todo Add method for triggering events
|
||||||
<span class='line'> 6</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 6</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 7</span>
|
<span class='line'> 7</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 8</span>
|
||||||
<span class='line'> 9</span>
|
<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="COMM">// Property name for expandos on DOM objects</span><span class="WHIT">
|
<span class='line'> 10</span>
|
||||||
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">kis_expando</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"KIS_0_5_0"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="COMM">// Property name for expandos on DOM objects</span><span class="WHIT">
|
||||||
<span class='line'> 12</span>
|
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">kis_expando</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"KIS_0_6_0"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_attach</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 13</span>
|
||||||
<span class='line'> 14</span>
|
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_attach</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="COMM">// Define the proper _attach and _remove functions</span><span class="WHIT">
|
<span class='line'> 15</span>
|
||||||
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="COMM">// based on browser support</span><span class="WHIT">
|
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="COMM">// Define the proper _attach and _remove functions</span><span class="WHIT">
|
||||||
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.addEventListener</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="COMM">// based on browser support</span><span class="WHIT">
|
||||||
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.addEventListener</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 20</span> * @private
|
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 21</span> */</span><span class="WHIT">
|
<span class='line'> 21</span> * @private
|
||||||
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="NAME">_attach</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 22</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="NAME">_attach</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.addEventListener</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.addEventListener</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="COMM">// Duplicated events are dropped, per the specification</span><span class="WHIT">
|
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="NAME">sel.addEventListener</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="COMM">// Duplicated events are dropped, per the specification</span><span class="WHIT">
|
||||||
<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="NAME">sel.addEventListener</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 31</span> * @private
|
<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 32</span> */</span><span class="WHIT">
|
<span class='line'> 32</span> * @private
|
||||||
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 33</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.removeEventListener</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.removeEventListener</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="NAME">sel.removeEventListener</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="NAME">sel.removeEventListener</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="COMM">// typeof function doesn't work in IE where attachEvent is available: brute force it</span><span class="WHIT">
|
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.attachEvent</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="COMM">// typeof function doesn't work in IE where attachEvent is available: brute force it</span><span class="WHIT">
|
||||||
<span class='line'> 43</span> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.attachEvent</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 45</span> * @private
|
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 46</span> */</span><span class="WHIT">
|
<span class='line'> 46</span> * @private
|
||||||
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">_attach</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 47</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="NAME">_attach</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_listener</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="COMM">// Internet Explorer fails to correctly set the 'this' object</span><span class="WHIT">
|
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_listener</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="COMM">// for event listeners, so we need to set it ourselves.</span><span class="WHIT">
|
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="COMM">// Internet Explorer fails to correctly set the 'this' object</span><span class="WHIT">
|
||||||
<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="NAME">callback.apply</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="COMM">// for event listeners, so we need to set it ourselves.</span><span class="WHIT">
|
||||||
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="NAME">callback.apply</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 54</span> </span><span class="WHIT">
|
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 55</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.attachEvent</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 55</span>
|
||||||
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.attachEvent</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// Make sure we don't have duplicate listeners</span><span class="WHIT">
|
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 58</span> </span><span class="WHIT">
|
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// Make sure we don't have duplicate listeners</span><span class="WHIT">
|
||||||
<span class='line'> 59</span> </span><span class="NAME">sel.attachEvent</span><span class="PUNC">(</span><span class="STRN">"on"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_listener</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 59</span>
|
||||||
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="COMM">// Store our listener so we can remove it later</span><span class="WHIT">
|
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="NAME">sel.attachEvent</span><span class="PUNC">(</span><span class="STRN">"on"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_listener</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">expando</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">kis_expando</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">kis_expando</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="COMM">// Store our listener so we can remove it later</span><span class="WHIT">
|
||||||
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">expando</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">kis_expando</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">kis_expando</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="NAME">_listener</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">_listener</span><span class="WHIT">
|
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="NAME">_listener</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">_listener</span><span class="WHIT">
|
||||||
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 70</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 70</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||||
<span class='line'> 71</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Failed to _attach event:"</span><span class="PUNC">+</span><span class="NAME">event</span><span class="PUNC">+</span><span class="STRN">" on "</span><span class="PUNC">+</span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 71</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 72</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 72</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Failed to _attach event:"</span><span class="PUNC">+</span><span class="NAME">event</span><span class="PUNC">+</span><span class="STRN">" on "</span><span class="PUNC">+</span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 73</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 73</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 75</span> * @private
|
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 76</span> */</span><span class="WHIT">
|
<span class='line'> 76</span> * @private
|
||||||
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 77</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.detachEvent</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.detachEvent</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">expando</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">kis_expando</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">expando</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="WHIT">
|
<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">expando</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">kis_expando</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">expando</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="WHIT">
|
||||||
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">listeners</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">listeners.length</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">listeners</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC"><</span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">listeners.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC"><</span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">listeners</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">listeners</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="NAME">sel.detachEvent</span><span class="PUNC">(</span><span class="STRN">"on"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">listeners</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">_listener</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">listeners.splice</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">sel.detachEvent</span><span class="PUNC">(</span><span class="STRN">"on"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">listeners</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">_listener</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">listeners.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="NAME">listeners.splice</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">listeners.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">expando.listeners</span><span class="PUNC">[</span><span class="NAME">event</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 99</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 99</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>104</span> </span><span class="WHIT">
|
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>105</span> </span><span class="NAME">_add_remove</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">add</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>105</span>
|
||||||
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">add</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>108</span> </span><span class="WHIT">
|
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>109</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>109</span>
|
||||||
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>115</span>
|
<span class='line'>115</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>116</span> </span><span class="WHIT"> </span><span class="COMM">// Multiple events? Run recursively!</span><span class="WHIT">
|
<span class='line'>116</span>
|
||||||
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="WHIT"> </span><span class="NAME">event.match</span><span class="PUNC">(</span><span class="REGX">/^([\w\-]+)$/</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="COMM">// Multiple events? Run recursively!</span><span class="WHIT">
|
||||||
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="WHIT"> </span><span class="NAME">event.match</span><span class="PUNC">(</span><span class="REGX">/^([\w\-]+)$/</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="NAME">event</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">event.split</span><span class="PUNC">(</span><span class="STRN">" "</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>120</span> </span><span class="WHIT">
|
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="NAME">event</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">event.split</span><span class="PUNC">(</span><span class="STRN">" "</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>121</span> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">event.length</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>121</span>
|
||||||
<span class='line'>122</span>
|
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">event.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>123</span>
|
||||||
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>125</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">add</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>125</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>126</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>126</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">add</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>127</span>
|
<span class='line'>127</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>128</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>128</span>
|
||||||
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>130</span>
|
<span class='line'>130</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>131</span> </span><span class="WHIT">
|
<span class='line'>131</span>
|
||||||
<span class='line'>132</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">add</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>132</span>
|
||||||
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">add</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>134</span> </span><span class="WHIT"> </span><span class="NAME">_attach</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>134</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>135</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>135</span> </span><span class="WHIT"> </span><span class="NAME">_attach</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>137</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>137</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||||
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>139</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>139</span> </span><span class="WHIT"> </span><span class="NAME">_remove</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>141</span>
|
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>142</span>
|
||||||
<span class='line'>143</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>143</span> </span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="COMM">// attach the listener to the parent object</span><span class="WHIT">
|
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>145</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>145</span> </span><span class="WHIT"> </span><span class="COMM">// attach the listener to the parent object</span><span class="WHIT">
|
||||||
<span class='line'>146</span> </span><span class="WHIT">
|
<span class='line'>146</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>147</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">elem</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tar</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>147</span>
|
||||||
<span class='line'>148</span> </span><span class="WHIT">
|
<span class='line'>148</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">elem</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tar</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>149</span> </span><span class="COMM">// IE 8 doesn't have event bound to element</span><span class="WHIT">
|
<span class='line'>149</span>
|
||||||
<span class='line'>150</span> </span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.event</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>150</span> </span><span class="WHIT"> </span><span class="COMM">// IE 8 doesn't have event bound to element</span><span class="WHIT">
|
||||||
<span class='line'>151</span> </span><span class="WHIT">
|
<span class='line'>151</span> </span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.event</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>152</span> </span><span class="COMM">// Get the live version of the target selector</span><span class="WHIT">
|
<span class='line'>152</span>
|
||||||
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="NAME">t</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$_.$</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="COMM">// Get the live version of the target selector</span><span class="WHIT">
|
||||||
<span class='line'>154</span> </span><span class="WHIT">
|
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="NAME">t</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$_.$</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>155</span> </span><span class="COMM">// Check each element to see if it matches the target</span><span class="WHIT">
|
<span class='line'>155</span>
|
||||||
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">elem</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="COMM">// Check each element to see if it matches the target</span><span class="WHIT">
|
||||||
<span class='line'>157</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>157</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">elem</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>158</span> </span><span class="WHIT"> </span><span class="COMM">// IE 8 doesn't have target in the event object</span><span class="WHIT">
|
<span class='line'>158</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>159</span> </span><span class="WHIT"> </span><span class="NAME">tar</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.target</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">e.srcElement</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>159</span> </span><span class="WHIT"> </span><span class="COMM">// IE 8 doesn't have target in the event object</span><span class="WHIT">
|
||||||
<span class='line'>160</span> </span><span class="WHIT">
|
<span class='line'>160</span> </span><span class="WHIT"> </span><span class="NAME">tar</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.target</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">e.srcElement</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>161</span> </span><span class="COMM">// Fire target callback when event bubbles from target</span><span class="WHIT">
|
<span class='line'>161</span>
|
||||||
<span class='line'>162</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">tar</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">elem</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>162</span> </span><span class="WHIT"> </span><span class="COMM">// Fire target callback when event bubbles from target</span><span class="WHIT">
|
||||||
<span class='line'>163</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>163</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">tar</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">elem</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>164</span> </span><span class="WHIT"> </span><span class="COMM">// Trigger the event callback</span><span class="WHIT">
|
<span class='line'>164</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>165</span> </span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">elem</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>165</span> </span><span class="WHIT"> </span><span class="COMM">// Trigger the event callback</span><span class="WHIT">
|
||||||
<span class='line'>166</span> </span><span class="WHIT">
|
<span class='line'>166</span> </span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">elem</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>167</span> </span><span class="COMM">// Stop event propegation</span><span class="WHIT">
|
<span class='line'>167</span>
|
||||||
<span class='line'>168</span> </span><span class="WHIT"> </span><span class="NAME">e.stopPropagation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>168</span> </span><span class="WHIT"> </span><span class="COMM">// Stop event propegation</span><span class="WHIT">
|
||||||
<span class='line'>169</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>169</span> </span><span class="WHIT"> </span><span class="NAME">e.stopPropagation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>170</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>170</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>171</span> </span><span class="WHIT">
|
<span class='line'>171</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>172</span> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>172</span>
|
||||||
<span class='line'>173</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>173</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>174</span> </span><span class="WHIT">
|
<span class='line'>174</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>175</span>
|
<span class='line'>175</span>
|
||||||
<span class='line'>176</span>
|
<span class='line'>176</span> </span><span class="WHIT"> </span><span class="COMM">// --------------------------------------------------------------------------</span><span class="WHIT">
|
||||||
<span class='line'>177</span> </span><span class="COMM">// --------------------------------------------------------------------------</span><span class="WHIT">
|
<span class='line'>177</span>
|
||||||
<span class='line'>178</span>
|
<span class='line'>178</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>179</span> * Event Listener module
|
||||||
<span class='line'>180</span> * Event Listener module
|
<span class='line'>180</span> *
|
||||||
<span class='line'>181</span> *
|
<span class='line'>181</span> * @namespace
|
||||||
<span class='line'>182</span> * @namespace
|
<span class='line'>182</span> * @name event
|
||||||
<span class='line'>183</span> * @name event
|
<span class='line'>183</span> * @memberOf $_
|
||||||
<span class='line'>184</span> * @memberOf $_
|
<span class='line'>184</span> */</span><span class="WHIT">
|
||||||
<span class='line'>185</span> */</span><span class="WHIT">
|
<span class='line'>185</span> </span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>186</span> </span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>186</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>187</span> * Adds an event that returns a callback when triggered on the selected
|
||||||
<span class='line'>188</span> * Adds an event that returns a callback when triggered on the selected
|
<span class='line'>188</span> * event and selector
|
||||||
<span class='line'>189</span> * event and selector
|
<span class='line'>189</span> *
|
||||||
<span class='line'>190</span> *
|
<span class='line'>190</span> * @memberOf $_.event
|
||||||
<span class='line'>191</span> * @memberOf $_.event
|
<span class='line'>191</span> * @name add
|
||||||
<span class='line'>192</span> * @name add
|
<span class='line'>192</span> * @function
|
||||||
<span class='line'>193</span> * @function
|
<span class='line'>193</span> * @example Eg. $_("#selector").event.add("click", do_something());
|
||||||
<span class='line'>194</span> * @example Eg. $_("#selector").event.add("click", do_something());
|
<span class='line'>194</span> * @param string event
|
||||||
<span class='line'>195</span> * @param string event
|
<span class='line'>195</span> * @param function callback
|
||||||
<span class='line'>196</span> * @param function callback
|
<span class='line'>196</span> */</span><span class="WHIT">
|
||||||
<span class='line'>197</span> */</span><span class="WHIT">
|
<span class='line'>197</span> </span><span class="WHIT"> </span><span class="NAME">add</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="NAME">add</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>204</span> * Removes an event bound the the specified selector, event type, and callback
|
||||||
<span class='line'>205</span> * Removes an event bound the the specified selector, event type, and callback
|
<span class='line'>205</span> *
|
||||||
<span class='line'>206</span> *
|
<span class='line'>206</span> * @memberOf $_.event
|
||||||
<span class='line'>207</span> * @memberOf $_.event
|
<span class='line'>207</span> * @name remove
|
||||||
<span class='line'>208</span> * @name remove
|
<span class='line'>208</span> * @function
|
||||||
<span class='line'>209</span> * @function
|
<span class='line'>209</span> * @example Eg. $_("#selector").event.remove("click", do_something());
|
||||||
<span class='line'>210</span> * @example Eg. $_("#selector").event.remove("click", do_something());
|
<span class='line'>210</span> * @param string event
|
||||||
<span class='line'>211</span> * @param string event
|
<span class='line'>211</span> * @param string callback
|
||||||
<span class='line'>212</span> * @param string callback
|
<span class='line'>212</span> */</span><span class="WHIT">
|
||||||
<span class='line'>213</span> */</span><span class="WHIT">
|
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="NAME">remove</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>214</span> </span><span class="WHIT"> </span><span class="NAME">remove</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>214</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="NAME">_add_remove</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>220</span> * Binds a persistent event to the document
|
||||||
<span class='line'>221</span> * Binds a persistent event to the document
|
<span class='line'>221</span> *
|
||||||
<span class='line'>222</span> *
|
<span class='line'>222</span> * @memberOf $_.event
|
||||||
<span class='line'>223</span> * @memberOf $_.event
|
<span class='line'>223</span> * @name live
|
||||||
<span class='line'>224</span> * @name live
|
<span class='line'>224</span> * @function
|
||||||
<span class='line'>225</span> * @function
|
<span class='line'>225</span> * @example Eg. $_.event.live(".button", "click", do_something());
|
||||||
<span class='line'>226</span> * @example Eg. $_.event.live(".button", "click", do_something());
|
<span class='line'>226</span> * @param string target
|
||||||
<span class='line'>227</span> * @param string target
|
<span class='line'>227</span> * @param string event
|
||||||
<span class='line'>228</span> * @param string event
|
<span class='line'>228</span> * @param function callback
|
||||||
<span class='line'>229</span> * @param function callback
|
<span class='line'>229</span> */</span><span class="WHIT">
|
||||||
<span class='line'>230</span> */</span><span class="WHIT">
|
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="NAME">live</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="NAME">live</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="PUNC">(</span><span class="NAME">document.documentElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="PUNC">(</span><span class="NAME">document.documentElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>235</span> * Binds an event to a parent object
|
||||||
<span class='line'>236</span> * Binds an event to a parent object
|
<span class='line'>236</span> *
|
||||||
<span class='line'>237</span> *
|
<span class='line'>237</span> * @memberOf $_.event
|
||||||
<span class='line'>238</span> * @memberOf $_.event
|
<span class='line'>238</span> * @name delegate
|
||||||
<span class='line'>239</span> * @name delegate
|
<span class='line'>239</span> * @function
|
||||||
<span class='line'>240</span> * @function
|
<span class='line'>240</span> * @example Eg. $_("#parent").delegate(".button", "click", do_something());
|
||||||
<span class='line'>241</span> * @example Eg. $_("#parent").delegate(".button", "click", do_something());
|
<span class='line'>241</span> * @param string target
|
||||||
<span class='line'>242</span> * @param string target
|
<span class='line'>242</span> * @param string event_type
|
||||||
<span class='line'>243</span> * @param string event_type
|
<span class='line'>243</span> * @param function callback
|
||||||
<span class='line'>244</span> * @param function callback
|
<span class='line'>244</span> */</span><span class="WHIT">
|
||||||
<span class='line'>245</span> */</span><span class="WHIT">
|
<span class='line'>245</span> </span><span class="WHIT"> </span><span class="NAME">delegate</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="NAME">delegate</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>249</span> </span><span class="WHIT"> </span><span class="NAME">_attach_delegate</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>249</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>250</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>250</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>251</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>251</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>252</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>252</span>
|
||||||
<span class='line'>253</span>
|
<span class='line'>253</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'event'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>254</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'event'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>254</span>
|
||||||
<span class='line'>255</span>
|
<span class='line'>255</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
||||||
<span class='line'>256</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
|
58
docs/symbols/src/kis-js_src_modules_indexedDB.js.html
Normal file → Executable file
58
docs/symbols/src/kis-js_src_modules_indexedDB.js.html
Normal file → Executable file
@ -43,7 +43,7 @@
|
|||||||
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 38</span> </span><span class="WHIT">
|
<span class='line'> 38</span> </span><span class="WHIT">
|
||||||
<span class='line'> 39</span> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 39</span> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 40</span> </span><span class="WHIT">
|
<span class='line'> 40</span> </span><span class="WHIT">
|
||||||
<span class='line'> 41</span> </span><span class="COMM">// Ask for permission to use db</span><span class="WHIT">
|
<span class='line'> 41</span> </span><span class="COMM">// Ask for permission to use db</span><span class="WHIT">
|
||||||
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">db.open</span><span class="PUNC">(</span><span class="NAME">dbname</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">version</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">db.open</span><span class="PUNC">(</span><span class="NAME">dbname</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">version</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
@ -70,9 +70,53 @@
|
|||||||
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="COMM">// Connect to the specified db</span><span class="WHIT">
|
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="COMM">// Connect to the specified db</span><span class="WHIT">
|
||||||
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB.current_db</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">request.result</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB.current_db</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">request.result</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 68</span> </span><span class="WHIT">
|
<span class='line'> 68</span> * Helper function to create a new object store
|
||||||
<span class='line'> 69</span> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'indexedDB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 69</span> *
|
||||||
<span class='line'> 70</span> </span><span class="WHIT">
|
<span class='line'> 70</span> * @memberOf $_.indexedDB
|
||||||
<span class='line'> 71</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
<span class='line'> 71</span> * @name create_store
|
||||||
|
<span class='line'> 72</span> * @function
|
||||||
|
<span class='line'> 73</span> * @param string name
|
||||||
|
<span class='line'> 74</span> * @param [string] key
|
||||||
|
<span class='line'> 75</span> * @param [bool] generator
|
||||||
|
<span class='line'> 76</span> * @return IDBDataStore object
|
||||||
|
<span class='line'> 77</span> */</span><span class="WHIT">
|
||||||
|
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="NAME">create_store</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">generator</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
|
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 81</span> </span><span class="WHIT">
|
||||||
|
<span class='line'> 82</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
|
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="NAME">params.keyPath</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 86</span> </span><span class="WHIT">
|
||||||
|
<span class='line'> 87</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">generator</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
|
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="COMM">// Cast to a boolean value</span><span class="WHIT">
|
||||||
|
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="NAME">params.autoIncrement</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">!</span><span class="WHIT"> </span><span class="NAME">generator</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 92</span> </span><span class="WHIT">
|
||||||
|
<span class='line'> 93</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">db.createObjectStore</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
|
<span class='line'> 96</span> * Delete an object store
|
||||||
|
<span class='line'> 97</span> *
|
||||||
|
<span class='line'> 98</span> * @memberOf $_.indexedDB
|
||||||
|
<span class='line'> 99</span> * @name delete_store
|
||||||
|
<span class='line'>100</span> * @function
|
||||||
|
<span class='line'>101</span> * @param string name
|
||||||
|
<span class='line'>102</span> */</span><span class="WHIT">
|
||||||
|
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="NAME">delete_store</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
|
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>105</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">db.deleteObjectStore</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>106</span> </span><span class="WHIT">
|
||||||
|
<span class='line'>107</span> </span><span class="COMM">// Pass the error up</span><span class="WHIT">
|
||||||
|
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="NAME">request.onerror</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">db.onerror</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>110</span> </span><span class="WHIT">
|
||||||
|
<span class='line'>111</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>112</span> </span><span class="WHIT">
|
||||||
|
<span class='line'>113</span> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'indexedDB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>114</span> </span><span class="WHIT">
|
||||||
|
<span class='line'>115</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
@ -6,126 +6,127 @@
|
|||||||
.REGX {color: #339;}
|
.REGX {color: #339;}
|
||||||
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
||||||
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/**
|
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/**
|
||||||
<span class='line'> 2</span> * Store
|
<span class='line'> 2</span> * Store
|
||||||
<span class='line'> 3</span> *
|
<span class='line'> 3</span> *
|
||||||
<span class='line'> 4</span> * Wrapper for local / sessionstorage
|
<span class='line'> 4</span> * Wrapper for local / sessionstorage
|
||||||
<span class='line'> 5</span> */</span><span class="WHIT">
|
<span class='line'> 5</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 6</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 6</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 7</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 7</span>
|
||||||
<span class='line'> 8</span> </span><span class="WHIT">
|
<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 9</span> </span><span class="COMM">//No support for localstorage? Bail out early</span><span class="WHIT">
|
<span class='line'> 9</span>
|
||||||
<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">localStorage</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">JSON</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="COMM">//No support for localstorage? Bail out early</span><span class="WHIT">
|
||||||
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">localStorage</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">JSON</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 14</span> </span><span class="WHIT">
|
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 15</span> </span><span class="COMM">//Shortcuts for wrapper</span><span class="WHIT">
|
<span class='line'> 15</span>
|
||||||
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">localStorage</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="COMM">//Shortcuts for wrapper</span><span class="WHIT">
|
||||||
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sessionStorage</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">localStorage</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 18</span>
|
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sessionStorage</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 19</span>
|
||||||
<span class='line'> 20</span> * Wrapper for localstorage / sessionstorage data serialization.
|
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 21</span> * Each method has a boolean parameter, that when set as true switches the method
|
<span class='line'> 21</span> * Wrapper for localstorage / sessionstorage data serialization.
|
||||||
<span class='line'> 22</span> * to use sessionStorage rather than the default localStorage.
|
<span class='line'> 22</span> * Each method has a boolean parameter, that when set as true switches the method
|
||||||
<span class='line'> 23</span> *
|
<span class='line'> 23</span> * to use sessionStorage rather than the default localStorage.
|
||||||
<span class='line'> 24</span> * @name store
|
<span class='line'> 24</span> *
|
||||||
<span class='line'> 25</span> * @namespace
|
<span class='line'> 25</span> * @name store
|
||||||
<span class='line'> 26</span> * @memberOf $_
|
<span class='line'> 26</span> * @namespace
|
||||||
<span class='line'> 27</span> */</span><span class="WHIT">
|
<span class='line'> 27</span> * @memberOf $_
|
||||||
<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">store</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 28</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 29</span> </span><span class="COMM">/**
|
<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">store</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 30</span> * Retrieves and deserializes a value from localstorage,
|
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 31</span> * based on the specified key
|
<span class='line'> 31</span> * Retrieves and deserializes a value from localstorage,
|
||||||
<span class='line'> 32</span> *
|
<span class='line'> 32</span> * based on the specified key
|
||||||
<span class='line'> 33</span> * @param string key
|
<span class='line'> 33</span> *
|
||||||
<span class='line'> 34</span> * @param bool session
|
<span class='line'> 34</span> * @param string key
|
||||||
<span class='line'> 35</span> * @name get
|
<span class='line'> 35</span> * @param bool session
|
||||||
<span class='line'> 36</span> * @memberOf $_.store
|
<span class='line'> 36</span> * @name get
|
||||||
<span class='line'> 37</span> * @function
|
<span class='line'> 37</span> * @memberOf $_.store
|
||||||
<span class='line'> 38</span> * @return object
|
<span class='line'> 38</span> * @function
|
||||||
<span class='line'> 39</span> * @type object
|
<span class='line'> 39</span> * @return object
|
||||||
<span class='line'> 40</span> */</span><span class="WHIT">
|
<span class='line'> 40</span> * @type object
|
||||||
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="NAME">get</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 41</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="NAME">get</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">s.getItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">l.getItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 44</span> </span><span class="WHIT">
|
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">s.getItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">l.getItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 45</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">JSON.parse</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 45</span>
|
||||||
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">JSON.parse</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 48</span> * Puts a value into localstorage at the specified key,
|
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 49</span> * and JSON-encodes the value if not a string
|
<span class='line'> 49</span> * Puts a value into localstorage at the specified key,
|
||||||
<span class='line'> 50</span> *
|
<span class='line'> 50</span> * and JSON-encodes the value if not a string
|
||||||
<span class='line'> 51</span> * @param string key
|
<span class='line'> 51</span> *
|
||||||
<span class='line'> 52</span> * @param mixed value
|
<span class='line'> 52</span> * @param string key
|
||||||
<span class='line'> 53</span> * @param bool session
|
<span class='line'> 53</span> * @param mixed value
|
||||||
<span class='line'> 54</span> * @name set
|
<span class='line'> 54</span> * @param bool session
|
||||||
<span class='line'> 55</span> * @memberOf $_.store
|
<span class='line'> 55</span> * @name set
|
||||||
<span class='line'> 56</span> * @function
|
<span class='line'> 56</span> * @memberOf $_.store
|
||||||
<span class='line'> 57</span> */</span><span class="WHIT">
|
<span class='line'> 57</span> * @function
|
||||||
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="NAME">set</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 58</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="NAME">set</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="COMM">// Localstorage generally only accepts strings</span><span class="WHIT">
|
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">JSON.stringify</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="COMM">// Localstorage generally only accepts strings</span><span class="WHIT">
|
||||||
<span class='line'> 62</span>
|
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">JSON.stringify</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 63</span> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">s.setItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">l.setItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 63</span>
|
||||||
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">s.setItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">l.setItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 66</span> * Removes the specified item from storage
|
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 67</span> *
|
<span class='line'> 67</span> * Removes the specified item from storage
|
||||||
<span class='line'> 68</span> * @param string key
|
<span class='line'> 68</span> *
|
||||||
<span class='line'> 69</span> * @param bool session
|
<span class='line'> 69</span> * @param string key
|
||||||
<span class='line'> 70</span> * @name remove
|
<span class='line'> 70</span> * @param bool session
|
||||||
<span class='line'> 71</span> * @memberOf $_.store
|
<span class='line'> 71</span> * @name remove
|
||||||
<span class='line'> 72</span> * @function
|
<span class='line'> 72</span> * @memberOf $_.store
|
||||||
<span class='line'> 73</span> */</span><span class="WHIT">
|
<span class='line'> 73</span> * @function
|
||||||
<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="NAME">remove</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 74</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="NAME">remove</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">s.removeItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">l.removeItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">s.removeItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">l.removeItem</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 79</span> * Returns an object of all the raw values in storage
|
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 80</span> *
|
<span class='line'> 80</span> * Returns an object of all the raw values in storage
|
||||||
<span class='line'> 81</span> * @param bool session
|
<span class='line'> 81</span> *
|
||||||
<span class='line'> 82</span> * @name getAll
|
<span class='line'> 82</span> * @param bool session
|
||||||
<span class='line'> 83</span> * @memberOf $_.store
|
<span class='line'> 83</span> * @name getAll
|
||||||
<span class='line'> 84</span> * @function
|
<span class='line'> 84</span> * @memberOf $_.store
|
||||||
<span class='line'> 85</span> * @return object
|
<span class='line'> 85</span> * @function
|
||||||
<span class='line'> 86</span> * @type object
|
<span class='line'> 86</span> * @return object
|
||||||
<span class='line'> 87</span> */</span><span class="WHIT">
|
<span class='line'> 87</span> * @type object
|
||||||
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="NAME">getAll</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 88</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="NAME">getAll</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 95</span> </span><span class="WHIT">
|
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 96</span> </span><span class="COMM">//Reference to session/localstorage</span><span class="WHIT">
|
<span class='line'> 96</span>
|
||||||
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="COMM">//Reference to session/localstorage</span><span class="WHIT">
|
||||||
<span class='line'> 98</span> </span><span class="WHIT">
|
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 99</span> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.length</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 99</span>
|
||||||
<span class='line'>100</span>
|
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>101</span>
|
||||||
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.key</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.getItem</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.key</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>105</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>105</span> </span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.getItem</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>106</span>
|
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>107</span>
|
||||||
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>110</span> * Removes all values from the same domain storage
|
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>111</span> *
|
<span class='line'>111</span> * Removes all values from the same domain storage
|
||||||
<span class='line'>112</span> * @param bool session
|
<span class='line'>112</span> *
|
||||||
<span class='line'>113</span> * @name clear
|
<span class='line'>113</span> * @param bool session
|
||||||
<span class='line'>114</span> * @memberOf $_.store
|
<span class='line'>114</span> * @name clear
|
||||||
<span class='line'>115</span> * @function
|
<span class='line'>115</span> * @memberOf $_.store
|
||||||
<span class='line'>116</span> */</span><span class="WHIT">
|
<span class='line'>116</span> * @function
|
||||||
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="NAME">clear</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>117</span> */</span><span class="WHIT">
|
||||||
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="NAME">clear</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">s.clear</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">l.clear</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sess</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">s.clear</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">l.clear</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>122</span>
|
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'store'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">store</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>123</span>
|
||||||
<span class='line'>124</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'store'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">store</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>125</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
@ -7,7 +7,7 @@
|
|||||||
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
||||||
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/**
|
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/**
|
||||||
<span class='line'> 2</span> * Util Object
|
<span class='line'> 2</span> * Util Object
|
||||||
<span class='line'> 3</span> *
|
<span class='line'> 3</span> *
|
||||||
<span class='line'> 4</span> * Various object and string manipulation functions
|
<span class='line'> 4</span> * Various object and string manipulation functions
|
||||||
<span class='line'> 5</span> * Note: these are based on similar phpjs functions: http://phpjs.org
|
<span class='line'> 5</span> * Note: these are based on similar phpjs functions: http://phpjs.org
|
||||||
<span class='line'> 6</span> */</span><span class="WHIT">
|
<span class='line'> 6</span> */</span><span class="WHIT">
|
||||||
@ -15,356 +15,355 @@
|
|||||||
<span class='line'> 8</span>
|
<span class='line'> 8</span>
|
||||||
<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 10</span>
|
<span class='line'> 10</span>
|
||||||
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT">
|
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">reverse_key_sort</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 12</span> </span><span class="NAME">reverse_key_sort</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="COMM">//Define some variables</span><span class="WHIT">
|
||||||
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="COMM">//Define some variables</span><span class="WHIT">
|
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="NAME">new_o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">new_o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 18</span>
|
||||||
<span class='line'> 19</span> </span><span class="WHIT">
|
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="COMM">//Extract the keys</span><span class="WHIT">
|
||||||
<span class='line'> 20</span> </span><span class="COMM">//Extract the keys</span><span class="WHIT">
|
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="NAME">keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">u.object_keys</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">u.object_keys</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 21</span>
|
||||||
<span class='line'> 22</span> </span><span class="WHIT">
|
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="COMM">//Sort the keys</span><span class="WHIT">
|
||||||
<span class='line'> 23</span> </span><span class="COMM">//Sort the keys</span><span class="WHIT">
|
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="NAME">keys.sort</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="NAME">keys.sort</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">aFloat</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 25</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">aFloat</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="NAME">bFloat</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="NAME">bFloat</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="NAME">aNumeric</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">aFloat</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">''</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="NAME">aNumeric</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">aFloat</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">''</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="NAME">bNumeric</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">bFloat</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">''</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="NAME">bNumeric</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">bFloat</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">''</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 28</span>
|
||||||
<span class='line'> 29</span>
|
<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aNumeric</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">bNumeric</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aNumeric</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">bNumeric</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 31</span> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">aFloat</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">bFloat</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">aFloat</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">bFloat</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">aFloat</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">bFloat</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">aFloat</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">bFloat</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aNumeric</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">bNumeric</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 34</span> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aNumeric</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">bNumeric</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 35</span> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">aNumeric</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">bNumeric</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 38</span> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">aNumeric</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">bNumeric</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 39</span> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 41</span>
|
||||||
<span class='line'> 42</span> </span><span class="WHIT">
|
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">b</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">b</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 43</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">b</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">b</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 44</span>
|
||||||
<span class='line'> 45</span> </span><span class="WHIT">
|
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="COMM">// cache object/array size</span><span class="WHIT">
|
||||||
<span class='line'> 46</span> </span><span class="COMM">// cache object/array size</span><span class="WHIT">
|
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keys.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keys.length</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 47</span>
|
||||||
<span class='line'> 48</span> </span><span class="WHIT">
|
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="COMM">// Recreate the object/array</span><span class="WHIT">
|
||||||
<span class='line'> 49</span> </span><span class="COMM">// Recreate the object/array</span><span class="WHIT">
|
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="NAME">new_o</span><span class="PUNC">[</span><span class="NAME">keys</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">[</span><span class="NAME">keys</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="NAME">new_o</span><span class="PUNC">[</span><span class="NAME">keys</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">[</span><span class="NAME">keys</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 53</span>
|
||||||
<span class='line'> 54</span> </span><span class="WHIT">
|
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_o</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 55</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_o</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 56</span>
|
||||||
<span class='line'> 57</span> </span><span class="WHIT">
|
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 58</span> </span><span class="COMM">/**
|
<span class='line'> 58</span> * String and object manipulation utilities
|
||||||
<span class='line'> 59</span> * String and object manipulation utilities
|
<span class='line'> 59</span> *
|
||||||
<span class='line'> 60</span> *
|
<span class='line'> 60</span> * @namespace
|
||||||
<span class='line'> 61</span> * @namespace
|
<span class='line'> 61</span> * @name util
|
||||||
<span class='line'> 62</span> * @name util
|
<span class='line'> 62</span> * @memberOf $_
|
||||||
<span class='line'> 63</span> * @memberOf $_
|
<span class='line'> 63</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 64</span> */</span><span class="WHIT">
|
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">u</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="NAME">u</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 66</span> * Retrieve the keys, or member names of an object
|
||||||
<span class='line'> 67</span> * Retrieve the keys, or member names of an object
|
<span class='line'> 67</span> *
|
||||||
<span class='line'> 68</span> *
|
<span class='line'> 68</span> * @name object_keys
|
||||||
<span class='line'> 69</span> * @name object_keys
|
<span class='line'> 69</span> * @memberOf $_.util
|
||||||
<span class='line'> 70</span> * @memberOf $_.util
|
<span class='line'> 70</span> * @function
|
||||||
<span class='line'> 71</span> * @function
|
<span class='line'> 71</span> * @param object
|
||||||
<span class='line'> 72</span> * @param object
|
<span class='line'> 72</span> * @return array
|
||||||
<span class='line'> 73</span> * @return array
|
<span class='line'> 73</span> * @type array
|
||||||
<span class='line'> 74</span> * @type array
|
<span class='line'> 74</span> */</span><span class="WHIT">
|
||||||
<span class='line'> 75</span> */</span><span class="WHIT">
|
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="NAME">object_keys</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="NAME">object_keys</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 79</span>
|
||||||
<span class='line'> 80</span> </span><span class="WHIT">
|
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">k</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 81</span> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">k</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">o.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">o.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="NAME">keys.push</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="NAME">keys.push</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 87</span>
|
||||||
<span class='line'> 88</span> </span><span class="WHIT">
|
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 89</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'> 91</span> * Retrieves the values of an object, and returns
|
||||||
<span class='line'> 92</span> * Retrieves the values of an object, and returns
|
<span class='line'> 92</span> * them as an array
|
||||||
<span class='line'> 93</span> * them as an array
|
<span class='line'> 93</span> *
|
||||||
<span class='line'> 94</span> *
|
<span class='line'> 94</span> * @name object_values
|
||||||
<span class='line'> 95</span> * @name object_values
|
<span class='line'> 95</span> * @memberOf $_.util
|
||||||
<span class='line'> 96</span> * @memberOf $_.util
|
<span class='line'> 96</span> * @function
|
||||||
<span class='line'> 97</span> * @function
|
<span class='line'> 97</span> * @param object
|
||||||
<span class='line'> 98</span> * @param object
|
<span class='line'> 98</span> * @return array
|
||||||
<span class='line'> 99</span> * @return array
|
<span class='line'> 99</span> * @type array
|
||||||
<span class='line'>100</span> * @type array
|
<span class='line'>100</span> */</span><span class="WHIT">
|
||||||
<span class='line'>101</span> */</span><span class="WHIT">
|
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="NAME">object_values</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="NAME">object_values</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>105</span> </span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>105</span>
|
||||||
<span class='line'>106</span> </span><span class="WHIT">
|
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">prop</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>107</span> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">prop</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="NAME">vals.push</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="NAME">vals.push</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>110</span>
|
||||||
<span class='line'>111</span> </span><span class="WHIT">
|
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>112</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>114</span> * Creates an object, with the property names of the first array,
|
||||||
<span class='line'>115</span> * Creates an object, with the property names of the first array,
|
<span class='line'>115</span> * and the values of the second. If objects are passed, the values
|
||||||
<span class='line'>116</span> * and the values of the second. If objects are passed, the values
|
<span class='line'>116</span> * of the object are used. If the arrays or objects passed are
|
||||||
<span class='line'>117</span> * of the object are used. If the arrays or objects passed are
|
<span class='line'>117</span> * not the same size, the function will return false.
|
||||||
<span class='line'>118</span> * not the same size, the function will return false.
|
<span class='line'>118</span> *
|
||||||
<span class='line'>119</span> *
|
<span class='line'>119</span> * @name array_combine
|
||||||
<span class='line'>120</span> * @name array_combine
|
<span class='line'>120</span> * @memberOf $_.util
|
||||||
<span class='line'>121</span> * @memberOf $_.util
|
<span class='line'>121</span> * @function
|
||||||
<span class='line'>122</span> * @function
|
<span class='line'>122</span> * @param array/object keys
|
||||||
<span class='line'>123</span> * @param array/object keys
|
<span class='line'>123</span> * @param array/object vals
|
||||||
<span class='line'>124</span> * @param array/object vals
|
<span class='line'>124</span> * @return object
|
||||||
<span class='line'>125</span> * @return object
|
<span class='line'>125</span> * @type object
|
||||||
<span class='line'>126</span> * @type object
|
<span class='line'>126</span> */</span><span class="WHIT">
|
||||||
<span class='line'>127</span> */</span><span class="WHIT">
|
<span class='line'>127</span> </span><span class="WHIT"> </span><span class="NAME">array_combine</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">keys</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>128</span> </span><span class="WHIT"> </span><span class="NAME">array_combine</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">keys</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>128</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">new_object</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>130</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">new_object</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>130</span> </span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>131</span> </span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>131</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>132</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>132</span>
|
||||||
<span class='line'>133</span> </span><span class="WHIT">
|
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="COMM">// Extract the keys or values if needed</span><span class="WHIT">
|
||||||
<span class='line'>134</span> </span><span class="COMM">// Extract the keys or values if needed</span><span class="WHIT">
|
<span class='line'>134</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$_.type</span><span class="PUNC">(</span><span class="NAME">keys</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>135</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$_.type</span><span class="PUNC">(</span><span class="NAME">keys</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>135</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="NAME">keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.object_values</span><span class="PUNC">(</span><span class="NAME">keys</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>137</span> </span><span class="WHIT"> </span><span class="NAME">keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.object_values</span><span class="PUNC">(</span><span class="NAME">keys</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>137</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$_.type</span><span class="PUNC">(</span><span class="NAME">vals</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>139</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$_.type</span><span class="PUNC">(</span><span class="NAME">vals</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>139</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="NAME">vals</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.object_values</span><span class="PUNC">(</span><span class="NAME">vals</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="NAME">vals</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.object_values</span><span class="PUNC">(</span><span class="NAME">vals</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>142</span>
|
||||||
<span class='line'>143</span> </span><span class="WHIT">
|
<span class='line'>143</span> </span><span class="WHIT"> </span><span class="COMM">// cache the number of keys</span><span class="WHIT">
|
||||||
<span class='line'>144</span> </span><span class="COMM">// cache the number of keys</span><span class="WHIT">
|
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keys.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>145</span> </span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keys.length</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>145</span>
|
||||||
<span class='line'>146</span> </span><span class="WHIT">
|
<span class='line'>146</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">num_keys</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">vals.length</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>147</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">num_keys</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">vals.length</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>147</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>148</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>148</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Object combine requires two arrays of the same size"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>149</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Object combine requires two arrays of the same size"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>149</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>150</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>150</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>151</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>151</span>
|
||||||
<span class='line'>152</span> </span><span class="WHIT">
|
<span class='line'>152</span> </span><span class="WHIT"> </span><span class="COMM">// Create and return the new object</span><span class="WHIT">
|
||||||
<span class='line'>153</span> </span><span class="COMM">// Create and return the new object</span><span class="WHIT">
|
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">num_keys</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>155</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>155</span> </span><span class="WHIT"> </span><span class="NAME">new_object</span><span class="PUNC">[</span><span class="NAME">keys</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="NAME">new_object</span><span class="PUNC">[</span><span class="NAME">keys</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>157</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>157</span>
|
||||||
<span class='line'>158</span> </span><span class="WHIT">
|
<span class='line'>158</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_object</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>159</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_object</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>159</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>160</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>160</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>161</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>161</span> * Combines two or more objects/arrays. If the keys are numeric, the outputted
|
||||||
<span class='line'>162</span> * Combines two or more objects/arrays. If the keys are numeric, the outputted
|
<span class='line'>162</span> * object will have re-indexed keys. If a key/value pair exists in both objects,
|
||||||
<span class='line'>163</span> * object will have re-indexed keys. If a key/value pair exists in both objects,
|
<span class='line'>163</span> * indentical values will be droped, but if a key exists with a different value,
|
||||||
<span class='line'>164</span> * indentical values will be droped, but if a key exists with a different value,
|
<span class='line'>164</span> * with the same key, the value in the second array will replace the value in the
|
||||||
<span class='line'>165</span> * with the same key, the value in the second array will replace the value in the
|
<span class='line'>165</span> * first
|
||||||
<span class='line'>166</span> * first
|
<span class='line'>166</span> *
|
||||||
<span class='line'>167</span> *
|
<span class='line'>167</span> * @name object_merge
|
||||||
<span class='line'>168</span> * @name object_merge
|
<span class='line'>168</span> * @memberOf $_.util
|
||||||
<span class='line'>169</span> * @memberOf $_.util
|
<span class='line'>169</span> * @function
|
||||||
<span class='line'>170</span> * @function
|
<span class='line'>170</span> * @param object [as many as you wish to combine]
|
||||||
<span class='line'>171</span> * @param object [as many as you wish to combine]
|
<span class='line'>171</span> * @type object
|
||||||
<span class='line'>172</span> * @type object
|
<span class='line'>172</span> * @return object
|
||||||
<span class='line'>173</span> * @return object
|
<span class='line'>173</span> */</span><span class="WHIT">
|
||||||
<span class='line'>174</span> */</span><span class="WHIT">
|
<span class='line'>174</span> </span><span class="WHIT"> </span><span class="NAME">object_merge</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="NAME">object_merge</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>176</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>176</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Array.prototype.slice.call</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>177</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Array.prototype.slice.call</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>177</span> </span><span class="WHIT"> </span><span class="NAME">arg_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args.length</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>178</span> </span><span class="WHIT"> </span><span class="NAME">arg_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args.length</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>178</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="NAME">iarg_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="NAME">iarg_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>182</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>182</span> </span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="NAME">is_array</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>185</span> </span><span class="WHIT"> </span><span class="NAME">is_array</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>185</span>
|
||||||
<span class='line'>186</span> </span><span class="WHIT">
|
<span class='line'>186</span> </span><span class="WHIT"> </span><span class="COMM">// Check for an array in the arguments</span><span class="WHIT">
|
||||||
<span class='line'>187</span> </span><span class="COMM">// Check for an array in the arguments</span><span class="WHIT">
|
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">arg_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>188</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">arg_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>188</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>189</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>189</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$_.type</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>190</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$_.type</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>190</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>191</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>191</span> </span><span class="WHIT"> </span><span class="NAME">is_array</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>192</span> </span><span class="WHIT"> </span><span class="NAME">is_array</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>192</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>193</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>193</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>195</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>195</span>
|
||||||
<span class='line'>196</span> </span><span class="WHIT">
|
<span class='line'>196</span> </span><span class="WHIT"> </span><span class="COMM">// If all the arguments are javascript arrays</span><span class="WHIT">
|
||||||
<span class='line'>197</span> </span><span class="COMM">// If all the arguments are javascript arrays</span><span class="WHIT">
|
<span class='line'>197</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">is_array</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">is_array</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="COMM">// Let javascript do all the work!</span><span class="WHIT">
|
||||||
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="COMM">// Let javascript do all the work!</span><span class="WHIT">
|
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">arg_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">arg_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">new_obj.contact</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">new_obj.contact</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>205</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>205</span>
|
||||||
<span class='line'>206</span> </span><span class="WHIT">
|
<span class='line'>206</span> </span><span class="WHIT"> </span><span class="COMM">// Return early</span><span class="WHIT">
|
||||||
<span class='line'>207</span> </span><span class="COMM">// Return early</span><span class="WHIT">
|
<span class='line'>207</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>209</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>209</span>
|
||||||
<span class='line'>210</span> </span><span class="WHIT">
|
<span class='line'>210</span> </span><span class="WHIT"> </span><span class="COMM">// No, there's at least one object</span><span class="WHIT">
|
||||||
<span class='line'>211</span> </span><span class="COMM">// No, there's at least one object</span><span class="WHIT">
|
<span class='line'>211</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">arg_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>212</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">arg_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>212</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="NAME">arg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>214</span> </span><span class="WHIT"> </span><span class="NAME">arg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>214</span>
|
||||||
<span class='line'>215</span> </span><span class="WHIT">
|
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="COMM">// If the argument is an array, add the array items as</span><span class="WHIT">
|
||||||
<span class='line'>216</span> </span><span class="COMM">// If the argument is an array, add the array items as</span><span class="WHIT">
|
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="COMM">// numeric object properties</span><span class="WHIT">
|
||||||
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="COMM">// numeric object properties</span><span class="WHIT">
|
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$_.type</span><span class="PUNC">(</span><span class="NAME">arg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$_.type</span><span class="PUNC">(</span><span class="NAME">arg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">iarg_len</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arg.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">iarg_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">iarg_len</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arg.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">iarg_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>222</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>222</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>223</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>223</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||||
<span class='line'>225</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
<span class='line'>225</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>226</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>226</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">j</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>227</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">j</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>227</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">arg.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">arg.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="COMM">// If the key is numeric, add the property with</span><span class="WHIT">
|
||||||
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="COMM">// If the key is numeric, add the property with</span><span class="WHIT">
|
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="COMM">// a numeric key</span><span class="WHIT">
|
||||||
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="COMM">// a numeric key</span><span class="WHIT">
|
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">''</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">''</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>236</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>236</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||||
<span class='line'>237</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
<span class='line'>237</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arg</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>241</span> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>242</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>242</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>243</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>243</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>244</span> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>244</span>
|
||||||
<span class='line'>245</span> </span><span class="WHIT">
|
<span class='line'>245</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>246</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_obj</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||||
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
<span class='line'>248</span> * Replaces sections of strings in a greedy fashion,
|
||||||
<span class='line'>249</span> * Replaces sections of strings in a greedy fashion,
|
<span class='line'>249</span> * starting with the longest replace pairs first. Accepts
|
||||||
<span class='line'>250</span> * starting with the longest replace pairs first. Accepts
|
<span class='line'>250</span> * one replace pair as two parameters, or an object, with
|
||||||
<span class='line'>251</span> * one replace pair as two parameters, or an object, with
|
<span class='line'>251</span> * from => to replacements as key/value pairs
|
||||||
<span class='line'>252</span> * from => to replacements as key/value pairs
|
<span class='line'>252</span> *
|
||||||
<span class='line'>253</span> *
|
<span class='line'>253</span> * @name str_trans
|
||||||
<span class='line'>254</span> * @name str_trans
|
<span class='line'>254</span> * @memberOf $_.util
|
||||||
<span class='line'>255</span> * @memberOf $_.util
|
<span class='line'>255</span> * @function
|
||||||
<span class='line'>256</span> * @function
|
<span class='line'>256</span> * @param string input_string
|
||||||
<span class='line'>257</span> * @param string input_string
|
<span class='line'>257</span> * @param mixed from (string)/replace pairs (object)
|
||||||
<span class='line'>258</span> * @param mixed from (string)/replace pairs (object)
|
<span class='line'>258</span> * @param [string]
|
||||||
<span class='line'>259</span> * @param [string]
|
<span class='line'>259</span> * @return string
|
||||||
<span class='line'>260</span> * @return string
|
<span class='line'>260</span> * @type string
|
||||||
<span class='line'>261</span> * @type string
|
<span class='line'>261</span> */</span><span class="WHIT">
|
||||||
<span class='line'>262</span> */</span><span class="WHIT">
|
<span class='line'>262</span> </span><span class="WHIT"> </span><span class="NAME">str_trans</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">to</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>263</span> </span><span class="WHIT"> </span><span class="NAME">str_trans</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">to</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>263</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>264</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>264</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">froms</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>265</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">froms</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>265</span> </span><span class="WHIT"> </span><span class="NAME">tos</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>266</span> </span><span class="WHIT"> </span><span class="NAME">tos</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>266</span> </span><span class="WHIT"> </span><span class="NAME">ret</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>267</span> </span><span class="WHIT"> </span><span class="NAME">ret</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>267</span> </span><span class="WHIT"> </span><span class="NAME">match</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>268</span> </span><span class="WHIT"> </span><span class="NAME">match</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>268</span> </span><span class="WHIT"> </span><span class="NAME">from_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>269</span> </span><span class="WHIT"> </span><span class="NAME">from_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>269</span> </span><span class="WHIT"> </span><span class="NAME">str_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>270</span> </span><span class="WHIT"> </span><span class="NAME">str_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>270</span> </span><span class="WHIT"> </span><span class="NAME">to_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>271</span> </span><span class="WHIT"> </span><span class="NAME">to_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>271</span> </span><span class="WHIT"> </span><span class="NAME">to_is_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>272</span> </span><span class="WHIT"> </span><span class="NAME">to_is_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>272</span> </span><span class="WHIT"> </span><span class="NAME">from_is_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>273</span> </span><span class="WHIT"> </span><span class="NAME">from_is_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>273</span> </span><span class="WHIT"> </span><span class="NAME">strx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>274</span> </span><span class="WHIT"> </span><span class="NAME">strx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>274</span> </span><span class="WHIT"> </span><span class="NAME">strw</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>275</span> </span><span class="WHIT"> </span><span class="NAME">strw</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>275</span> </span><span class="WHIT"> </span><span class="NAME">stry</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>276</span> </span><span class="WHIT"> </span><span class="NAME">stry</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>276</span> </span><span class="WHIT"> </span><span class="NAME">from_strx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>277</span> </span><span class="WHIT"> </span><span class="NAME">from_strx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>277</span> </span><span class="WHIT"> </span><span class="NAME">new_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>278</span> </span><span class="WHIT"> </span><span class="NAME">new_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>278</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>279</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>279</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>280</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>280</span> </span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>281</span> </span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>281</span>
|
||||||
<span class='line'>282</span> </span><span class="WHIT">
|
<span class='line'>282</span> </span><span class="WHIT"> </span><span class="COMM">//Replace pairs? add them to the internal arrays</span><span class="WHIT">
|
||||||
<span class='line'>283</span> </span><span class="COMM">//Replace pairs? add them to the internal arrays</span><span class="WHIT">
|
<span class='line'>283</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">from</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>284</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">from</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>284</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>285</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>285</span> </span><span class="WHIT"> </span><span class="COMM">// Sort the keys in descending order for better</span><span class="WHIT">
|
||||||
<span class='line'>286</span> </span><span class="WHIT"> </span><span class="COMM">// Sort the keys in descending order for better</span><span class="WHIT">
|
<span class='line'>286</span> </span><span class="WHIT"> </span><span class="COMM">// replacement functionality</span><span class="WHIT">
|
||||||
<span class='line'>287</span> </span><span class="WHIT"> </span><span class="COMM">// replacement functionality</span><span class="WHIT">
|
<span class='line'>287</span> </span><span class="WHIT"> </span><span class="NAME">from</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">reverse_key_sort</span><span class="PUNC">(</span><span class="NAME">from</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>288</span> </span><span class="WHIT"> </span><span class="NAME">from</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">reverse_key_sort</span><span class="PUNC">(</span><span class="NAME">from</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>288</span>
|
||||||
<span class='line'>289</span> </span><span class="WHIT">
|
<span class='line'>289</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">f</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>290</span> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">f</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>290</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>291</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>291</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">from.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>292</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">from.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>292</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>293</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>293</span> </span><span class="WHIT"> </span><span class="NAME">froms.push</span><span class="PUNC">(</span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>294</span> </span><span class="WHIT"> </span><span class="NAME">froms.push</span><span class="PUNC">(</span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>294</span> </span><span class="WHIT"> </span><span class="NAME">tos.push</span><span class="PUNC">(</span><span class="NAME">from</span><span class="PUNC">[</span><span class="NAME">f</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="NAME">tos.push</span><span class="PUNC">(</span><span class="NAME">from</span><span class="PUNC">[</span><span class="NAME">f</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>296</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>296</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>297</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>297</span>
|
||||||
<span class='line'>298</span> </span><span class="WHIT">
|
<span class='line'>298</span> </span><span class="WHIT"> </span><span class="NAME">from</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">froms</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>299</span> </span><span class="NAME">from</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">froms</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>299</span> </span><span class="WHIT"> </span><span class="NAME">to</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">tos</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>300</span> </span><span class="WHIT"> </span><span class="NAME">to</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">tos</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>300</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>301</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>301</span>
|
||||||
<span class='line'>302</span> </span><span class="WHIT">
|
<span class='line'>302</span> </span><span class="WHIT"> </span><span class="COMM">//Go through the string, and replace characters as needed</span><span class="WHIT">
|
||||||
<span class='line'>303</span> </span><span class="COMM">//Go through the string, and replace characters as needed</span><span class="WHIT">
|
<span class='line'>303</span> </span><span class="WHIT"> </span><span class="NAME">str_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>304</span> </span><span class="WHIT"> </span><span class="NAME">str_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.length</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>304</span> </span><span class="WHIT"> </span><span class="NAME">from_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">from.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>305</span> </span><span class="WHIT"> </span><span class="NAME">from_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">from.length</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>305</span> </span><span class="WHIT"> </span><span class="NAME">to_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">to.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>306</span> </span><span class="WHIT"> </span><span class="NAME">to_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">to.length</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>306</span> </span><span class="WHIT"> </span><span class="NAME">to_is_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">to</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>307</span> </span><span class="WHIT"> </span><span class="NAME">to_is_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">to</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>307</span> </span><span class="WHIT"> </span><span class="NAME">from_is_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">from</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>308</span> </span><span class="WHIT"> </span><span class="NAME">from_is_str</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">from</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>308</span>
|
||||||
<span class='line'>309</span> </span><span class="WHIT">
|
<span class='line'>309</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">str_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>310</span> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">str_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>310</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>311</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>311</span> </span><span class="WHIT"> </span><span class="NAME">match</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>312</span> </span><span class="WHIT"> </span><span class="NAME">match</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>312</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">from_is_str</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>313</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">from_is_str</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>313</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>314</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>314</span> </span><span class="WHIT"> </span><span class="NAME">strw</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.charAt</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>315</span> </span><span class="WHIT"> </span><span class="NAME">strw</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.charAt</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>315</span> </span><span class="WHIT"> </span><span class="NAME">strx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.charAt</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>316</span> </span><span class="WHIT"> </span><span class="NAME">strx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.charAt</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>316</span> </span><span class="WHIT"> </span><span class="NAME">stry</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.charAt</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>317</span> </span><span class="WHIT"> </span><span class="NAME">stry</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.charAt</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>317</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">from_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">from_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>319</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>319</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">strx</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">from.charAt</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>320</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">strx</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">from.charAt</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>320</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>321</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>321</span> </span><span class="WHIT"> </span><span class="NAME">match</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>322</span> </span><span class="WHIT"> </span><span class="NAME">match</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>322</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>323</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>323</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>324</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>324</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>325</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>325</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>326</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>326</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||||
<span class='line'>327</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
<span class='line'>327</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>328</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>328</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">from_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>329</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">from_len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>329</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>330</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>330</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">str.substr</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>331</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">str.substr</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>331</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>332</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>332</span> </span><span class="WHIT"> </span><span class="NAME">match</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>333</span> </span><span class="WHIT"> </span><span class="NAME">match</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>333</span>
|
||||||
<span class='line'>334</span> </span><span class="WHIT">
|
<span class='line'>334</span> </span><span class="WHIT"> </span><span class="COMM">//Go past the current match</span><span class="WHIT">
|
||||||
<span class='line'>335</span> </span><span class="COMM">//Go past the current match</span><span class="WHIT">
|
<span class='line'>335</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>336</span> </span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">from</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>336</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>337</span> </span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>337</span>
|
||||||
<span class='line'>338</span>
|
<span class='line'>338</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>339</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>339</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>340</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>340</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>341</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>341</span>
|
||||||
<span class='line'>342</span>
|
<span class='line'>342</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">match</span><span class="PUNC">)</span><span class="WHIT">
|
||||||
<span class='line'>343</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">match</span><span class="PUNC">)</span><span class="WHIT">
|
<span class='line'>343</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>344</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>344</span> </span><span class="WHIT"> </span><span class="NAME">new_str</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">to_is_str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">to.charAt</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">to</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>345</span> </span><span class="WHIT"> </span><span class="NAME">new_str</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">to_is_str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">to.charAt</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">to</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>345</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>346</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>346</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||||
<span class='line'>347</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
<span class='line'>347</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>348</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>348</span> </span><span class="WHIT"> </span><span class="NAME">new_str</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.charAt</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>349</span> </span><span class="WHIT"> </span><span class="NAME">new_str</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str.charAt</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>349</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>350</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>350</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>351</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>351</span>
|
||||||
<span class='line'>352</span>
|
<span class='line'>352</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_str</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>353</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">new_str</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>353</span>
|
||||||
<span class='line'>354</span> </span><span class="WHIT">
|
<span class='line'>354</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>355</span> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>355</span>
|
||||||
<span class='line'>356</span> </span><span class="WHIT">
|
<span class='line'>356</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>357</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>357</span>
|
||||||
<span class='line'>358</span>
|
<span class='line'>358</span> </span><span class="WHIT"> </span><span class="COMM">//Add it to the $_ object</span><span class="WHIT">
|
||||||
<span class='line'>359</span> </span><span class="WHIT"> </span><span class="COMM">//Add it to the $_ object</span><span class="WHIT">
|
<span class='line'>359</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'util'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>360</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'util'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>360</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>361</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>361</span>
|
||||||
<span class='line'>362</span>
|
<span class='line'>362</span> </span></pre></body></html>
|
||||||
<span class='line'>363</span> </span></pre></body></html>
|
|
617
kis-all.js
617
kis-all.js
File diff suppressed because it is too large
Load Diff
204
kis-lite-dom-min.js
vendored
204
kis-lite-dom-min.js
vendored
@ -2,7 +2,7 @@
|
|||||||
Kis JS Keep It Simple JS Library
|
Kis JS Keep It Simple JS Library
|
||||||
Copyright Timothy J. Warren
|
Copyright Timothy J. Warren
|
||||||
License Public Domain
|
License Public Domain
|
||||||
Version 0.5.0
|
Version 0.6.0
|
||||||
*/
|
*/
|
||||||
(function (){
|
(function (){
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var $_, $, dcopy, sel;
|
var $_, $, dcopy, sel;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $_
|
* $_
|
||||||
@ -38,7 +38,7 @@
|
|||||||
if(typeof s === "undefined")
|
if(typeof s === "undefined")
|
||||||
{
|
{
|
||||||
//Defines a "global" selector for that instance
|
//Defines a "global" selector for that instance
|
||||||
sel = (typeof $_.el !== "undefined")
|
sel = (typeof $_.el !== "undefined")
|
||||||
? $_.el
|
? $_.el
|
||||||
: document.documentElement;
|
: document.documentElement;
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@
|
|||||||
{
|
{
|
||||||
sel = (typeof s !== "object") ? $(s) : s;
|
sel = (typeof s !== "object") ? $(s) : s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the selector to the prototype
|
// Add the selector to the prototype
|
||||||
$_.prototype.el = sel;
|
$_.prototype.el = sel;
|
||||||
|
|
||||||
@ -54,19 +54,19 @@
|
|||||||
var self = dcopy($_);
|
var self = dcopy($_);
|
||||||
|
|
||||||
// Give sel to each extension.
|
// Give sel to each extension.
|
||||||
for(var i in self)
|
for(var i in self)
|
||||||
{
|
{
|
||||||
if(typeof self[i] === "object")
|
if(typeof self[i] === "object")
|
||||||
{
|
{
|
||||||
self[i].el = sel;
|
self[i].el = sel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.el = sel;
|
self.el = sel;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple DOM selector function
|
* Simple DOM selector function
|
||||||
*
|
*
|
||||||
@ -79,14 +79,14 @@
|
|||||||
$ = function (a, context)
|
$ = function (a, context)
|
||||||
{
|
{
|
||||||
var x, c;
|
var x, c;
|
||||||
|
|
||||||
if (typeof a != "string" || typeof a === "undefined"){ return a;}
|
if (typeof a != "string" || typeof a === "undefined"){ return a;}
|
||||||
|
|
||||||
//Check for a context of a specific element, otherwise, just run on the document
|
//Check for a context of a specific element, otherwise, just run on the document
|
||||||
c = (context != null && context.nodeType === 1)
|
c = (context != null && context.nodeType === 1)
|
||||||
? context
|
? context
|
||||||
: document;
|
: document;
|
||||||
|
|
||||||
//Pick the quickest method for each kind of selector
|
//Pick the quickest method for each kind of selector
|
||||||
if (a.match(/^#([\w\-]+$)/))
|
if (a.match(/^#([\w\-]+$)/))
|
||||||
{
|
{
|
||||||
@ -96,11 +96,11 @@
|
|||||||
{
|
{
|
||||||
x = c.querySelectorAll(a);
|
x = c.querySelectorAll(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return the single object if applicable
|
//Return the single object if applicable
|
||||||
return (x.length === 1) ? x[0] : x;
|
return (x.length === 1) ? x[0] : x;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deep copy/prototypical constructor function
|
* Deep copy/prototypical constructor function
|
||||||
*
|
*
|
||||||
@ -112,38 +112,38 @@
|
|||||||
dcopy = function(obj)
|
dcopy = function(obj)
|
||||||
{
|
{
|
||||||
var type, F;
|
var type, F;
|
||||||
|
|
||||||
if(typeof obj === "undefined")
|
if(typeof obj === "undefined")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof Object.create !== "undefined")
|
if(typeof Object.create !== "undefined")
|
||||||
{
|
{
|
||||||
return Object.create(obj);
|
return Object.create(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
type = typeof obj;
|
type = typeof obj;
|
||||||
|
|
||||||
if(type !== "object" && type !== "function")
|
if(type !== "object" && type !== "function")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
F = function(){};
|
F = function(){};
|
||||||
|
|
||||||
F.prototype = obj;
|
F.prototype = obj;
|
||||||
|
|
||||||
return new F();
|
return new F();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the property `obj` to the $_ object, calling it `name`
|
* Adds the property `obj` to the $_ object, calling it `name`
|
||||||
*
|
*
|
||||||
* @param string name
|
* @param string name
|
||||||
* @param object obj
|
* @param object obj
|
||||||
*/
|
*/
|
||||||
@ -152,7 +152,7 @@
|
|||||||
obj.el = sel;
|
obj.el = sel;
|
||||||
$_[name] = obj;
|
$_[name] = obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over a $_ object, applying a callback to each item
|
* Iterates over a $_ object, applying a callback to each item
|
||||||
*
|
*
|
||||||
@ -183,7 +183,7 @@
|
|||||||
callback.call(sel, sel);
|
callback.call(sel, sel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the type of the passed variable
|
* Retrieves the type of the passed variable
|
||||||
*
|
*
|
||||||
@ -191,22 +191,22 @@
|
|||||||
* @return string
|
* @return string
|
||||||
* @type string
|
* @type string
|
||||||
*/
|
*/
|
||||||
$_.type = function(obj)
|
$_.type = function(obj)
|
||||||
{
|
{
|
||||||
if((function() {return obj && (obj !== this)}).call(obj))
|
if((function() {return obj && (obj !== this)}).call(obj))
|
||||||
{
|
{
|
||||||
//fallback on 'typeof' for truthy primitive values
|
//fallback on 'typeof' for truthy primitive values
|
||||||
return (typeof obj).toLowerCase();
|
return (typeof obj).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Strip x from [object x] and return
|
//Strip x from [object x] and return
|
||||||
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
|
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
//Set global variables
|
//Set global variables
|
||||||
$_ = window.$_ = window.$_ || $_;
|
$_ = window.$_ = window.$_ || $_;
|
||||||
$_.$ = $;
|
$_.$ = $;
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -214,11 +214,12 @@
|
|||||||
/**
|
/**
|
||||||
* A module of various browser polyfills
|
* A module of various browser polyfills
|
||||||
* @file polyfill.js
|
* @file polyfill.js
|
||||||
|
* @todo create ES5 Foreach polyfill
|
||||||
*/
|
*/
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Console.log polyfill for IE 8 stupidity
|
// Console.log polyfill for IE 8 stupidity
|
||||||
if(typeof window.console === "undefined")
|
if(typeof window.console === "undefined")
|
||||||
{
|
{
|
||||||
@ -226,9 +227,9 @@
|
|||||||
log:function(){}
|
log:function(){}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String trim function polyfill
|
* String trim function polyfill
|
||||||
*/
|
*/
|
||||||
@ -244,23 +245,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event.preventDefault/e.stopPropagation polyfill
|
* event.preventDefault/e.stopPropagation polyfill
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
|
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
|
||||||
{
|
{
|
||||||
Event.prototype.preventDefault = function()
|
Event.prototype.preventDefault = function()
|
||||||
{
|
{
|
||||||
window.event.returnValue = false;
|
window.event.returnValue = false;
|
||||||
},
|
},
|
||||||
Event.prototype.stopPropagation = function()
|
Event.prototype.stopPropagation = function()
|
||||||
{
|
{
|
||||||
window.event.cancelBubble = true;
|
window.event.cancelBubble = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -273,7 +274,7 @@
|
|||||||
(function (){
|
(function (){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Don't bother even defining the object if the XMLHttpRequest isn't available
|
// Don't bother even defining the object if the XMLHttpRequest isn't available
|
||||||
if(typeof window.XMLHttpRequest === "undefined")
|
if(typeof window.XMLHttpRequest === "undefined")
|
||||||
{
|
{
|
||||||
@ -283,9 +284,9 @@
|
|||||||
var ajax = {
|
var ajax = {
|
||||||
_do: function (url, data, callback, isPost)
|
_do: function (url, data, callback, isPost)
|
||||||
{
|
{
|
||||||
var type,
|
var type,
|
||||||
request = new XMLHttpRequest();
|
request = new XMLHttpRequest();
|
||||||
|
|
||||||
if (typeof callback === "undefined")
|
if (typeof callback === "undefined")
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -297,7 +298,7 @@
|
|||||||
type = (isPost) ? "POST" : "GET";
|
type = (isPost) ? "POST" : "GET";
|
||||||
|
|
||||||
url += (type === "GET") ? "?"+this._serialize(data) : '';
|
url += (type === "GET") ? "?"+this._serialize(data) : '';
|
||||||
|
|
||||||
request.open(type, url);
|
request.open(type, url);
|
||||||
|
|
||||||
request.onreadystatechange = function ()
|
request.onreadystatechange = function ()
|
||||||
@ -349,7 +350,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a GET type ajax request
|
* Sends a GET type ajax request
|
||||||
*
|
*
|
||||||
* @name get
|
* @name get
|
||||||
* @function
|
* @function
|
||||||
* @memberOf $_
|
* @memberOf $_
|
||||||
@ -360,10 +361,10 @@
|
|||||||
$_.ext('get', function (url, data, callback){
|
$_.ext('get', function (url, data, callback){
|
||||||
ajax._do(url, data, callback, false);
|
ajax._do(url, data, callback, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a POST type ajax request
|
* Sends a POST type ajax request
|
||||||
*
|
*
|
||||||
* @name post
|
* @name post
|
||||||
* @function
|
* @function
|
||||||
* @memberOf $_
|
* @memberOf $_
|
||||||
@ -374,6 +375,7 @@
|
|||||||
$_.ext('post', function (url, data, callback){
|
$_.ext('post', function (url, data, callback){
|
||||||
ajax._do(url, data, callback, true);
|
ajax._do(url, data, callback, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -382,13 +384,14 @@
|
|||||||
* Event
|
* Event
|
||||||
*
|
*
|
||||||
* Event api wrapper
|
* Event api wrapper
|
||||||
|
* @todo Add method for triggering events
|
||||||
*/
|
*/
|
||||||
(function (){
|
(function (){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Property name for expandos on DOM objects
|
// Property name for expandos on DOM objects
|
||||||
var kis_expando = "KIS_0_5_0";
|
var kis_expando = "KIS_0_6_0";
|
||||||
|
|
||||||
var _attach, _remove, _add_remove, e, _attach_delegate;
|
var _attach, _remove, _add_remove, e, _attach_delegate;
|
||||||
|
|
||||||
@ -419,7 +422,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
// typeof function doesn't work in IE where attachEvent is available: brute force it
|
// typeof function doesn't work in IE where attachEvent is available: brute force it
|
||||||
else if(typeof document.attachEvent !== "undefined")
|
else if(typeof document.attachEvent !== "undefined")
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@ -431,11 +434,11 @@
|
|||||||
// for event listeners, so we need to set it ourselves.
|
// for event listeners, so we need to set it ourselves.
|
||||||
callback.apply(arguments[0]);
|
callback.apply(arguments[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof sel.attachEvent !== "undefined")
|
if (typeof sel.attachEvent !== "undefined")
|
||||||
{
|
{
|
||||||
_remove(event, callback); // Make sure we don't have duplicate listeners
|
_remove(event, callback); // Make sure we don't have duplicate listeners
|
||||||
|
|
||||||
sel.attachEvent("on" + event, _listener);
|
sel.attachEvent("on" + event, _listener);
|
||||||
// Store our listener so we can remove it later
|
// Store our listener so we can remove it later
|
||||||
var expando = sel[kis_expando] = sel[kis_expando] || {};
|
var expando = sel[kis_expando] = sel[kis_expando] || {};
|
||||||
@ -481,11 +484,11 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_add_remove = function (sel, event, callback, add)
|
_add_remove = function (sel, event, callback, add)
|
||||||
{
|
{
|
||||||
var i, len;
|
var i, len;
|
||||||
|
|
||||||
if(typeof sel === "undefined")
|
if(typeof sel === "undefined")
|
||||||
{
|
{
|
||||||
console.log(arguments);
|
console.log(arguments);
|
||||||
@ -497,7 +500,7 @@
|
|||||||
if ( ! event.match(/^([\w\-]+)$/))
|
if ( ! event.match(/^([\w\-]+)$/))
|
||||||
{
|
{
|
||||||
event = event.split(" ");
|
event = event.split(" ");
|
||||||
|
|
||||||
len = event.length;
|
len = event.length;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
@ -508,7 +511,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(add === true)
|
if(add === true)
|
||||||
{
|
{
|
||||||
_attach(sel, event, callback);
|
_attach(sel, event, callback);
|
||||||
@ -523,37 +526,35 @@
|
|||||||
{
|
{
|
||||||
// attach the listener to the parent object
|
// attach the listener to the parent object
|
||||||
_add_remove(sel, event, function(e){
|
_add_remove(sel, event, function(e){
|
||||||
|
|
||||||
var elem, t, tar;
|
var elem, t, tar;
|
||||||
|
|
||||||
// IE 8 doesn't have event bound to element
|
// IE 8 doesn't have event bound to element
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
|
|
||||||
// Get the live version of the target selector
|
// Get the live version of the target selector
|
||||||
t = $_.$(target, sel);
|
t = $_.$(target, sel);
|
||||||
|
|
||||||
// Check each element to see if it matches the target
|
// Check each element to see if it matches the target
|
||||||
for(elem in t)
|
for(elem in t)
|
||||||
{
|
{
|
||||||
// IE 8 doesn't have target in the event object
|
// IE 8 doesn't have target in the event object
|
||||||
tar = e.target || e.srcElement;
|
tar = e.target || e.srcElement;
|
||||||
|
|
||||||
// Fire target callback when event bubbles from target
|
// Fire target callback when event bubbles from target
|
||||||
if(tar == t[elem])
|
if(tar == t[elem])
|
||||||
{
|
{
|
||||||
// Trigger the event callback
|
// Trigger the event callback
|
||||||
callback.call(t[elem], e);
|
callback.call(t[elem], e);
|
||||||
|
|
||||||
// Stop event propegation
|
// Stop event propegation
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, true);
|
}, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -567,7 +568,7 @@
|
|||||||
/**
|
/**
|
||||||
* Adds an event that returns a callback when triggered on the selected
|
* Adds an event that returns a callback when triggered on the selected
|
||||||
* event and selector
|
* event and selector
|
||||||
*
|
*
|
||||||
* @memberOf $_.event
|
* @memberOf $_.event
|
||||||
* @name add
|
* @name add
|
||||||
* @function
|
* @function
|
||||||
@ -597,7 +598,7 @@
|
|||||||
_add_remove(e, event, callback, false);
|
_add_remove(e, event, callback, false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Binds a persistent event to the document
|
* Binds a persistent event to the document
|
||||||
*
|
*
|
||||||
* @memberOf $_.event
|
* @memberOf $_.event
|
||||||
@ -612,7 +613,7 @@
|
|||||||
{
|
{
|
||||||
_attach_delegate(document.documentElement, target, event, callback);
|
_attach_delegate(document.documentElement, target, event, callback);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Binds an event to a parent object
|
* Binds an event to a parent object
|
||||||
*
|
*
|
||||||
* @memberOf $_.event
|
* @memberOf $_.event
|
||||||
@ -650,7 +651,7 @@
|
|||||||
if (typeof document !== "undefined" && !("classList" in document.createElement("a")))
|
if (typeof document !== "undefined" && !("classList" in document.createElement("a")))
|
||||||
{
|
{
|
||||||
(function (view){
|
(function (view){
|
||||||
|
|
||||||
var classListProp = "classList",
|
var classListProp = "classList",
|
||||||
protoProp = "prototype",
|
protoProp = "prototype",
|
||||||
elemCtrProto = (view.HTMLElement || view.Element)[protoProp],
|
elemCtrProto = (view.HTMLElement || view.Element)[protoProp],
|
||||||
@ -806,7 +807,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* DOM
|
* DOM
|
||||||
*
|
*
|
||||||
* Dom manipulation module
|
* Dom manipulation module
|
||||||
*/
|
*/
|
||||||
(function (){
|
(function (){
|
||||||
@ -814,7 +815,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var d;
|
var d;
|
||||||
|
|
||||||
//Private function for getting/setting attributes/properties
|
//Private function for getting/setting attributes/properties
|
||||||
function _attr(sel, name, value)
|
function _attr(sel, name, value)
|
||||||
{
|
{
|
||||||
@ -848,7 +849,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
console.log(value);
|
console.log(value);
|
||||||
console.log(sel);
|
console.log(sel);
|
||||||
console.log("Element does not have the selected attribute");
|
console.log("Element does not have the selected attribute");
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//No value to set? Return the current value
|
//No value to set? Return the current value
|
||||||
@ -867,7 +868,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sel[name] = value;
|
sel[name] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (value === null)
|
else if (value === null)
|
||||||
{
|
{
|
||||||
@ -878,12 +879,12 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete sel[name];
|
delete sel[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (typeof value !== "undefined") ? value : oldVal;
|
return (typeof value !== "undefined") ? value : oldVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change css property name to it's
|
* Change css property name to it's
|
||||||
* javascript camel case equivalent
|
* javascript camel case equivalent
|
||||||
@ -898,7 +899,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
function _css(sel, prop, val)
|
function _css(sel, prop, val)
|
||||||
{
|
{
|
||||||
var equi;
|
var equi;
|
||||||
|
|
||||||
//Camel-case
|
//Camel-case
|
||||||
prop = _toCamel(prop);
|
prop = _toCamel(prop);
|
||||||
|
|
||||||
@ -908,8 +909,8 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
outerWidth: "offsetWidth",
|
outerWidth: "offsetWidth",
|
||||||
top: "posTop"
|
top: "posTop"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//If you don't define a value, try returning the existing value
|
//If you don't define a value, try returning the existing value
|
||||||
if(typeof val === "undefined" && sel.style[prop] !== "undefined")
|
if(typeof val === "undefined" && sel.style[prop] !== "undefined")
|
||||||
{
|
{
|
||||||
@ -926,23 +927,23 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
sel.style[prop] = val;
|
sel.style[prop] = val;
|
||||||
|
|
||||||
//Short circuit
|
//Short circuit
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
else if(sel.style[equi[prop]])
|
else if(sel.style[equi[prop]])
|
||||||
{
|
{
|
||||||
sel.style[equi[prop]] = val;
|
sel.style[equi[prop]] = val;
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//No matches? Well, lets log it for now
|
//No matches? Well, lets log it for now
|
||||||
console.log("Property " + prop + " nor an equivalent seems to exist");
|
console.log("Property " + prop + " nor an equivalent seems to exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOM
|
* DOM
|
||||||
*
|
*
|
||||||
* Dom manipulation module
|
* Dom manipulation module
|
||||||
* @namespace
|
* @namespace
|
||||||
* @memberOf $_
|
* @memberOf $_
|
||||||
@ -952,7 +953,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
/**
|
/**
|
||||||
* Adds a class to the element(s) specified by the current
|
* Adds a class to the element(s) specified by the current
|
||||||
* selector
|
* selector
|
||||||
*
|
*
|
||||||
* @name addClass
|
* @name addClass
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -967,7 +968,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
/**
|
/**
|
||||||
* Removes a class from the element(s) specified by the current
|
* Removes a class from the element(s) specified by the current
|
||||||
* selector
|
* selector
|
||||||
*
|
*
|
||||||
* @name removeClass
|
* @name removeClass
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -981,7 +982,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Hides the element(s) specified by the current selector
|
* Hides the element(s) specified by the current selector
|
||||||
*
|
*
|
||||||
* @name hide
|
* @name hide
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -991,11 +992,11 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
this.css('display', 'none');
|
this.css('display', 'none');
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Shows the element(s) specified by the current selector.
|
* Shows the element(s) specified by the current selector.
|
||||||
* if type is specified, the element will have it's style
|
* if type is specified, the element will have it's style
|
||||||
* property set to "display:[your type]". If type is not
|
* property set to "display:[your type]". If type is not
|
||||||
* specified, the element is set to "display:block".
|
* specified, the element is set to "display:block".
|
||||||
*
|
*
|
||||||
* @name show
|
* @name show
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -1011,8 +1012,8 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
this.css("display", type);
|
this.css("display", type);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Sets attributes on element(s) specified by the current
|
* Sets attributes on element(s) specified by the current
|
||||||
* selector, or, if name is not specified, returns the
|
* selector, or, if name is not specified, returns the
|
||||||
* value of the attribute of the element specified by the
|
* value of the attribute of the element specified by the
|
||||||
* current selector.
|
* current selector.
|
||||||
*
|
*
|
||||||
@ -1048,7 +1049,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Sets or retrieves the text content of the element
|
* Sets or retrieves the text content of the element
|
||||||
* specified by the current selector. If a value is
|
* specified by the current selector. If a value is
|
||||||
* passed, it will set that value on the current element,
|
* passed, it will set that value on the current element,
|
||||||
* otherwise it will return the value of the current element
|
* otherwise it will return the value of the current element
|
||||||
*
|
*
|
||||||
@ -1062,11 +1063,11 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
text: function (value)
|
text: function (value)
|
||||||
{
|
{
|
||||||
var oldValue, set, type, sel;
|
var oldValue, set, type, sel;
|
||||||
|
|
||||||
sel = this.el;
|
sel = this.el;
|
||||||
|
|
||||||
set = (typeof value !== "undefined") ? true : false;
|
set = (typeof value !== "undefined") ? true : false;
|
||||||
|
|
||||||
type = (typeof sel.textContent !== "undefined")
|
type = (typeof sel.textContent !== "undefined")
|
||||||
? "textContent"
|
? "textContent"
|
||||||
: (typeof sel.innerText !== "undefined")
|
: (typeof sel.innerText !== "undefined")
|
||||||
@ -1074,7 +1075,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
: "innerHTML";
|
: "innerHTML";
|
||||||
|
|
||||||
oldValue = sel[type];
|
oldValue = sel[type];
|
||||||
|
|
||||||
if(set)
|
if(set)
|
||||||
{
|
{
|
||||||
sel[type] = value;
|
sel[type] = value;
|
||||||
@ -1087,7 +1088,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Sets or retrieves a css property of the element
|
* Sets or retrieves a css property of the element
|
||||||
* specified by the current selector. If a value is
|
* specified by the current selector. If a value is
|
||||||
* passed, it will set that value on the current element,
|
* passed, it will set that value on the current element,
|
||||||
* otherwise it will return the value of the css property
|
* otherwise it will return the value of the css property
|
||||||
* on the current element
|
* on the current element
|
||||||
@ -1107,14 +1108,14 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
{
|
{
|
||||||
return _css(this.el, prop);
|
return _css(this.el, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_.each(function (e){
|
$_.each(function (e){
|
||||||
_css(e, prop, val);
|
_css(e, prop, val);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Adds to the innerHTML of the current element, after the last child.
|
* Adds to the innerHTML of the current element, after the last child.
|
||||||
*
|
*
|
||||||
* @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
|
* @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
|
||||||
* @name append
|
* @name append
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
@ -1134,7 +1135,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Adds to the innerHTML of the selected element, before the current children
|
* Adds to the innerHTML of the selected element, before the current children
|
||||||
*
|
*
|
||||||
* @name prepend
|
* @name prepend
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -1163,18 +1164,17 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
*/
|
*/
|
||||||
html: function(htm)
|
html: function(htm)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(typeof htm !== "undefined")
|
if(typeof htm !== "undefined")
|
||||||
{
|
{
|
||||||
this.el.innerHTML = htm;
|
this.el.innerHTML = htm;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If the parameter is undefined, just return the current value
|
//If the parameter is undefined, just return the current value
|
||||||
return this.el.innerHTML;
|
return this.el.innerHTML;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$_.ext('dom', d);
|
$_.ext('dom', d);
|
||||||
|
|
||||||
}());
|
|
||||||
|
|
||||||
|
}());
|
||||||
|
204
kis-lite-dom.js
204
kis-lite-dom.js
@ -2,7 +2,7 @@
|
|||||||
Kis JS Keep It Simple JS Library
|
Kis JS Keep It Simple JS Library
|
||||||
Copyright Timothy J. Warren
|
Copyright Timothy J. Warren
|
||||||
License Public Domain
|
License Public Domain
|
||||||
Version 0.5.0
|
Version 0.6.0
|
||||||
*/
|
*/
|
||||||
(function (){
|
(function (){
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var $_, $, dcopy, sel;
|
var $_, $, dcopy, sel;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $_
|
* $_
|
||||||
@ -38,7 +38,7 @@
|
|||||||
if(typeof s === "undefined")
|
if(typeof s === "undefined")
|
||||||
{
|
{
|
||||||
//Defines a "global" selector for that instance
|
//Defines a "global" selector for that instance
|
||||||
sel = (typeof $_.el !== "undefined")
|
sel = (typeof $_.el !== "undefined")
|
||||||
? $_.el
|
? $_.el
|
||||||
: document.documentElement;
|
: document.documentElement;
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@
|
|||||||
{
|
{
|
||||||
sel = (typeof s !== "object") ? $(s) : s;
|
sel = (typeof s !== "object") ? $(s) : s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the selector to the prototype
|
// Add the selector to the prototype
|
||||||
$_.prototype.el = sel;
|
$_.prototype.el = sel;
|
||||||
|
|
||||||
@ -54,19 +54,19 @@
|
|||||||
var self = dcopy($_);
|
var self = dcopy($_);
|
||||||
|
|
||||||
// Give sel to each extension.
|
// Give sel to each extension.
|
||||||
for(var i in self)
|
for(var i in self)
|
||||||
{
|
{
|
||||||
if(typeof self[i] === "object")
|
if(typeof self[i] === "object")
|
||||||
{
|
{
|
||||||
self[i].el = sel;
|
self[i].el = sel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.el = sel;
|
self.el = sel;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple DOM selector function
|
* Simple DOM selector function
|
||||||
*
|
*
|
||||||
@ -79,14 +79,14 @@
|
|||||||
$ = function (a, context)
|
$ = function (a, context)
|
||||||
{
|
{
|
||||||
var x, c;
|
var x, c;
|
||||||
|
|
||||||
if (typeof a != "string" || typeof a === "undefined"){ return a;}
|
if (typeof a != "string" || typeof a === "undefined"){ return a;}
|
||||||
|
|
||||||
//Check for a context of a specific element, otherwise, just run on the document
|
//Check for a context of a specific element, otherwise, just run on the document
|
||||||
c = (context != null && context.nodeType === 1)
|
c = (context != null && context.nodeType === 1)
|
||||||
? context
|
? context
|
||||||
: document;
|
: document;
|
||||||
|
|
||||||
//Pick the quickest method for each kind of selector
|
//Pick the quickest method for each kind of selector
|
||||||
if (a.match(/^#([\w\-]+$)/))
|
if (a.match(/^#([\w\-]+$)/))
|
||||||
{
|
{
|
||||||
@ -96,11 +96,11 @@
|
|||||||
{
|
{
|
||||||
x = c.querySelectorAll(a);
|
x = c.querySelectorAll(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return the single object if applicable
|
//Return the single object if applicable
|
||||||
return (x.length === 1) ? x[0] : x;
|
return (x.length === 1) ? x[0] : x;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deep copy/prototypical constructor function
|
* Deep copy/prototypical constructor function
|
||||||
*
|
*
|
||||||
@ -112,38 +112,38 @@
|
|||||||
dcopy = function(obj)
|
dcopy = function(obj)
|
||||||
{
|
{
|
||||||
var type, F;
|
var type, F;
|
||||||
|
|
||||||
if(typeof obj === "undefined")
|
if(typeof obj === "undefined")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof Object.create !== "undefined")
|
if(typeof Object.create !== "undefined")
|
||||||
{
|
{
|
||||||
return Object.create(obj);
|
return Object.create(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
type = typeof obj;
|
type = typeof obj;
|
||||||
|
|
||||||
if(type !== "object" && type !== "function")
|
if(type !== "object" && type !== "function")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
F = function(){};
|
F = function(){};
|
||||||
|
|
||||||
F.prototype = obj;
|
F.prototype = obj;
|
||||||
|
|
||||||
return new F();
|
return new F();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the property `obj` to the $_ object, calling it `name`
|
* Adds the property `obj` to the $_ object, calling it `name`
|
||||||
*
|
*
|
||||||
* @param string name
|
* @param string name
|
||||||
* @param object obj
|
* @param object obj
|
||||||
*/
|
*/
|
||||||
@ -152,7 +152,7 @@
|
|||||||
obj.el = sel;
|
obj.el = sel;
|
||||||
$_[name] = obj;
|
$_[name] = obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over a $_ object, applying a callback to each item
|
* Iterates over a $_ object, applying a callback to each item
|
||||||
*
|
*
|
||||||
@ -183,7 +183,7 @@
|
|||||||
callback.call(sel, sel);
|
callback.call(sel, sel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the type of the passed variable
|
* Retrieves the type of the passed variable
|
||||||
*
|
*
|
||||||
@ -191,22 +191,22 @@
|
|||||||
* @return string
|
* @return string
|
||||||
* @type string
|
* @type string
|
||||||
*/
|
*/
|
||||||
$_.type = function(obj)
|
$_.type = function(obj)
|
||||||
{
|
{
|
||||||
if((function() {return obj && (obj !== this)}).call(obj))
|
if((function() {return obj && (obj !== this)}).call(obj))
|
||||||
{
|
{
|
||||||
//fallback on 'typeof' for truthy primitive values
|
//fallback on 'typeof' for truthy primitive values
|
||||||
return (typeof obj).toLowerCase();
|
return (typeof obj).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Strip x from [object x] and return
|
//Strip x from [object x] and return
|
||||||
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
|
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
//Set global variables
|
//Set global variables
|
||||||
$_ = window.$_ = window.$_ || $_;
|
$_ = window.$_ = window.$_ || $_;
|
||||||
$_.$ = $;
|
$_.$ = $;
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -214,11 +214,12 @@
|
|||||||
/**
|
/**
|
||||||
* A module of various browser polyfills
|
* A module of various browser polyfills
|
||||||
* @file polyfill.js
|
* @file polyfill.js
|
||||||
|
* @todo create ES5 Foreach polyfill
|
||||||
*/
|
*/
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Console.log polyfill for IE 8 stupidity
|
// Console.log polyfill for IE 8 stupidity
|
||||||
if(typeof window.console === "undefined")
|
if(typeof window.console === "undefined")
|
||||||
{
|
{
|
||||||
@ -226,9 +227,9 @@
|
|||||||
log:function(){}
|
log:function(){}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String trim function polyfill
|
* String trim function polyfill
|
||||||
*/
|
*/
|
||||||
@ -244,23 +245,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event.preventDefault/e.stopPropagation polyfill
|
* event.preventDefault/e.stopPropagation polyfill
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
|
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
|
||||||
{
|
{
|
||||||
Event.prototype.preventDefault = function()
|
Event.prototype.preventDefault = function()
|
||||||
{
|
{
|
||||||
window.event.returnValue = false;
|
window.event.returnValue = false;
|
||||||
},
|
},
|
||||||
Event.prototype.stopPropagation = function()
|
Event.prototype.stopPropagation = function()
|
||||||
{
|
{
|
||||||
window.event.cancelBubble = true;
|
window.event.cancelBubble = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -273,7 +274,7 @@
|
|||||||
(function (){
|
(function (){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Don't bother even defining the object if the XMLHttpRequest isn't available
|
// Don't bother even defining the object if the XMLHttpRequest isn't available
|
||||||
if(typeof window.XMLHttpRequest === "undefined")
|
if(typeof window.XMLHttpRequest === "undefined")
|
||||||
{
|
{
|
||||||
@ -283,9 +284,9 @@
|
|||||||
var ajax = {
|
var ajax = {
|
||||||
_do: function (url, data, callback, isPost)
|
_do: function (url, data, callback, isPost)
|
||||||
{
|
{
|
||||||
var type,
|
var type,
|
||||||
request = new XMLHttpRequest();
|
request = new XMLHttpRequest();
|
||||||
|
|
||||||
if (typeof callback === "undefined")
|
if (typeof callback === "undefined")
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -297,7 +298,7 @@
|
|||||||
type = (isPost) ? "POST" : "GET";
|
type = (isPost) ? "POST" : "GET";
|
||||||
|
|
||||||
url += (type === "GET") ? "?"+this._serialize(data) : '';
|
url += (type === "GET") ? "?"+this._serialize(data) : '';
|
||||||
|
|
||||||
request.open(type, url);
|
request.open(type, url);
|
||||||
|
|
||||||
request.onreadystatechange = function ()
|
request.onreadystatechange = function ()
|
||||||
@ -349,7 +350,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a GET type ajax request
|
* Sends a GET type ajax request
|
||||||
*
|
*
|
||||||
* @name get
|
* @name get
|
||||||
* @function
|
* @function
|
||||||
* @memberOf $_
|
* @memberOf $_
|
||||||
@ -360,10 +361,10 @@
|
|||||||
$_.ext('get', function (url, data, callback){
|
$_.ext('get', function (url, data, callback){
|
||||||
ajax._do(url, data, callback, false);
|
ajax._do(url, data, callback, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a POST type ajax request
|
* Sends a POST type ajax request
|
||||||
*
|
*
|
||||||
* @name post
|
* @name post
|
||||||
* @function
|
* @function
|
||||||
* @memberOf $_
|
* @memberOf $_
|
||||||
@ -374,6 +375,7 @@
|
|||||||
$_.ext('post', function (url, data, callback){
|
$_.ext('post', function (url, data, callback){
|
||||||
ajax._do(url, data, callback, true);
|
ajax._do(url, data, callback, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -382,13 +384,14 @@
|
|||||||
* Event
|
* Event
|
||||||
*
|
*
|
||||||
* Event api wrapper
|
* Event api wrapper
|
||||||
|
* @todo Add method for triggering events
|
||||||
*/
|
*/
|
||||||
(function (){
|
(function (){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Property name for expandos on DOM objects
|
// Property name for expandos on DOM objects
|
||||||
var kis_expando = "KIS_0_5_0";
|
var kis_expando = "KIS_0_6_0";
|
||||||
|
|
||||||
var _attach, _remove, _add_remove, e, _attach_delegate;
|
var _attach, _remove, _add_remove, e, _attach_delegate;
|
||||||
|
|
||||||
@ -419,7 +422,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
// typeof function doesn't work in IE where attachEvent is available: brute force it
|
// typeof function doesn't work in IE where attachEvent is available: brute force it
|
||||||
else if(typeof document.attachEvent !== "undefined")
|
else if(typeof document.attachEvent !== "undefined")
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@ -431,11 +434,11 @@
|
|||||||
// for event listeners, so we need to set it ourselves.
|
// for event listeners, so we need to set it ourselves.
|
||||||
callback.apply(arguments[0]);
|
callback.apply(arguments[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof sel.attachEvent !== "undefined")
|
if (typeof sel.attachEvent !== "undefined")
|
||||||
{
|
{
|
||||||
_remove(event, callback); // Make sure we don't have duplicate listeners
|
_remove(event, callback); // Make sure we don't have duplicate listeners
|
||||||
|
|
||||||
sel.attachEvent("on" + event, _listener);
|
sel.attachEvent("on" + event, _listener);
|
||||||
// Store our listener so we can remove it later
|
// Store our listener so we can remove it later
|
||||||
var expando = sel[kis_expando] = sel[kis_expando] || {};
|
var expando = sel[kis_expando] = sel[kis_expando] || {};
|
||||||
@ -481,11 +484,11 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_add_remove = function (sel, event, callback, add)
|
_add_remove = function (sel, event, callback, add)
|
||||||
{
|
{
|
||||||
var i, len;
|
var i, len;
|
||||||
|
|
||||||
if(typeof sel === "undefined")
|
if(typeof sel === "undefined")
|
||||||
{
|
{
|
||||||
console.log(arguments);
|
console.log(arguments);
|
||||||
@ -497,7 +500,7 @@
|
|||||||
if ( ! event.match(/^([\w\-]+)$/))
|
if ( ! event.match(/^([\w\-]+)$/))
|
||||||
{
|
{
|
||||||
event = event.split(" ");
|
event = event.split(" ");
|
||||||
|
|
||||||
len = event.length;
|
len = event.length;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
@ -508,7 +511,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(add === true)
|
if(add === true)
|
||||||
{
|
{
|
||||||
_attach(sel, event, callback);
|
_attach(sel, event, callback);
|
||||||
@ -523,37 +526,35 @@
|
|||||||
{
|
{
|
||||||
// attach the listener to the parent object
|
// attach the listener to the parent object
|
||||||
_add_remove(sel, event, function(e){
|
_add_remove(sel, event, function(e){
|
||||||
|
|
||||||
var elem, t, tar;
|
var elem, t, tar;
|
||||||
|
|
||||||
// IE 8 doesn't have event bound to element
|
// IE 8 doesn't have event bound to element
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
|
|
||||||
// Get the live version of the target selector
|
// Get the live version of the target selector
|
||||||
t = $_.$(target, sel);
|
t = $_.$(target, sel);
|
||||||
|
|
||||||
// Check each element to see if it matches the target
|
// Check each element to see if it matches the target
|
||||||
for(elem in t)
|
for(elem in t)
|
||||||
{
|
{
|
||||||
// IE 8 doesn't have target in the event object
|
// IE 8 doesn't have target in the event object
|
||||||
tar = e.target || e.srcElement;
|
tar = e.target || e.srcElement;
|
||||||
|
|
||||||
// Fire target callback when event bubbles from target
|
// Fire target callback when event bubbles from target
|
||||||
if(tar == t[elem])
|
if(tar == t[elem])
|
||||||
{
|
{
|
||||||
// Trigger the event callback
|
// Trigger the event callback
|
||||||
callback.call(t[elem], e);
|
callback.call(t[elem], e);
|
||||||
|
|
||||||
// Stop event propegation
|
// Stop event propegation
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, true);
|
}, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -567,7 +568,7 @@
|
|||||||
/**
|
/**
|
||||||
* Adds an event that returns a callback when triggered on the selected
|
* Adds an event that returns a callback when triggered on the selected
|
||||||
* event and selector
|
* event and selector
|
||||||
*
|
*
|
||||||
* @memberOf $_.event
|
* @memberOf $_.event
|
||||||
* @name add
|
* @name add
|
||||||
* @function
|
* @function
|
||||||
@ -597,7 +598,7 @@
|
|||||||
_add_remove(e, event, callback, false);
|
_add_remove(e, event, callback, false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Binds a persistent event to the document
|
* Binds a persistent event to the document
|
||||||
*
|
*
|
||||||
* @memberOf $_.event
|
* @memberOf $_.event
|
||||||
@ -612,7 +613,7 @@
|
|||||||
{
|
{
|
||||||
_attach_delegate(document.documentElement, target, event, callback);
|
_attach_delegate(document.documentElement, target, event, callback);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Binds an event to a parent object
|
* Binds an event to a parent object
|
||||||
*
|
*
|
||||||
* @memberOf $_.event
|
* @memberOf $_.event
|
||||||
@ -650,7 +651,7 @@
|
|||||||
if (typeof document !== "undefined" && !("classList" in document.createElement("a")))
|
if (typeof document !== "undefined" && !("classList" in document.createElement("a")))
|
||||||
{
|
{
|
||||||
(function (view){
|
(function (view){
|
||||||
|
|
||||||
var classListProp = "classList",
|
var classListProp = "classList",
|
||||||
protoProp = "prototype",
|
protoProp = "prototype",
|
||||||
elemCtrProto = (view.HTMLElement || view.Element)[protoProp],
|
elemCtrProto = (view.HTMLElement || view.Element)[protoProp],
|
||||||
@ -806,7 +807,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* DOM
|
* DOM
|
||||||
*
|
*
|
||||||
* Dom manipulation module
|
* Dom manipulation module
|
||||||
*/
|
*/
|
||||||
(function (){
|
(function (){
|
||||||
@ -814,7 +815,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var d;
|
var d;
|
||||||
|
|
||||||
//Private function for getting/setting attributes/properties
|
//Private function for getting/setting attributes/properties
|
||||||
function _attr(sel, name, value)
|
function _attr(sel, name, value)
|
||||||
{
|
{
|
||||||
@ -848,7 +849,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
console.log(value);
|
console.log(value);
|
||||||
console.log(sel);
|
console.log(sel);
|
||||||
console.log("Element does not have the selected attribute");
|
console.log("Element does not have the selected attribute");
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//No value to set? Return the current value
|
//No value to set? Return the current value
|
||||||
@ -867,7 +868,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sel[name] = value;
|
sel[name] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (value === null)
|
else if (value === null)
|
||||||
{
|
{
|
||||||
@ -878,12 +879,12 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete sel[name];
|
delete sel[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (typeof value !== "undefined") ? value : oldVal;
|
return (typeof value !== "undefined") ? value : oldVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change css property name to it's
|
* Change css property name to it's
|
||||||
* javascript camel case equivalent
|
* javascript camel case equivalent
|
||||||
@ -898,7 +899,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
function _css(sel, prop, val)
|
function _css(sel, prop, val)
|
||||||
{
|
{
|
||||||
var equi;
|
var equi;
|
||||||
|
|
||||||
//Camel-case
|
//Camel-case
|
||||||
prop = _toCamel(prop);
|
prop = _toCamel(prop);
|
||||||
|
|
||||||
@ -908,8 +909,8 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
outerWidth: "offsetWidth",
|
outerWidth: "offsetWidth",
|
||||||
top: "posTop"
|
top: "posTop"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//If you don't define a value, try returning the existing value
|
//If you don't define a value, try returning the existing value
|
||||||
if(typeof val === "undefined" && sel.style[prop] !== "undefined")
|
if(typeof val === "undefined" && sel.style[prop] !== "undefined")
|
||||||
{
|
{
|
||||||
@ -926,23 +927,23 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
sel.style[prop] = val;
|
sel.style[prop] = val;
|
||||||
|
|
||||||
//Short circuit
|
//Short circuit
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
else if(sel.style[equi[prop]])
|
else if(sel.style[equi[prop]])
|
||||||
{
|
{
|
||||||
sel.style[equi[prop]] = val;
|
sel.style[equi[prop]] = val;
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//No matches? Well, lets log it for now
|
//No matches? Well, lets log it for now
|
||||||
console.log("Property " + prop + " nor an equivalent seems to exist");
|
console.log("Property " + prop + " nor an equivalent seems to exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOM
|
* DOM
|
||||||
*
|
*
|
||||||
* Dom manipulation module
|
* Dom manipulation module
|
||||||
* @namespace
|
* @namespace
|
||||||
* @memberOf $_
|
* @memberOf $_
|
||||||
@ -952,7 +953,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
/**
|
/**
|
||||||
* Adds a class to the element(s) specified by the current
|
* Adds a class to the element(s) specified by the current
|
||||||
* selector
|
* selector
|
||||||
*
|
*
|
||||||
* @name addClass
|
* @name addClass
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -967,7 +968,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
/**
|
/**
|
||||||
* Removes a class from the element(s) specified by the current
|
* Removes a class from the element(s) specified by the current
|
||||||
* selector
|
* selector
|
||||||
*
|
*
|
||||||
* @name removeClass
|
* @name removeClass
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -981,7 +982,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Hides the element(s) specified by the current selector
|
* Hides the element(s) specified by the current selector
|
||||||
*
|
*
|
||||||
* @name hide
|
* @name hide
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -991,11 +992,11 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
this.css('display', 'none');
|
this.css('display', 'none');
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Shows the element(s) specified by the current selector.
|
* Shows the element(s) specified by the current selector.
|
||||||
* if type is specified, the element will have it's style
|
* if type is specified, the element will have it's style
|
||||||
* property set to "display:[your type]". If type is not
|
* property set to "display:[your type]". If type is not
|
||||||
* specified, the element is set to "display:block".
|
* specified, the element is set to "display:block".
|
||||||
*
|
*
|
||||||
* @name show
|
* @name show
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -1011,8 +1012,8 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
this.css("display", type);
|
this.css("display", type);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Sets attributes on element(s) specified by the current
|
* Sets attributes on element(s) specified by the current
|
||||||
* selector, or, if name is not specified, returns the
|
* selector, or, if name is not specified, returns the
|
||||||
* value of the attribute of the element specified by the
|
* value of the attribute of the element specified by the
|
||||||
* current selector.
|
* current selector.
|
||||||
*
|
*
|
||||||
@ -1048,7 +1049,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Sets or retrieves the text content of the element
|
* Sets or retrieves the text content of the element
|
||||||
* specified by the current selector. If a value is
|
* specified by the current selector. If a value is
|
||||||
* passed, it will set that value on the current element,
|
* passed, it will set that value on the current element,
|
||||||
* otherwise it will return the value of the current element
|
* otherwise it will return the value of the current element
|
||||||
*
|
*
|
||||||
@ -1062,11 +1063,11 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
text: function (value)
|
text: function (value)
|
||||||
{
|
{
|
||||||
var oldValue, set, type, sel;
|
var oldValue, set, type, sel;
|
||||||
|
|
||||||
sel = this.el;
|
sel = this.el;
|
||||||
|
|
||||||
set = (typeof value !== "undefined") ? true : false;
|
set = (typeof value !== "undefined") ? true : false;
|
||||||
|
|
||||||
type = (typeof sel.textContent !== "undefined")
|
type = (typeof sel.textContent !== "undefined")
|
||||||
? "textContent"
|
? "textContent"
|
||||||
: (typeof sel.innerText !== "undefined")
|
: (typeof sel.innerText !== "undefined")
|
||||||
@ -1074,7 +1075,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
: "innerHTML";
|
: "innerHTML";
|
||||||
|
|
||||||
oldValue = sel[type];
|
oldValue = sel[type];
|
||||||
|
|
||||||
if(set)
|
if(set)
|
||||||
{
|
{
|
||||||
sel[type] = value;
|
sel[type] = value;
|
||||||
@ -1087,7 +1088,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Sets or retrieves a css property of the element
|
* Sets or retrieves a css property of the element
|
||||||
* specified by the current selector. If a value is
|
* specified by the current selector. If a value is
|
||||||
* passed, it will set that value on the current element,
|
* passed, it will set that value on the current element,
|
||||||
* otherwise it will return the value of the css property
|
* otherwise it will return the value of the css property
|
||||||
* on the current element
|
* on the current element
|
||||||
@ -1107,14 +1108,14 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
{
|
{
|
||||||
return _css(this.el, prop);
|
return _css(this.el, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_.each(function (e){
|
$_.each(function (e){
|
||||||
_css(e, prop, val);
|
_css(e, prop, val);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Adds to the innerHTML of the current element, after the last child.
|
* Adds to the innerHTML of the current element, after the last child.
|
||||||
*
|
*
|
||||||
* @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
|
* @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
|
||||||
* @name append
|
* @name append
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
@ -1134,7 +1135,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Adds to the innerHTML of the selected element, before the current children
|
* Adds to the innerHTML of the selected element, before the current children
|
||||||
*
|
*
|
||||||
* @name prepend
|
* @name prepend
|
||||||
* @memberOf $_.dom
|
* @memberOf $_.dom
|
||||||
* @function
|
* @function
|
||||||
@ -1163,18 +1164,17 @@ if (typeof document !== "undefined" && !("classList" in document.createElement("
|
|||||||
*/
|
*/
|
||||||
html: function(htm)
|
html: function(htm)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(typeof htm !== "undefined")
|
if(typeof htm !== "undefined")
|
||||||
{
|
{
|
||||||
this.el.innerHTML = htm;
|
this.el.innerHTML = htm;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If the parameter is undefined, just return the current value
|
//If the parameter is undefined, just return the current value
|
||||||
return this.el.innerHTML;
|
return this.el.innerHTML;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$_.ext('dom', d);
|
$_.ext('dom', d);
|
||||||
|
|
||||||
}());
|
|
||||||
|
|
||||||
|
}());
|
||||||
|
8
kis-lite-min.js
vendored
8
kis-lite-min.js
vendored
@ -1,9 +1,9 @@
|
|||||||
(function(){if("undefined"!==typeof document.querySelector){var e,f,d,c;e=function(a){c="undefined"===typeof a?"undefined"!==typeof e.el?e.el:document.documentElement:"object"!==typeof a?f(a):a;e.prototype.el=c;var a=d(e),b;for(b in a)"object"===typeof a[b]&&(a[b].el=c);a.el=c;return a};f=function(a,b){var g;if("string"!=typeof a||"undefined"===typeof a)return a;g=null!=b&&1===b.nodeType?b:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);g=g.querySelectorAll(a);
|
(function(){if("undefined"!==typeof document.querySelector){var e,f,d,c;e=function(a){c="undefined"===typeof a?"undefined"!==typeof e.el?e.el:document.documentElement:"object"!==typeof a?f(a):a;e.prototype.el=c;var a=d(e),b;for(b in a)"object"===typeof a[b]&&(a[b].el=c);a.el=c;return a};f=function(a,b){var g;if("string"!=typeof a||"undefined"===typeof a)return a;g=null!=b&&1===b.nodeType?b:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);g=g.querySelectorAll(a);
|
||||||
return 1===g.length?g[0]:g};d=function(a){var b;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);b=typeof a;if(!("object"!==b&&"function"!==b))return b=function(){},b.prototype=a,new b}};e.ext=function(a,b){b.el=c;e[a]=b};e.ext("each",function(a){if("undefined"!==typeof c.length&&c!==window){var b=c.length;if(0!==b)for(var g,d=0;d<b;d++)g=c.item(d)?c.item(d):c[d],a.call(g,g)}else a.call(c,c)});e.type=function(a){return function(){return a&&a!==this}.call(a)?
|
return 1===g.length?g[0]:g};d=function(a){var b;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);b=typeof a;if(!("object"!==b&&"function"!==b))return b=function(){},b.prototype=a,new b}};e.ext=function(a,b){b.el=c;e[a]=b};e.ext("each",function(a){if("undefined"!==typeof c.length&&c!==window){var b=c.length;if(0!==b)for(var g,d=0;d<b;d++)g=c.item(d)?c.item(d):c[d],a.call(g,g)}else a.call(c,c)});e.type=function(a){return function(){return a&&a!==this}.call(a)?
|
||||||
(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};e=window.$_=window.$_||e;e.$=f}})();
|
(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};e=window.$_=window.$_||e;e.$=f}})();
|
||||||
(function(){"undefined"===typeof window.console&&(window.console={log:function(){}});"undefined"===typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")});"undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=!1},Event.prototype.stopPropagation=function(){window.event.cancelBubble=!0})})();
|
(function(){"undefined"===typeof window.console&&(window.console={log:function(){}});"undefined"===typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")});"undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=false},Event.prototype.stopPropagation=function(){window.event.cancelBubble=true})})();
|
||||||
(function(){if("undefined"!==typeof window.XMLHttpRequest){var e={_do:function(f,d,c,a){var b=new XMLHttpRequest;"undefined"===typeof c&&(c=function(){});a=a?"POST":"GET";f+="GET"===a?"?"+this._serialize(d):"";b.open(a,f);b.onreadystatechange=function(){4===b.readyState&&c(b.responseText)};"POST"===a?(b.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),b.send(this._serialize(d))):b.send(null)},_serialize:function(f){var d,c,a=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&&
|
(function(){if("undefined"!==typeof window.XMLHttpRequest){var e={_do:function(f,d,c,a){var b=new XMLHttpRequest;"undefined"===typeof c&&(c=function(){});a=a?"POST":"GET";f+="GET"===a?"?"+this._serialize(d):"";b.open(a,f);b.onreadystatechange=function(){4===b.readyState&&c(b.responseText)};"POST"===a?(b.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),b.send(this._serialize(d))):b.send(null)},_serialize:function(f){var d,c,a=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&&
|
||||||
(c=f[d].toString(),d=encodeURIComponent(d),c=encodeURIComponent(c),a.push(d+"="+c));return a.join("&")}};$_.ext("get",function(f,d,c){e._do(f,d,c,!1)});$_.ext("post",function(f,d,c){e._do(f,d,c,!0)})}})();
|
(c=f[d].toString(),d=encodeURIComponent(d),c=encodeURIComponent(c),a.push(d+"="+c));return a.join("&")}};$_.ext("get",function(f,d,c){e._do(f,d,c,!1)});$_.ext("post",function(f,d,c){e._do(f,d,c,!0)})}})();
|
||||||
(function(){var e,f,d,c;"undefined"!==typeof document.addEventListener?(e=function(a,b,g){"undefined"!==typeof a.addEventListener&&a.addEventListener(b,g,!1)},f=function(a,b,g){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(b,g,!1)}):"undefined"!==typeof document.attachEvent&&(e=function(a,b,g){function c(a){g.apply(a)}"undefined"!==typeof a.attachEvent?(f(b,g),a.attachEvent("on"+b,c),a=a.KIS_0_5_0=a.KIS_0_5_0||{},a.listeners=a.listeners||{},a.listeners[b]=a.listeners[b]||[],a.listeners[b].push({callback:g,
|
(function(){var e,f,d,c;"undefined"!==typeof document.addEventListener?(e=function(a,b,g){"undefined"!==typeof a.addEventListener&&a.addEventListener(b,g,!1)},f=function(a,b,g){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(b,g,!1)}):"undefined"!==typeof document.attachEvent&&(e=function(a,b,g){function c(a){g.apply(a)}"undefined"!==typeof a.attachEvent?(f(b,g),a.attachEvent("on"+b,c),a=a.KIS_0_6_0=a.KIS_0_6_0||{},a.listeners=a.listeners||{},a.listeners[b]=a.listeners[b]||[],a.listeners[b].push({callback:g,
|
||||||
_listener:c})):console.log("Failed to _attach event:"+b+" on "+a)},f=function(a,b,g){if("undefined"!==typeof a.detachEvent){var c=a.KIS_0_5_0;if(c&&c.listeners&&c.listeners[b])for(var d=c.listeners[b],f=d.length,e=0;e<f;e++)if(d[e].callback===g){a.detachEvent("on"+b,d[e]._listener);d.splice(e,1);0===d.length&&delete c.listeners[b];break}}});d=function(a,b,c,i){var h,j;if("undefined"===typeof a)return console.log(arguments),console.log(b),!1;if(b.match(/^([\w\-]+)$/))!0===i?e(a,b,c):f(a,b,c);else{b=
|
_listener:c})):console.log("Failed to _attach event:"+b+" on "+a)},f=function(a,b,g){if("undefined"!==typeof a.detachEvent){var c=a.KIS_0_6_0;if(c&&c.listeners&&c.listeners[b])for(var d=c.listeners[b],f=d.length,e=0;e<f;e++)if(d[e].callback===g){a.detachEvent("on"+b,d[e]._listener);d.splice(e,1);0===d.length&&delete c.listeners[b];break}}});d=function(a,b,c,i){var h,j;if(typeof a==="undefined"){console.log(arguments);console.log(b);return false}if(b.match(/^([\w\-]+)$/))i===true?e(a,b,c):f(a,b,c);
|
||||||
b.split(" ");j=b.length;for(h=0;h<j;h++)d(a,b[h],c,i)}};c=function(a,b,c,e){d(a,c,function(c){var d,g,f,c=c||window.event;g=$_.$(b,a);for(d in g)f=c.target||c.srcElement,f==g[d]&&(e.call(g[d],c),c.stopPropagation())},!0)};$_.ext("event",{add:function(a,b){$_.each(function(c){d(c,a,b,!0)})},remove:function(a,b){$_.each(function(c){d(c,a,b,!1)})},live:function(a,b,d){c(document.documentElement,a,b,d)},delegate:function(a,b,d){$_.each(function(e){c(e,a,b,d)})}})})();
|
else{b=b.split(" ");j=b.length;for(h=0;h<j;h++)d(a,b[h],c,i)}};c=function(a,b,c,e){d(a,c,function(c){var d,g,f,c=c||window.event;g=$_.$(b,a);for(d in g){f=c.target||c.srcElement;if(f==g[d]){e.call(g[d],c);c.stopPropagation()}}},true)};$_.ext("event",{add:function(a,b){$_.each(function(c){d(c,a,b,true)})},remove:function(a,b){$_.each(function(c){d(c,a,b,false)})},live:function(a,b,d){c(document.documentElement,a,b,d)},delegate:function(a,b,d){$_.each(function(e){c(e,a,b,d)})}})})();
|
||||||
|
135
kis-lite.js
135
kis-lite.js
@ -2,7 +2,7 @@
|
|||||||
Kis JS Keep It Simple JS Library
|
Kis JS Keep It Simple JS Library
|
||||||
Copyright Timothy J. Warren
|
Copyright Timothy J. Warren
|
||||||
License Public Domain
|
License Public Domain
|
||||||
Version 0.5.0
|
Version 0.6.0
|
||||||
*/
|
*/
|
||||||
(function (){
|
(function (){
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var $_, $, dcopy, sel;
|
var $_, $, dcopy, sel;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $_
|
* $_
|
||||||
@ -38,7 +38,7 @@
|
|||||||
if(typeof s === "undefined")
|
if(typeof s === "undefined")
|
||||||
{
|
{
|
||||||
//Defines a "global" selector for that instance
|
//Defines a "global" selector for that instance
|
||||||
sel = (typeof $_.el !== "undefined")
|
sel = (typeof $_.el !== "undefined")
|
||||||
? $_.el
|
? $_.el
|
||||||
: document.documentElement;
|
: document.documentElement;
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@
|
|||||||
{
|
{
|
||||||
sel = (typeof s !== "object") ? $(s) : s;
|
sel = (typeof s !== "object") ? $(s) : s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the selector to the prototype
|
// Add the selector to the prototype
|
||||||
$_.prototype.el = sel;
|
$_.prototype.el = sel;
|
||||||
|
|
||||||
@ -54,19 +54,19 @@
|
|||||||
var self = dcopy($_);
|
var self = dcopy($_);
|
||||||
|
|
||||||
// Give sel to each extension.
|
// Give sel to each extension.
|
||||||
for(var i in self)
|
for(var i in self)
|
||||||
{
|
{
|
||||||
if(typeof self[i] === "object")
|
if(typeof self[i] === "object")
|
||||||
{
|
{
|
||||||
self[i].el = sel;
|
self[i].el = sel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.el = sel;
|
self.el = sel;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple DOM selector function
|
* Simple DOM selector function
|
||||||
*
|
*
|
||||||
@ -79,14 +79,14 @@
|
|||||||
$ = function (a, context)
|
$ = function (a, context)
|
||||||
{
|
{
|
||||||
var x, c;
|
var x, c;
|
||||||
|
|
||||||
if (typeof a != "string" || typeof a === "undefined"){ return a;}
|
if (typeof a != "string" || typeof a === "undefined"){ return a;}
|
||||||
|
|
||||||
//Check for a context of a specific element, otherwise, just run on the document
|
//Check for a context of a specific element, otherwise, just run on the document
|
||||||
c = (context != null && context.nodeType === 1)
|
c = (context != null && context.nodeType === 1)
|
||||||
? context
|
? context
|
||||||
: document;
|
: document;
|
||||||
|
|
||||||
//Pick the quickest method for each kind of selector
|
//Pick the quickest method for each kind of selector
|
||||||
if (a.match(/^#([\w\-]+$)/))
|
if (a.match(/^#([\w\-]+$)/))
|
||||||
{
|
{
|
||||||
@ -96,11 +96,11 @@
|
|||||||
{
|
{
|
||||||
x = c.querySelectorAll(a);
|
x = c.querySelectorAll(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return the single object if applicable
|
//Return the single object if applicable
|
||||||
return (x.length === 1) ? x[0] : x;
|
return (x.length === 1) ? x[0] : x;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deep copy/prototypical constructor function
|
* Deep copy/prototypical constructor function
|
||||||
*
|
*
|
||||||
@ -112,38 +112,38 @@
|
|||||||
dcopy = function(obj)
|
dcopy = function(obj)
|
||||||
{
|
{
|
||||||
var type, F;
|
var type, F;
|
||||||
|
|
||||||
if(typeof obj === "undefined")
|
if(typeof obj === "undefined")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof Object.create !== "undefined")
|
if(typeof Object.create !== "undefined")
|
||||||
{
|
{
|
||||||
return Object.create(obj);
|
return Object.create(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
type = typeof obj;
|
type = typeof obj;
|
||||||
|
|
||||||
if(type !== "object" && type !== "function")
|
if(type !== "object" && type !== "function")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
F = function(){};
|
F = function(){};
|
||||||
|
|
||||||
F.prototype = obj;
|
F.prototype = obj;
|
||||||
|
|
||||||
return new F();
|
return new F();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the property `obj` to the $_ object, calling it `name`
|
* Adds the property `obj` to the $_ object, calling it `name`
|
||||||
*
|
*
|
||||||
* @param string name
|
* @param string name
|
||||||
* @param object obj
|
* @param object obj
|
||||||
*/
|
*/
|
||||||
@ -152,7 +152,7 @@
|
|||||||
obj.el = sel;
|
obj.el = sel;
|
||||||
$_[name] = obj;
|
$_[name] = obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over a $_ object, applying a callback to each item
|
* Iterates over a $_ object, applying a callback to each item
|
||||||
*
|
*
|
||||||
@ -183,7 +183,7 @@
|
|||||||
callback.call(sel, sel);
|
callback.call(sel, sel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the type of the passed variable
|
* Retrieves the type of the passed variable
|
||||||
*
|
*
|
||||||
@ -191,22 +191,22 @@
|
|||||||
* @return string
|
* @return string
|
||||||
* @type string
|
* @type string
|
||||||
*/
|
*/
|
||||||
$_.type = function(obj)
|
$_.type = function(obj)
|
||||||
{
|
{
|
||||||
if((function() {return obj && (obj !== this)}).call(obj))
|
if((function() {return obj && (obj !== this)}).call(obj))
|
||||||
{
|
{
|
||||||
//fallback on 'typeof' for truthy primitive values
|
//fallback on 'typeof' for truthy primitive values
|
||||||
return (typeof obj).toLowerCase();
|
return (typeof obj).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Strip x from [object x] and return
|
//Strip x from [object x] and return
|
||||||
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
|
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
//Set global variables
|
//Set global variables
|
||||||
$_ = window.$_ = window.$_ || $_;
|
$_ = window.$_ = window.$_ || $_;
|
||||||
$_.$ = $;
|
$_.$ = $;
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -214,11 +214,12 @@
|
|||||||
/**
|
/**
|
||||||
* A module of various browser polyfills
|
* A module of various browser polyfills
|
||||||
* @file polyfill.js
|
* @file polyfill.js
|
||||||
|
* @todo create ES5 Foreach polyfill
|
||||||
*/
|
*/
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Console.log polyfill for IE 8 stupidity
|
// Console.log polyfill for IE 8 stupidity
|
||||||
if(typeof window.console === "undefined")
|
if(typeof window.console === "undefined")
|
||||||
{
|
{
|
||||||
@ -226,9 +227,9 @@
|
|||||||
log:function(){}
|
log:function(){}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String trim function polyfill
|
* String trim function polyfill
|
||||||
*/
|
*/
|
||||||
@ -244,23 +245,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event.preventDefault/e.stopPropagation polyfill
|
* event.preventDefault/e.stopPropagation polyfill
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
|
if(typeof Event.preventDefault === "undefined" && typeof window.event !== "undefined")
|
||||||
{
|
{
|
||||||
Event.prototype.preventDefault = function()
|
Event.prototype.preventDefault = function()
|
||||||
{
|
{
|
||||||
window.event.returnValue = false;
|
window.event.returnValue = false;
|
||||||
},
|
},
|
||||||
Event.prototype.stopPropagation = function()
|
Event.prototype.stopPropagation = function()
|
||||||
{
|
{
|
||||||
window.event.cancelBubble = true;
|
window.event.cancelBubble = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -273,7 +274,7 @@
|
|||||||
(function (){
|
(function (){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Don't bother even defining the object if the XMLHttpRequest isn't available
|
// Don't bother even defining the object if the XMLHttpRequest isn't available
|
||||||
if(typeof window.XMLHttpRequest === "undefined")
|
if(typeof window.XMLHttpRequest === "undefined")
|
||||||
{
|
{
|
||||||
@ -283,9 +284,9 @@
|
|||||||
var ajax = {
|
var ajax = {
|
||||||
_do: function (url, data, callback, isPost)
|
_do: function (url, data, callback, isPost)
|
||||||
{
|
{
|
||||||
var type,
|
var type,
|
||||||
request = new XMLHttpRequest();
|
request = new XMLHttpRequest();
|
||||||
|
|
||||||
if (typeof callback === "undefined")
|
if (typeof callback === "undefined")
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -297,7 +298,7 @@
|
|||||||
type = (isPost) ? "POST" : "GET";
|
type = (isPost) ? "POST" : "GET";
|
||||||
|
|
||||||
url += (type === "GET") ? "?"+this._serialize(data) : '';
|
url += (type === "GET") ? "?"+this._serialize(data) : '';
|
||||||
|
|
||||||
request.open(type, url);
|
request.open(type, url);
|
||||||
|
|
||||||
request.onreadystatechange = function ()
|
request.onreadystatechange = function ()
|
||||||
@ -349,7 +350,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a GET type ajax request
|
* Sends a GET type ajax request
|
||||||
*
|
*
|
||||||
* @name get
|
* @name get
|
||||||
* @function
|
* @function
|
||||||
* @memberOf $_
|
* @memberOf $_
|
||||||
@ -360,10 +361,10 @@
|
|||||||
$_.ext('get', function (url, data, callback){
|
$_.ext('get', function (url, data, callback){
|
||||||
ajax._do(url, data, callback, false);
|
ajax._do(url, data, callback, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a POST type ajax request
|
* Sends a POST type ajax request
|
||||||
*
|
*
|
||||||
* @name post
|
* @name post
|
||||||
* @function
|
* @function
|
||||||
* @memberOf $_
|
* @memberOf $_
|
||||||
@ -374,6 +375,7 @@
|
|||||||
$_.ext('post', function (url, data, callback){
|
$_.ext('post', function (url, data, callback){
|
||||||
ajax._do(url, data, callback, true);
|
ajax._do(url, data, callback, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -382,13 +384,14 @@
|
|||||||
* Event
|
* Event
|
||||||
*
|
*
|
||||||
* Event api wrapper
|
* Event api wrapper
|
||||||
|
* @todo Add method for triggering events
|
||||||
*/
|
*/
|
||||||
(function (){
|
(function (){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Property name for expandos on DOM objects
|
// Property name for expandos on DOM objects
|
||||||
var kis_expando = "KIS_0_5_0";
|
var kis_expando = "KIS_0_6_0";
|
||||||
|
|
||||||
var _attach, _remove, _add_remove, e, _attach_delegate;
|
var _attach, _remove, _add_remove, e, _attach_delegate;
|
||||||
|
|
||||||
@ -419,7 +422,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
// typeof function doesn't work in IE where attachEvent is available: brute force it
|
// typeof function doesn't work in IE where attachEvent is available: brute force it
|
||||||
else if(typeof document.attachEvent !== "undefined")
|
else if(typeof document.attachEvent !== "undefined")
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@ -431,11 +434,11 @@
|
|||||||
// for event listeners, so we need to set it ourselves.
|
// for event listeners, so we need to set it ourselves.
|
||||||
callback.apply(arguments[0]);
|
callback.apply(arguments[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof sel.attachEvent !== "undefined")
|
if (typeof sel.attachEvent !== "undefined")
|
||||||
{
|
{
|
||||||
_remove(event, callback); // Make sure we don't have duplicate listeners
|
_remove(event, callback); // Make sure we don't have duplicate listeners
|
||||||
|
|
||||||
sel.attachEvent("on" + event, _listener);
|
sel.attachEvent("on" + event, _listener);
|
||||||
// Store our listener so we can remove it later
|
// Store our listener so we can remove it later
|
||||||
var expando = sel[kis_expando] = sel[kis_expando] || {};
|
var expando = sel[kis_expando] = sel[kis_expando] || {};
|
||||||
@ -481,11 +484,11 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_add_remove = function (sel, event, callback, add)
|
_add_remove = function (sel, event, callback, add)
|
||||||
{
|
{
|
||||||
var i, len;
|
var i, len;
|
||||||
|
|
||||||
if(typeof sel === "undefined")
|
if(typeof sel === "undefined")
|
||||||
{
|
{
|
||||||
console.log(arguments);
|
console.log(arguments);
|
||||||
@ -497,7 +500,7 @@
|
|||||||
if ( ! event.match(/^([\w\-]+)$/))
|
if ( ! event.match(/^([\w\-]+)$/))
|
||||||
{
|
{
|
||||||
event = event.split(" ");
|
event = event.split(" ");
|
||||||
|
|
||||||
len = event.length;
|
len = event.length;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
@ -508,7 +511,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(add === true)
|
if(add === true)
|
||||||
{
|
{
|
||||||
_attach(sel, event, callback);
|
_attach(sel, event, callback);
|
||||||
@ -523,37 +526,35 @@
|
|||||||
{
|
{
|
||||||
// attach the listener to the parent object
|
// attach the listener to the parent object
|
||||||
_add_remove(sel, event, function(e){
|
_add_remove(sel, event, function(e){
|
||||||
|
|
||||||
var elem, t, tar;
|
var elem, t, tar;
|
||||||
|
|
||||||
// IE 8 doesn't have event bound to element
|
// IE 8 doesn't have event bound to element
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
|
|
||||||
// Get the live version of the target selector
|
// Get the live version of the target selector
|
||||||
t = $_.$(target, sel);
|
t = $_.$(target, sel);
|
||||||
|
|
||||||
// Check each element to see if it matches the target
|
// Check each element to see if it matches the target
|
||||||
for(elem in t)
|
for(elem in t)
|
||||||
{
|
{
|
||||||
// IE 8 doesn't have target in the event object
|
// IE 8 doesn't have target in the event object
|
||||||
tar = e.target || e.srcElement;
|
tar = e.target || e.srcElement;
|
||||||
|
|
||||||
// Fire target callback when event bubbles from target
|
// Fire target callback when event bubbles from target
|
||||||
if(tar == t[elem])
|
if(tar == t[elem])
|
||||||
{
|
{
|
||||||
// Trigger the event callback
|
// Trigger the event callback
|
||||||
callback.call(t[elem], e);
|
callback.call(t[elem], e);
|
||||||
|
|
||||||
// Stop event propegation
|
// Stop event propegation
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, true);
|
}, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -567,7 +568,7 @@
|
|||||||
/**
|
/**
|
||||||
* Adds an event that returns a callback when triggered on the selected
|
* Adds an event that returns a callback when triggered on the selected
|
||||||
* event and selector
|
* event and selector
|
||||||
*
|
*
|
||||||
* @memberOf $_.event
|
* @memberOf $_.event
|
||||||
* @name add
|
* @name add
|
||||||
* @function
|
* @function
|
||||||
@ -597,7 +598,7 @@
|
|||||||
_add_remove(e, event, callback, false);
|
_add_remove(e, event, callback, false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Binds a persistent event to the document
|
* Binds a persistent event to the document
|
||||||
*
|
*
|
||||||
* @memberOf $_.event
|
* @memberOf $_.event
|
||||||
@ -612,7 +613,7 @@
|
|||||||
{
|
{
|
||||||
_attach_delegate(document.documentElement, target, event, callback);
|
_attach_delegate(document.documentElement, target, event, callback);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Binds an event to a parent object
|
* Binds an event to a parent object
|
||||||
*
|
*
|
||||||
* @memberOf $_.event
|
* @memberOf $_.event
|
||||||
|
50
kis-min.js
vendored
50
kis-min.js
vendored
@ -1,26 +1,24 @@
|
|||||||
(function(){if("undefined"!==typeof document.querySelector){var g,f,d,b;g=function(a){b="undefined"===typeof a?"undefined"!==typeof g.el?g.el:document.documentElement:"object"!==typeof a?f(a):a;g.prototype.el=b;var a=d(g),c;for(c in a)"object"===typeof a[c]&&(a[c].el=b);a.el=b;return a};f=function(a,c){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=c&&1===c.nodeType?c:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a);
|
(function(){if("undefined"!==typeof document.querySelector){var f,g,d,a;f=function(b){a="undefined"===typeof b?"undefined"!==typeof f.el?f.el:document.documentElement:"object"!==typeof b?g(b):b;f.prototype.el=a;var b=d(f),c;for(c in b)"object"===typeof b[c]&&(b[c].el=a);b.el=a;return b};g=function(b,c){var a;if("string"!=typeof b||"undefined"===typeof b)return b;a=null!=c&&1===c.nodeType?c:document;if(b.match(/^#([\w\-]+$)/))return document.getElementById(b.split("#")[1]);a=a.querySelectorAll(b);
|
||||||
return 1===b.length?b[0]:b};d=function(a){var c;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);c=typeof a;if(!("object"!==c&&"function"!==c))return c=function(){},c.prototype=a,new c}};g.ext=function(a,c){c.el=b;g[a]=c};g.ext("each",function(a){if("undefined"!==typeof b.length&&b!==window){var c=b.length;if(0!==c)for(var e,d=0;d<c;d++)e=b.item(d)?b.item(d):b[d],a.call(e,e)}else a.call(b,b)});g.type=function(a){return function(){return a&&a!==this}.call(a)?
|
return 1===a.length?a[0]:a};d=function(b){var a;if("undefined"!==typeof b){if("undefined"!==typeof Object.create)return Object.create(b);a=typeof b;if(!("object"!==a&&"function"!==a))return a=function(){},a.prototype=b,new a}};f.ext=function(b,c){c.el=a;f[b]=c};f.ext("each",function(b){if("undefined"!==typeof a.length&&a!==window){var c=a.length;if(0!==c)for(var e,d=0;d<c;d++)e=a.item(d)?a.item(d):a[d],b.call(e,e)}else b.call(a,a)});f.type=function(b){return function(){return b&&b!==this}.call(b)?
|
||||||
(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};g=window.$_=window.$_||g;g.$=f}})();
|
(typeof b).toLowerCase():{}.toString.call(b).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};f=window.$_=window.$_||f;f.$=g}})();
|
||||||
(function(){"undefined"===typeof window.console&&(window.console={log:function(){}});"undefined"===typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")});"undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=!1},Event.prototype.stopPropagation=function(){window.event.cancelBubble=!0})})();
|
(function(){"undefined"===typeof window.console&&(window.console={log:function(){}});"undefined"===typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")});"undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=false},Event.prototype.stopPropagation=function(){window.event.cancelBubble=true})})();
|
||||||
"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(g){var g=(g.HTMLElement||g.Element).prototype,f=Object,d=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},b=Array.prototype.indexOf||function(a){for(var c=0,b=this.length;c<b;c++)if(c in this&&this[c]===a)return c;return-1},a=function(a,c){this.name=a;this.code=DOMException[a];this.message=c},c=function(c,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR",
|
"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(f){var f=(f.HTMLElement||f.Element).prototype,g=Object,d=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},a=Array.prototype.indexOf||function(b){for(var a=0,c=this.length;a<c;a++)if(a in this&&this[a]===b)return a;return-1},b=function(b,a){this.name=b;this.code=DOMException[b];this.message=a},c=function(c,e){if(""===e)throw new b("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new b("INVALID_CHARACTER_ERR",
|
||||||
"String contains an invalid character");return b.call(c,e)},e=function(a){for(var c=d.call(a.className),c=c?c.split(/\s+/):[],b=0,e=c.length;b<e;b++)this.push(c[b]);this._updateClassName=function(){a.className=this.toString()}},j=e.prototype=[],i=function(){return new e(this)};a.prototype=Error.prototype;j.item=function(a){return this[a]||null};j.contains=function(a){return-1!==c(this,a+"")};j.add=function(a){a+="";-1===c(this,a)&&(this.push(a),this._updateClassName())};j.remove=function(a){a=c(this,
|
"String contains an invalid character");return a.call(c,e)},e=function(b){for(var a=d.call(b.className),a=a?a.split(/\s+/):[],c=0,e=a.length;c<e;c++)this.push(a[c]);this._updateClassName=function(){b.className=this.toString()}},i=e.prototype=[],h=function(){return new e(this)};b.prototype=Error.prototype;i.item=function(b){return this[b]||null};i.contains=function(b){return-1!==c(this,b+"")};i.add=function(b){b+="";-1===c(this,b)&&(this.push(b),this._updateClassName())};i.remove=function(b){b=c(this,
|
||||||
a+"");-1!==a&&(this.splice(a,1),this._updateClassName())};j.toggle=function(a){a+="";-1===c(this,a)?this.add(a):this.remove(a)};j.toString=function(){return this.join(" ")};if(f.defineProperty){j={get:i,enumerable:!0,configurable:!0};try{f.defineProperty(g,"classList",j)}catch(h){-2146823252===h.number&&(j.enumerable=!1,f.defineProperty(g,"classList",j))}}else f.prototype.__defineGetter__&&g.__defineGetter__("classList",i)}(self);
|
b+"");-1!==b&&(this.splice(b,1),this._updateClassName())};i.toggle=function(b){b+="";-1===c(this,b)?this.add(b):this.remove(b)};i.toString=function(){return this.join(" ")};if(g.defineProperty){i={get:h,enumerable:!0,configurable:!0};try{g.defineProperty(f,"classList",i)}catch(j){-2146823252===j.number&&(i.enumerable=!1,g.defineProperty(f,"classList",i))}}else g.prototype.__defineGetter__&&f.__defineGetter__("classList",h)}(self);
|
||||||
(function(){function g(b,a,c){var e,d;"undefined"!==typeof b.hasAttribute?(b.hasAttribute(a)&&(e=b.getAttribute(a)),d=!0):"undefined"!==typeof b[a]?(e=b[a],d=!1):"class"===a&&"undefined"!==typeof b.className&&(a="className",e=b.className,d=!1);if("undefined"===typeof e&&("undefined"===typeof c||null===c))console.log(c),console.log(b),console.log("Element does not have the selected attribute");else{if("undefined"===typeof c)return e;"undefined"!==typeof c&&null!==c?!0===d?b.setAttribute(a,c):b[a]=
|
(function(){function f(a,b,c){var e,d;"undefined"!==typeof a.hasAttribute?(a.hasAttribute(b)&&(e=a.getAttribute(b)),d=!0):"undefined"!==typeof a[b]?(e=a[b],d=!1):"class"===b&&"undefined"!==typeof a.className&&(b="className",e=a.className,d=!1);if("undefined"===typeof e&&("undefined"===typeof c||null===c))return console.log(c),console.log(a),console.log("Element does not have the selected attribute"),null;if("undefined"===typeof c)return e;"undefined"!==typeof c&&null!==c?!0===d?a.setAttribute(b,c):
|
||||||
c:null===c&&(!0===d?b.removeAttribute(a):delete b[a]);return"undefined"!==typeof c?c:e}}function f(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function d(b,a,c){var e,a=f(a);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if("undefined"===typeof c&&"undefined"!==b.style[a])return b.style[a];if("undefined"===typeof c&&"undefined"!==b.style[e[a]])return b.style[e[a]];"undefined"!==typeof b.style[a]?b.style[a]=c:b.style[e[a]]?b.style[e[a]]=
|
a[b]=c:null===c&&(!0===d?a.removeAttribute(b):delete a[b]);return"undefined"!==typeof c?c:e}function g(a){return a.replace(/(\-[a-z])/g,function(b){return b.toUpperCase().replace("-","")})}function d(a,b,c){var e,b=g(b);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if("undefined"===typeof c&&"undefined"!==a.style[b])return a.style[b];if("undefined"===typeof c&&"undefined"!==a.style[e[b]])return a.style[e[b]];if("undefined"!==typeof a.style[b])return a.style[b]=c,null;if(a.style[e[b]])return a.style[e[b]]=
|
||||||
c:console.log("Property "+a+" nor an equivalent seems to exist")}$_.ext("dom",{addClass:function(b){$_.each(function(a){a.classList.add(b)})},removeClass:function(b){$_.each(function(a){a.classList.remove(b)})},hide:function(){this.css("display","none")},show:function(b){"undefined"===typeof b&&(b="block");this.css("display",b)},attr:function(b,a){var c=this.el;if(1<c.length&&"undefined"===typeof a)console.log(c),console.log("Must be a singular element");else if(1<c.length&&"undefined"!==typeof a)$_.each(function(c){return g(c,
|
c,null;console.log("Property "+b+" nor an equivalent seems to exist")}$_.ext("dom",{addClass:function(a){$_.each(function(b){b.classList.add(a)})},removeClass:function(a){$_.each(function(b){b.classList.remove(a)})},hide:function(){this.css("display","none")},show:function(a){"undefined"===typeof a&&(a="block");this.css("display",a)},attr:function(a,b){var c=this.el;if(1<c.length&&"undefined"===typeof b)console.log(c),console.log("Must be a singular element");else if(1<c.length&&"undefined"!==typeof b)$_.each(function(c){return f(c,
|
||||||
b,a)});else return g(c,b,a)},text:function(b){var a,c,e;e=this.el;c="undefined"!==typeof e.textContent?"textContent":"undefined"!==typeof e.innerText?"innerText":"innerHTML";a=e[c];return"undefined"!==typeof b?e[c]=b:a},css:function(b,a){if("undefined"===typeof a)return d(this.el,b);$_.each(function(c){d(c,b,a)})},append:function(b){"undefined"!==typeof document.insertAdjacentHTML?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML+=b},prepend:function(b){"undefined"!==typeof document.insertAdjacentHTML?
|
a,b)});else return f(c,a,b)},text:function(a){var b,c,e;e=this.el;c="undefined"!==typeof e.textContent?"textContent":"undefined"!==typeof e.innerText?"innerText":"innerHTML";b=e[c];return"undefined"!==typeof a?e[c]=a:b},css:function(a,b){if("undefined"===typeof b)return d(this.el,a);$_.each(function(c){d(c,a,b)})},append:function(a){"undefined"!==typeof document.insertAdjacentHTML?this.el.insertAdjacentHTML("beforeend",a):this.el.innerHTML+=a},prepend:function(a){"undefined"!==typeof document.insertAdjacentHTML?
|
||||||
this.el.insertAdjacentHTML("afterbegin",b):this.el.innerHTML=b+this.el.innerHTML},html:function(b){"undefined"!==typeof b&&(this.el.innerHTML=b);return this.el.innerHTML}})})();
|
this.el.insertAdjacentHTML("afterbegin",a):this.el.innerHTML=a+this.el.innerHTML},html:function(a){"undefined"!==typeof a&&(this.el.innerHTML=a);return this.el.innerHTML}})})();
|
||||||
(function(){if("undefined"!==typeof window.XMLHttpRequest){var g={_do:function(f,d,b,a){var c=new XMLHttpRequest;"undefined"===typeof b&&(b=function(){});a=a?"POST":"GET";f+="GET"===a?"?"+this._serialize(d):"";c.open(a,f);c.onreadystatechange=function(){4===c.readyState&&b(c.responseText)};"POST"===a?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(this._serialize(d))):c.send(null)},_serialize:function(f){var d,b,a=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&&
|
(function(){if("undefined"!==typeof window.XMLHttpRequest){var f={_do:function(f,d,a,b){var c=new XMLHttpRequest;"undefined"===typeof a&&(a=function(){});b=b?"POST":"GET";f+="GET"===b?"?"+this._serialize(d):"";c.open(b,f);c.onreadystatechange=function(){4===c.readyState&&a(c.responseText)};"POST"===b?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(this._serialize(d))):c.send(null)},_serialize:function(f){var d,a,b=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&&
|
||||||
(b=f[d].toString(),d=encodeURIComponent(d),b=encodeURIComponent(b),a.push(d+"="+b));return a.join("&")}};$_.ext("get",function(f,d,b){g._do(f,d,b,!1)});$_.ext("post",function(f,d,b){g._do(f,d,b,!0)})}})();
|
(a=f[d].toString(),d=encodeURIComponent(d),a=encodeURIComponent(a),b.push(d+"="+a));return b.join("&")}};$_.ext("get",function(g,d,a){f._do(g,d,a,!1)});$_.ext("post",function(g,d,a){f._do(g,d,a,!0)})}})();
|
||||||
(function(){var g,f,d,b;"undefined"!==typeof document.addEventListener?(g=function(a,c,b){"undefined"!==typeof a.addEventListener&&a.addEventListener(c,b,!1)},f=function(a,c,b){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(c,b,!1)}):"undefined"!==typeof document.attachEvent&&(g=function(a,c,b){function d(a){b.apply(a)}"undefined"!==typeof a.attachEvent?(f(c,b),a.attachEvent("on"+c,d),a=a.KIS_0_5_0=a.KIS_0_5_0||{},a.listeners=a.listeners||{},a.listeners[c]=a.listeners[c]||[],a.listeners[c].push({callback:b,
|
(function(){var f,g,d,a;"undefined"!==typeof document.addEventListener?(f=function(b,a,e){"undefined"!==typeof b.addEventListener&&b.addEventListener(a,e,!1)},g=function(b,a,e){"undefined"!==typeof b.removeEventListener&&b.removeEventListener(a,e,!1)}):"undefined"!==typeof document.attachEvent&&(f=function(b,a,e){function d(b){e.apply(b)}"undefined"!==typeof b.attachEvent?(g(a,e),b.attachEvent("on"+a,d),b=b.KIS_0_6_0=b.KIS_0_6_0||{},b.listeners=b.listeners||{},b.listeners[a]=b.listeners[a]||[],b.listeners[a].push({callback:e,
|
||||||
_listener:d})):console.log("Failed to _attach event:"+c+" on "+a)},f=function(a,c,b){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[c])for(var f=d.listeners[c],g=f.length,k=0;k<g;k++)if(f[k].callback===b){a.detachEvent("on"+c,f[k]._listener);f.splice(k,1);0===f.length&&delete d.listeners[c];break}}});d=function(a,c,b,j){var i,h;if("undefined"===typeof a)return console.log(arguments),console.log(c),!1;if(c.match(/^([\w\-]+)$/))!0===j?g(a,c,b):f(a,c,b);else{c=
|
_listener:d})):console.log("Failed to _attach event:"+a+" on "+b)},g=function(b,a,d){if("undefined"!==typeof b.detachEvent){var f=b.KIS_0_6_0;if(f&&f.listeners&&f.listeners[a])for(var h=f.listeners[a],g=h.length,k=0;k<g;k++)if(h[k].callback===d){b.detachEvent("on"+a,h[k]._listener);h.splice(k,1);0===h.length&&delete f.listeners[a];break}}});d=function(b,a,e,i){var h,j;if(typeof b==="undefined"){console.log(arguments);console.log(a);return false}if(a.match(/^([\w\-]+)$/))i===true?f(b,a,e):g(b,a,e);
|
||||||
c.split(" ");h=c.length;for(i=0;i<h;i++)d(a,c[i],b,j)}};b=function(a,c,b,f){d(a,b,function(b){var d,e,g,b=b||window.event;e=$_.$(c,a);for(d in e)g=b.target||b.srcElement,g==e[d]&&(f.call(e[d],b),b.stopPropagation())},!0)};$_.ext("event",{add:function(a,b){$_.each(function(e){d(e,a,b,!0)})},remove:function(a,b){$_.each(function(e){d(e,a,b,!1)})},live:function(a,c,d){b(document.documentElement,a,c,d)},delegate:function(a,c,d){$_.each(function(f){b(f,a,c,d)})}})})();
|
else{a=a.split(" ");j=a.length;for(h=0;h<j;h++)d(b,a[h],e,i)}};a=function(b,a,e,f){d(b,e,function(d){var e,g,l,d=d||window.event;g=$_.$(a,b);for(e in g){l=d.target||d.srcElement;if(l==g[e]){f.call(g[e],d);d.stopPropagation()}}},true)};$_.ext("event",{add:function(b,a){$_.each(function(e){d(e,b,a,true)})},remove:function(b,a){$_.each(function(e){d(e,b,a,false)})},live:function(b,c,d){a(document.documentElement,b,c,d)},delegate:function(b,c,d){$_.each(function(f){a(f,b,c,d)})}})})();
|
||||||
(function(){var g=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB,f={};"undefined"!==typeof g&&(f={current_db:null,connect:function(d,b,a){var c={},c=g.open(d,b||0);"undefined"!==typeof a&&(c.onupgradeneeded=a);c.onerror=function(){console.log("IndexedDB disallowed.")};c.onsuccess=function(){f.current_db=c.result}}},$_.ext("indexedDB",f))})();
|
(function(){var f=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB,g={};"undefined"!==typeof f&&(g={current_db:null,connect:function(d,a,b){var c={},c=f.open(d,a||1);"undefined"!==typeof b&&(c.onupgradeneeded=b);c.onerror=function(){console.log("IndexedDB disallowed.")};c.onsuccess=function(){g.current_db=c.result}},create_store:function(d,a,b){var c={};"undefined"!==typeof a&&(c.keyPath=a);"undefined"!==typeof b&&(c.autoIncrement=!!b);return f.createObjectStore(d,
|
||||||
(function(){if(!("undefined"===typeof localStorage||"undefined"===typeof JSON)){var g=localStorage,f=sessionStorage;$_.ext("store",{get:function(d,b){var a=b?f.getItem(d):g.getItem(d);return JSON.parse(a)},set:function(d,b,a){b=JSON.stringify(b);a?f.setItem(d,b):g.setItem(d,b)},remove:function(d,b){b?f.removeItem(d):g.removeItem(d)},getAll:function(d){var b,a={},c,e;e=d?g:f;b=e.length;for(d=0;d<b;d++)c=e.key(d),a[c]=e.getItem(c);return a},clear:function(d){d?f.clear():g.clear()}})}})();
|
c)},delete_store:function(){f.deleteObjectStore().onerror=f.onerror}},$_.ext("indexedDB",g))})();
|
||||||
(function(){if("undefined"!==$_.ajax){var g,f;g={};f={};$_.ext("template",{get:function(d){var b;b=this.el.innerHTML;if(""===b)console.log("Template is empty or cannot be found");else return g[d]=b},parse:function(d,b){var a=g[d],c=[],e=/\{([A-Z0-9_\-]+)\}(.*)\{\/\1\}/gim,j=/\{([A-Z0-9_\-]+)\}/gim,c=[],i=0,h=i=0,k=0,l="",o={},m="",n,a=(""+a).replace(/\s+/gim," "),a=a.replace(/>\s+</gim,"><"),a=a.replace(/>\s+\{/gim,">{"),a=a.replace(/\}\s+</gim,"}<"),c=a.match(e);if(null!=c){i=c.length;for(h=0;h<
|
(function(){if("undefined"===typeof localStorage||"undefined"===typeof JSON)return null;var f=localStorage,g=sessionStorage;$_.ext("store",{get:function(d,a){var b=a?g.getItem(d):f.getItem(d);return JSON.parse(b)},set:function(d,a,b){a=JSON.stringify(a);b?g.setItem(d,a):f.setItem(d,a)},remove:function(d,a){a?g.removeItem(d):f.removeItem(d)},getAll:function(d){var a,b={},c,e;e=d?f:g;a=e.length;for(d=0;d<a;d++)c=e.key(d),b[c]=e.getItem(c);return b},clear:function(d){d?g.clear():f.clear()}})})();
|
||||||
i;h++){a=a.replace(c[h],"{"+h+"}");m="";l=(""+c[h]).match(/^\{([A-Z0-9_\-]+)\}/i);o=b[l[1]];if(0<o.length){l=o.length;c[h]=c[h].replace(e,"$2");for(k=0;k<l;k++)m+=c[h].replace(j,function(a,b){return o[k][b]?o[k][b]:""})}a=a.replace("{"+h+"}",m)}}c=a.match(j);if(null!=c){i=c.length;for(h=0;h<i;h++)l=c[h].replace("{",""),l=l.replace("}",""),a=a.replace(c[h],b[l])}e=document.createDocumentFragment();e.appendChild(document.createElement("section"));e=e.querySelectorAll("section")[0];e.innerHTML=a;e=e.querySelectorAll('[src=""], [href=""]');
|
(function(){var f=function(d){var a=[],b=0,c={},e,a=g.object_keys(d);a.sort(function(a,b){var c=parseFloat(b),d=parseFloat(a),e=c+""===b,f=d+""===a;return e&&f?c>d?1:c<d?-1:0:e&&!f?1:!e&&f?-1:b>a?1:b<a?-1:0});b=a.length;for(e=0;e<b;e++)c[a[e]]=d[a[e]];return c},g={object_keys:function(d){var a=[],b;for(b in d)d.hasOwnProperty(b)&&a.push(b);return a},object_values:function(d){var a=[],b;for(b in d)a.push(d[b]);return a},array_combine:function(d,a){var b={},c,e=0;"array"!==$_.type(d)&&(d=this.object_values(d));
|
||||||
for(n in e)e[n].parentNode&&e[n].parentNode.removeChild(e[n]);return f[d]=a},apply:function(d,b,a){"undefined"===typeof b&&"undefined"===typeof a?this.el.innerHTML="undefined"!==typeof f[d]?f[d]:d:$_.get(b,{},function(b){""===b?console.log("Template is empty or can not be found"):(g[d]=b,b=this.parse(d,a),f[d]=b,this.el.innerHTML=b)})}})}})();
|
"array"!==$_.type(a)&&(a=this.object_values(a));c=d.length;if(c!==a.length)return console.log("Object combine requires two arrays of the same size"),!1;for(e=0;e<c;e++)b[d[e]]=a[e];return b},object_merge:function(){var d=Array.prototype.slice.call(arguments),a=d.length,b={},c,e=0,f,g,j;c=!0;for(f=0;f<a;f++)if("array"!==$_.type(d[f])){c=!1;break}if(c){b=[];for(f=0;f<a;f++)b=b.contact(d[f]);return b}for(j=f=0;f<a;f++)if(c=d[f],"array"==$_.type(c)){g=0;for(e=c.length;g<e;g++)b[j++]=c[g]}else for(g in c)c.hasOwnProperty(g)&&
|
||||||
(function(){var g=function(d){var b=[],a=0,c={},e,b=f.object_keys(d);b.sort(function(a,b){var c=parseFloat(b),d=parseFloat(a),e=c+""===b,f=d+""===a;return e&&f?c>d?1:c<d?-1:0:e&&!f?1:!e&&f?-1:b>a?1:b<a?-1:0});a=b.length;for(e=0;e<a;e++)c[b[e]]=d[b[e]];return c},f={object_keys:function(d){var b=[],a;for(a in d)d.hasOwnProperty(a)&&b.push(a);return b},object_values:function(d){var b=[],a;for(a in d)b.push(d[a]);return b},array_combine:function(d,b){var a={},c,e=0;"array"!==$_.type(d)&&(d=this.object_values(d));
|
(parseInt(g,10)+""===g?b[j++]=c[g]:b[g]=c[g]);return b},str_trans:function(d,a,b){var c=[],e=[],g=!1,h=0,j=0,k="",l="",o="",m="",n;if("object"===typeof a){a=f(a);for(n in a)a.hasOwnProperty(n)&&(c.push(n),e.push(a[n]));a=c;b=e}j=d.length;h=a.length;k="string"===typeof b;l="string"===typeof a;for(c=0;c<j;c++){g=!1;if(l){d.charAt(c-1);o=d.charAt(c);d.charAt(c+1);for(e=0;e<h;e++)if(o==a.charAt(e)){g=!0;break}}else for(e=0;e<h;e++)if(d.substr(c,a[e].length)==a[e]){g=!0;c=c+a[e].length-1;break}m=g?m+(k?
|
||||||
"array"!==$_.type(b)&&(b=this.object_values(b));c=d.length;if(c!==b.length)return console.log("Object combine requires two arrays of the same size"),!1;for(e=0;e<c;e++)a[d[e]]=b[e];return a},object_merge:function(){var d=Array.prototype.slice.call(arguments),b=d.length,a={},c,e=0,f,g,h;c=!0;for(f=0;f<b;f++)if("array"!==$_.type(d[f])){c=!1;break}if(c){a=[];for(f=0;f<b;f++)a=a.contact(d[f]);return a}for(f=0,h=0;f<b;f++)if(c=d[f],"array"==$_.type(c))for(g=0,e=c.length;g<e;g++)a[h++]=c[g];else for(g in c)c.hasOwnProperty(g)&&
|
b.charAt(e):b[e]):m+d.charAt(c)}return m}};$_.ext("util",g)})();
|
||||||
(parseInt(g,10)+""===g?a[h++]=c[g]:a[g]=c[g]);return a},str_trans:function(d,b,a){var c=[],e=[],f=!1,i=0,h=0,k="",l="",o="",m="",n;if("object"===typeof b){b=g(b);for(n in b)b.hasOwnProperty(n)&&(c.push(n),e.push(b[n]));b=c;a=e}h=d.length;i=b.length;k="string"===typeof a;l="string"===typeof b;for(c=0;c<h;c++){f=!1;if(l){d.charAt(c-1);o=d.charAt(c);d.charAt(c+1);for(e=0;e<i;e++)if(o==b.charAt(e)){f=!0;break}}else for(e=0;e<i;e++)if(d.substr(c,b[e].length)==b[e]){f=!0;c=c+b[e].length-1;break}m=f?m+(k?
|
|
||||||
a.charAt(e):a[e]):m+d.charAt(c)}return m}};$_.ext("util",f)})();
|
|
||||||
|
Loading…
Reference in New Issue
Block a user