Netty deps are broken, remove for now
This commit is contained in:
parent
6616d1d452
commit
917d57b0b9
63
chat-demo/out/bc/core.js
Normal file
63
chat-demo/out/bc/core.js
Normal file
|
@ -0,0 +1,63 @@
|
|||
goog.provide('bc.core');
|
||||
goog.require('cljs.core');
|
||||
goog.require('bc.dom_helpers');
|
||||
goog.require('goog.net.BrowserChannel');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.KeyCodes');
|
||||
goog.require('goog.events.KeyHandler');
|
||||
bc.core.handler = (function handler(){
|
||||
var h__2898 = (new goog.net.BrowserChannel.Handler());
|
||||
|
||||
h__2898.channelOpened = (function (channel){
|
||||
return bc.core.enable_chat.call(null);
|
||||
});
|
||||
h__2898.channelHandleArray = (function (x,data){
|
||||
var msg__2899 = (data["msg"]);
|
||||
|
||||
return bc.dom_helpers.append.call(null,bc.dom_helpers.get_element.call(null,"room"),bc.dom_helpers.element.call(null,"\uFDD0'div",cljs.core.str.call(null,"MSG::",msg__2899)));
|
||||
});
|
||||
return h__2898;
|
||||
});
|
||||
bc.core.say = (function say(text){
|
||||
return bc.core.channel.sendMap((function (){var G__2900__2901 = cljs.core.js_obj.call(null);
|
||||
|
||||
(G__2900__2901["msg"] = text);
|
||||
return G__2900__2901;
|
||||
})());
|
||||
});
|
||||
bc.core.enable_chat = (function enable_chat(){
|
||||
var msg_input__2902 = bc.dom_helpers.get_element.call(null,"msg-input");
|
||||
var send_button__2903 = bc.dom_helpers.get_element.call(null,"send-button");
|
||||
var handler__2904 = (function (e){
|
||||
bc.core.say.call(null,bc.dom_helpers.value.call(null,msg_input__2902));
|
||||
return bc.dom_helpers.set_value.call(null,msg_input__2902,"");
|
||||
});
|
||||
|
||||
bc.dom_helpers.set_disabled.call(null,msg_input__2902,false);
|
||||
bc.dom_helpers.set_disabled.call(null,send_button__2903,false);
|
||||
goog.events.listen.call(null,(new goog.events.KeyHandler(msg_input__2902)),"key",(function (e){
|
||||
if(cljs.core.truth_(cljs.core._EQ_.call(null,e.keyCode,goog.events.KeyCodes.ENTER)))
|
||||
{return handler__2904.call(null,e);
|
||||
} else
|
||||
{return null;
|
||||
}
|
||||
}));
|
||||
return goog.events.listen.call(null,send_button__2903,"click",handler__2904);
|
||||
});
|
||||
bc.core.channel = (new goog.net.BrowserChannel());
|
||||
bc.core.run = (function run(){
|
||||
goog.events.listen.call(null,window,"unload",(function (){
|
||||
bc.core.channel.disconnect(cljs.core.List.EMPTY);
|
||||
return goog.events.removeAll.call(null);
|
||||
}));
|
||||
var G__2905__2906 = bc.core.channel.getChannelDebug().getLogger();
|
||||
|
||||
G__2905__2906.setLevel(goog.debug.Logger.Level.OFF);
|
||||
G__2905__2906;
|
||||
var G__2907__2908 = bc.core.channel;
|
||||
|
||||
G__2907__2908.setHandler(bc.core.handler.call(null));
|
||||
G__2907__2908.connect("/channel/test","/channel/bind");
|
||||
return G__2907__2908;
|
||||
});
|
||||
goog.exportSymbol('bc.core.run', bc.core.run);
|
240
chat-demo/out/bc/dom-helpers.js
Normal file
240
chat-demo/out/bc/dom-helpers.js
Normal file
|
@ -0,0 +1,240 @@
|
|||
goog.provide('bc.dom_helpers');
|
||||
goog.require('cljs.core');
|
||||
goog.require('clojure.string');
|
||||
goog.require('goog.style');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.classes');
|
||||
goog.require('goog.dom.forms');
|
||||
goog.require('goog.fx');
|
||||
goog.require('goog.fx.dom');
|
||||
goog.require('goog.Timer');
|
||||
/**
|
||||
* Return the element with the passed id.
|
||||
*/
|
||||
bc.dom_helpers.get_element = (function get_element(id){
|
||||
return goog.dom.getElement.call(null,cljs.core.name.call(null,id));
|
||||
});
|
||||
bc.dom_helpers.show_element = (function show_element(e,b){
|
||||
return goog.style.showElement.call(null,e,b);
|
||||
});
|
||||
bc.dom_helpers.add_remove_class = (function add_remove_class(e,add_classes,remove_classes){
|
||||
return goog.dom.classes.addRemove.call(null,e,remove_classes,add_classes);
|
||||
});
|
||||
bc.dom_helpers.get_radio_value = (function get_radio_value(form_name,name){
|
||||
return goog.dom.forms.getValueByName.call(null,bc.dom_helpers.get_element.call(null,form_name),name);
|
||||
});
|
||||
bc.dom_helpers.value = (function value(element){
|
||||
return goog.dom.forms.getValue.call(null,element);
|
||||
});
|
||||
bc.dom_helpers.set_value = (function set_value(element){
|
||||
return goog.dom.forms.setValue.call(null,element);
|
||||
});
|
||||
bc.dom_helpers.set_disabled = (function set_disabled(element,disabled){
|
||||
return goog.dom.forms.setDisabled.call(null,element,disabled);
|
||||
});
|
||||
/**
|
||||
* Append all children to parent.
|
||||
* @param {...*} var_args
|
||||
*/
|
||||
bc.dom_helpers.append = (function() {
|
||||
var append__delegate = function (parent,children){
|
||||
var G__2854__2855 = cljs.core.seq.call(null,children);
|
||||
|
||||
if(cljs.core.truth_(G__2854__2855))
|
||||
{var child__2856 = cljs.core.first.call(null,G__2854__2855);
|
||||
var G__2854__2857 = G__2854__2855;
|
||||
|
||||
while(true){
|
||||
goog.dom.appendChild.call(null,parent,child__2856);
|
||||
var temp__3698__auto____2858 = cljs.core.next.call(null,G__2854__2857);
|
||||
|
||||
if(cljs.core.truth_(temp__3698__auto____2858))
|
||||
{var G__2854__2859 = temp__3698__auto____2858;
|
||||
|
||||
{
|
||||
var G__2860 = cljs.core.first.call(null,G__2854__2859);
|
||||
var G__2861 = G__2854__2859;
|
||||
child__2856 = G__2860;
|
||||
G__2854__2857 = G__2861;
|
||||
continue;
|
||||
}
|
||||
} else
|
||||
{}
|
||||
break;
|
||||
}
|
||||
} else
|
||||
{}
|
||||
return parent;
|
||||
};
|
||||
var append = function (parent,var_args){
|
||||
var children = null;
|
||||
if (goog.isDef(var_args)) {
|
||||
children = cljs.core.array_seq(Array.prototype.slice.call(arguments, 1),0);
|
||||
}
|
||||
return append__delegate.call(this, parent, children);
|
||||
};
|
||||
append.cljs$lang$maxFixedArity = 1;
|
||||
append.cljs$lang$applyTo = (function (arglist__2862){
|
||||
var parent = cljs.core.first(arglist__2862);
|
||||
var children = cljs.core.rest(arglist__2862);
|
||||
return append__delegate.call(this, parent, children);
|
||||
});
|
||||
return append;
|
||||
})()
|
||||
;
|
||||
/**
|
||||
* Set the text content for the passed element returning the
|
||||
* element. If a keyword is passed in the place of e, the element with
|
||||
* that id will be used and returned.
|
||||
*/
|
||||
bc.dom_helpers.set_text = (function set_text(e,s){
|
||||
var e__2865 = (cljs.core.truth_((function (){var or__3548__auto____2864 = cljs.core.keyword_QMARK_.call(null,e);
|
||||
|
||||
if(cljs.core.truth_(or__3548__auto____2864))
|
||||
{return or__3548__auto____2864;
|
||||
} else
|
||||
{return cljs.core.string_QMARK_.call(null,e);
|
||||
}
|
||||
})())?bc.dom_helpers.get_element.call(null,e):e);
|
||||
|
||||
var G__2866__2867 = e__2865;
|
||||
|
||||
goog.dom.setTextContent.call(null,G__2866__2867,s);
|
||||
return G__2866__2867;
|
||||
});
|
||||
bc.dom_helpers.normalize_args = (function normalize_args(tag,args){
|
||||
var parts__2871 = clojure.string.split.call(null,tag,/(\.|#)/);
|
||||
var vec__2870__2872 = cljs.core.PersistentVector.fromArray([cljs.core.first.call(null,parts__2871),cljs.core.apply.call(null,cljs.core.hash_map,cljs.core.map.call(null,(function (p1__2863_SHARP_){
|
||||
if(cljs.core.truth_(cljs.core._EQ_.call(null,p1__2863_SHARP_,".")))
|
||||
{return "\uFDD0'class";
|
||||
} else
|
||||
{if(cljs.core.truth_(cljs.core._EQ_.call(null,p1__2863_SHARP_,"#")))
|
||||
{return "\uFDD0'id";
|
||||
} else
|
||||
{if(cljs.core.truth_("\uFDD0'else"))
|
||||
{return p1__2863_SHARP_;
|
||||
} else
|
||||
{return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}),cljs.core.rest.call(null,parts__2871)))]);
|
||||
var tag__2873 = cljs.core.nth.call(null,vec__2870__2872,0,null);
|
||||
var attrs__2874 = cljs.core.nth.call(null,vec__2870__2872,1,null);
|
||||
|
||||
if(cljs.core.truth_(cljs.core.map_QMARK_.call(null,cljs.core.first.call(null,args))))
|
||||
{return cljs.core.PersistentVector.fromArray([tag__2873,cljs.core.merge.call(null,attrs__2874,cljs.core.first.call(null,args)),cljs.core.rest.call(null,args)]);
|
||||
} else
|
||||
{return cljs.core.PersistentVector.fromArray([tag__2873,attrs__2874,args]);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Create a dom element using a keyword for the element name and a map
|
||||
* for the attributes. Append all children to parent. If the first
|
||||
* child is a string then the string will be set as the text content of
|
||||
* the parent and all remaining children will be appended.
|
||||
* @param {...*} var_args
|
||||
*/
|
||||
bc.dom_helpers.element = (function() {
|
||||
var element__delegate = function (tag,args){
|
||||
var vec__2875__2877 = bc.dom_helpers.normalize_args.call(null,tag,args);
|
||||
var tag__2878 = cljs.core.nth.call(null,vec__2875__2877,0,null);
|
||||
var attrs__2879 = cljs.core.nth.call(null,vec__2875__2877,1,null);
|
||||
var children__2880 = cljs.core.nth.call(null,vec__2875__2877,2,null);
|
||||
var parent__2886 = goog.dom.createDom.call(null,cljs.core.subs.call(null,tag__2878,1),cljs.core.reduce.call(null,(function (m,p__2881){
|
||||
var vec__2882__2883 = p__2881;
|
||||
var k__2884 = cljs.core.nth.call(null,vec__2882__2883,0,null);
|
||||
var v__2885 = cljs.core.nth.call(null,vec__2882__2883,1,null);
|
||||
|
||||
return cljs.core.assoc.call(null,m,k__2884,v__2885);
|
||||
}),cljs.core.ObjMap.fromObject([],{}),cljs.core.map.call(null,(function (p1__2868_SHARP_,p2__2869_SHARP_){
|
||||
return cljs.core.vector.call(null,cljs.core.name.call(null,p1__2868_SHARP_),p2__2869_SHARP_);
|
||||
}),cljs.core.keys.call(null,attrs__2879),cljs.core.vals.call(null,attrs__2879))).strobj);
|
||||
var vec__2876__2887 = (cljs.core.truth_(cljs.core.string_QMARK_.call(null,cljs.core.first.call(null,children__2880)))?cljs.core.PersistentVector.fromArray([bc.dom_helpers.set_text.call(null,element.call(null,tag__2878,attrs__2879),cljs.core.first.call(null,children__2880)),cljs.core.rest.call(null,children__2880)]):cljs.core.PersistentVector.fromArray([parent__2886,children__2880]));
|
||||
var parent__2888 = cljs.core.nth.call(null,vec__2876__2887,0,null);
|
||||
var children__2889 = cljs.core.nth.call(null,vec__2876__2887,1,null);
|
||||
|
||||
return cljs.core.apply.call(null,bc.dom_helpers.append,parent__2888,children__2889);
|
||||
};
|
||||
var element = function (tag,var_args){
|
||||
var args = null;
|
||||
if (goog.isDef(var_args)) {
|
||||
args = cljs.core.array_seq(Array.prototype.slice.call(arguments, 1),0);
|
||||
}
|
||||
return element__delegate.call(this, tag, args);
|
||||
};
|
||||
element.cljs$lang$maxFixedArity = 1;
|
||||
element.cljs$lang$applyTo = (function (arglist__2890){
|
||||
var tag = cljs.core.first(arglist__2890);
|
||||
var args = cljs.core.rest(arglist__2890);
|
||||
return element__delegate.call(this, tag, args);
|
||||
});
|
||||
return element;
|
||||
})()
|
||||
;
|
||||
/**
|
||||
* Remove all children from the element with the passed id.
|
||||
*/
|
||||
bc.dom_helpers.remove_children = (function remove_children(parent_el){
|
||||
return goog.dom.removeChildren.call(null,parent_el);
|
||||
});
|
||||
/**
|
||||
* Create a dom element from an html string.
|
||||
*/
|
||||
bc.dom_helpers.html = (function html(s){
|
||||
return goog.dom.htmlToDocumentFragment.call(null,s);
|
||||
});
|
||||
bc.dom_helpers.element_arg_QMARK_ = (function element_arg_QMARK_(x){
|
||||
var or__3548__auto____2891 = cljs.core.keyword_QMARK_.call(null,x);
|
||||
|
||||
if(cljs.core.truth_(or__3548__auto____2891))
|
||||
{return or__3548__auto____2891;
|
||||
} else
|
||||
{var or__3548__auto____2892 = cljs.core.map_QMARK_.call(null,x);
|
||||
|
||||
if(cljs.core.truth_(or__3548__auto____2892))
|
||||
{return or__3548__auto____2892;
|
||||
} else
|
||||
{return cljs.core.string_QMARK_.call(null,x);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Build up a dom element from nested vectors.
|
||||
*/
|
||||
bc.dom_helpers.build = (function build(x){
|
||||
if(cljs.core.truth_(cljs.core.vector_QMARK_.call(null,x)))
|
||||
{var vec__2893__2894 = (cljs.core.truth_(cljs.core.keyword_QMARK_.call(null,cljs.core.first.call(null,x)))?cljs.core.PersistentVector.fromArray([cljs.core.apply.call(null,bc.dom_helpers.element,cljs.core.take_while.call(null,bc.dom_helpers.element_arg_QMARK_,x)),cljs.core.drop_while.call(null,bc.dom_helpers.element_arg_QMARK_,x)]):cljs.core.PersistentVector.fromArray([cljs.core.first.call(null,x),cljs.core.rest.call(null,x)]));
|
||||
var parent__2895 = cljs.core.nth.call(null,vec__2893__2894,0,null);
|
||||
var children__2896 = cljs.core.nth.call(null,vec__2893__2894,1,null);
|
||||
var children__2897 = cljs.core.map.call(null,build,children__2896);
|
||||
|
||||
return cljs.core.apply.call(null,bc.dom_helpers.append,parent__2895,children__2897);
|
||||
} else
|
||||
{return x;
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Insert a child element at a specific location.
|
||||
*/
|
||||
bc.dom_helpers.insert_at = (function insert_at(parent,child,index){
|
||||
return goog.dom.insertChildAt.call(null,parent,child,index);
|
||||
});
|
||||
bc.dom_helpers.set_timeout = (function set_timeout(func,ttime){
|
||||
return goog.Timer.callOnce.call(null,func,ttime);
|
||||
});
|
||||
bc.dom_helpers.set_position = (function set_position(e,x,y){
|
||||
return goog.style.setPosition.call(null,e,x,y);
|
||||
});
|
||||
bc.dom_helpers.get_position = (function get_position(e){
|
||||
return goog.style.getPosition.call(null,e);
|
||||
});
|
||||
bc.dom_helpers.toggle_class = (function toggle_class(el,classname){
|
||||
return goog.dom.classes.toggle.call(null,el,classname);
|
||||
});
|
||||
bc.dom_helpers.add_class = (function add_class(el,classname){
|
||||
return goog.dom.classes.add.call(null,el,classname);
|
||||
});
|
||||
bc.dom_helpers.remove_class = (function remove_class(el,classname){
|
||||
return goog.dom.classes.remove.call(null,el,classname);
|
||||
});
|
3766
chat-demo/out/cljs/core.cljs
Normal file
3766
chat-demo/out/cljs/core.cljs
Normal file
File diff suppressed because it is too large
Load diff
12645
chat-demo/out/cljs/core.js
Normal file
12645
chat-demo/out/cljs/core.js
Normal file
File diff suppressed because it is too large
Load diff
160
chat-demo/out/clojure/string.cljs
Normal file
160
chat-demo/out/clojure/string.cljs
Normal file
|
@ -0,0 +1,160 @@
|
|||
; Copyright (c) Rich Hickey. All rights reserved.
|
||||
; The use and distribution terms for this software are covered by the
|
||||
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
|
||||
; which can be found in the file epl-v10.html at the root of this distribution.
|
||||
; By using this software in any fashion, you are agreeing to be bound by
|
||||
; the terms of this license.
|
||||
; You must not remove this notice, or any other, from this software.
|
||||
|
||||
(ns clojure.string
|
||||
(:refer-clojure :exclude [replace reverse])
|
||||
(:require [goog.string :as gstring]
|
||||
[goog.string.StringBuffer :as gstringbuf]))
|
||||
|
||||
(defn- seq-reverse
|
||||
[coll]
|
||||
(reduce conj () coll))
|
||||
|
||||
(defn reverse
|
||||
"Returns s with its characters reversed."
|
||||
[s]
|
||||
(.. s (split "") (reverse) (join "")))
|
||||
|
||||
(defn replace
|
||||
"Replaces all instance of match with replacement in s.
|
||||
match/replacement can be:
|
||||
|
||||
string / string
|
||||
pattern / (string or function of match)."
|
||||
[s match replacement]
|
||||
(cond (string? match)
|
||||
(.replace s (js/RegExp. (gstring/regExpEscape match) "g") replacement)
|
||||
(.hasOwnProperty match "source")
|
||||
(.replace s (js/RegExp. (.-source match) "g") replacement)
|
||||
:else (throw (str "Invalid match arg: " match))))
|
||||
|
||||
(defn replace-first
|
||||
"Replaces the first instance of match with replacement in s.
|
||||
match/replacement can be:
|
||||
|
||||
string / string
|
||||
pattern / (string or function of match)."
|
||||
[s match replacement]
|
||||
(.replace s match replacement))
|
||||
|
||||
(defn join
|
||||
"Returns a string of all elements in coll, as returned by (seq coll),
|
||||
separated by an optional separator."
|
||||
([coll]
|
||||
(apply str coll))
|
||||
([separator coll]
|
||||
(apply str (interpose separator coll))))
|
||||
|
||||
(defn upper-case
|
||||
"Converts string to all upper-case."
|
||||
[s]
|
||||
(. s (toUpperCase)))
|
||||
|
||||
(defn lower-case
|
||||
"Converts string to all lower-case."
|
||||
[s]
|
||||
(. s (toLowerCase)))
|
||||
|
||||
(defn capitalize
|
||||
"Converts first character of the string to upper-case, all other
|
||||
characters to lower-case."
|
||||
[s]
|
||||
(if (< (count s) 2)
|
||||
(upper-case s)
|
||||
(str (upper-case (subs s 0 1))
|
||||
(lower-case (subs s 1)))))
|
||||
|
||||
;; The JavaScript split function takes a limit argument but the return
|
||||
;; value is not the same as the Java split function.
|
||||
;;
|
||||
;; Java: (.split "a-b-c" #"-" 2) => ["a" "b-c"]
|
||||
;; JavaScript: (.split "a-b-c" #"-" 2) => ["a" "b"]
|
||||
;;
|
||||
;; For consistency, the three arg version has been implemented to
|
||||
;; mimic Java's behavior.
|
||||
|
||||
(defn split
|
||||
"Splits string on a regular expression. Optional argument limit is
|
||||
the maximum number of splits. Not lazy. Returns vector of the splits."
|
||||
([s re]
|
||||
(vec (.split (str s) re)))
|
||||
([s re limit]
|
||||
(if (< limit 1)
|
||||
(vec (.split (str s) re))
|
||||
(loop [s s
|
||||
limit limit
|
||||
parts []]
|
||||
(if (= limit 1)
|
||||
(conj parts s)
|
||||
(if-let [m (re-find re s)]
|
||||
(let [index (.indexOf s m)]
|
||||
(recur (.substring s (+ index (count m)))
|
||||
(dec limit)
|
||||
(conj parts (.substring s 0 index))))
|
||||
(conj parts s)))))))
|
||||
|
||||
(defn split-lines
|
||||
"Splits s on \n or \r\n."
|
||||
[s]
|
||||
(split s #"\n|\r\n"))
|
||||
|
||||
(defn trim
|
||||
"Removes whitespace from both ends of string."
|
||||
[s]
|
||||
(gstring/trim s))
|
||||
|
||||
(defn triml
|
||||
"Removes whitespace from the left side of string."
|
||||
[s]
|
||||
(gstring/trimLeft s))
|
||||
|
||||
(defn trimr
|
||||
"Removes whitespace from the right side of string."
|
||||
[s]
|
||||
(gstring/trimRight s))
|
||||
|
||||
(defn trim-newline
|
||||
"Removes all trailing newline \\n or return \\r characters from
|
||||
string. Similar to Perl's chomp."
|
||||
[s]
|
||||
(loop [index (.-length s)]
|
||||
(if (zero? index)
|
||||
""
|
||||
(let [ch (get s (dec index))]
|
||||
(if (or (= ch \newline) (= ch \return))
|
||||
(recur (dec index))
|
||||
(.substring s 0 index))))))
|
||||
|
||||
(defn blank?
|
||||
"True is s is nil, empty, or contains only whitespace."
|
||||
[s]
|
||||
(let [s (str s)]
|
||||
(if (or
|
||||
(not s)
|
||||
(= "" s)
|
||||
(re-matches #"\s+" s))
|
||||
true
|
||||
false)))
|
||||
|
||||
(defn escape
|
||||
"Return a new string, using cmap to escape each character ch
|
||||
from s as follows:
|
||||
|
||||
If (cmap ch) is nil, append ch to the new string.
|
||||
If (cmap ch) is non-nil, append (str (cmap ch)) instead."
|
||||
[s cmap]
|
||||
(let [buffer (gstring/StringBuffer.)
|
||||
length (.-length s)]
|
||||
(loop [index 0]
|
||||
(if (= length index)
|
||||
(. buffer (toString))
|
||||
(let [ch (.charAt s index)]
|
||||
(if-let [replacement (get cmap ch)]
|
||||
(.append buffer (str replacement))
|
||||
(.append buffer ch))
|
||||
(recur (inc index)))))))
|
270
chat-demo/out/clojure/string.js
Normal file
270
chat-demo/out/clojure/string.js
Normal file
|
@ -0,0 +1,270 @@
|
|||
goog.provide('clojure.string');
|
||||
goog.require('cljs.core');
|
||||
goog.require('goog.string');
|
||||
goog.require('goog.string.StringBuffer');
|
||||
clojure.string.seq_reverse = (function seq_reverse(coll){
|
||||
return cljs.core.reduce.call(null,cljs.core.conj,cljs.core.List.EMPTY,coll);
|
||||
});
|
||||
/**
|
||||
* Returns s with its characters reversed.
|
||||
*/
|
||||
clojure.string.reverse = (function reverse(s){
|
||||
return s.split("").reverse().join("");
|
||||
});
|
||||
/**
|
||||
* Replaces all instance of match with replacement in s.
|
||||
* match/replacement can be:
|
||||
*
|
||||
* string / string
|
||||
* pattern / (string or function of match).
|
||||
*/
|
||||
clojure.string.replace = (function replace(s,match,replacement){
|
||||
if(cljs.core.truth_(cljs.core.string_QMARK_.call(null,match)))
|
||||
{return s.replace((new RegExp(goog.string.regExpEscape.call(null,match),"g")),replacement);
|
||||
} else
|
||||
{if(cljs.core.truth_(match.hasOwnProperty("source")))
|
||||
{return s.replace((new RegExp(match.source,"g")),replacement);
|
||||
} else
|
||||
{if(cljs.core.truth_("\uFDD0'else"))
|
||||
{throw cljs.core.str.call(null,"Invalid match arg: ",match);
|
||||
} else
|
||||
{return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Replaces the first instance of match with replacement in s.
|
||||
* match/replacement can be:
|
||||
*
|
||||
* string / string
|
||||
* pattern / (string or function of match).
|
||||
*/
|
||||
clojure.string.replace_first = (function replace_first(s,match,replacement){
|
||||
return s.replace(match,replacement);
|
||||
});
|
||||
/**
|
||||
* Returns a string of all elements in coll, as returned by (seq coll),
|
||||
* separated by an optional separator.
|
||||
*/
|
||||
clojure.string.join = (function() {
|
||||
var join = null;
|
||||
var join__4704 = (function (coll){
|
||||
return cljs.core.apply.call(null,cljs.core.str,coll);
|
||||
});
|
||||
var join__4705 = (function (separator,coll){
|
||||
return cljs.core.apply.call(null,cljs.core.str,cljs.core.interpose.call(null,separator,coll));
|
||||
});
|
||||
join = function(separator,coll){
|
||||
switch(arguments.length){
|
||||
case 1 :
|
||||
return join__4704.call(this,separator);
|
||||
case 2 :
|
||||
return join__4705.call(this,separator,coll);
|
||||
}
|
||||
throw('Invalid arity: ' + arguments.length);
|
||||
};
|
||||
return join;
|
||||
})()
|
||||
;
|
||||
/**
|
||||
* Converts string to all upper-case.
|
||||
*/
|
||||
clojure.string.upper_case = (function upper_case(s){
|
||||
return s.toUpperCase();
|
||||
});
|
||||
/**
|
||||
* Converts string to all lower-case.
|
||||
*/
|
||||
clojure.string.lower_case = (function lower_case(s){
|
||||
return s.toLowerCase();
|
||||
});
|
||||
/**
|
||||
* Converts first character of the string to upper-case, all other
|
||||
* characters to lower-case.
|
||||
*/
|
||||
clojure.string.capitalize = (function capitalize(s){
|
||||
if(cljs.core.truth_((cljs.core.count.call(null,s) < 2)))
|
||||
{return clojure.string.upper_case.call(null,s);
|
||||
} else
|
||||
{return cljs.core.str.call(null,clojure.string.upper_case.call(null,cljs.core.subs.call(null,s,0,1)),clojure.string.lower_case.call(null,cljs.core.subs.call(null,s,1)));
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Splits string on a regular expression. Optional argument limit is
|
||||
* the maximum number of splits. Not lazy. Returns vector of the splits.
|
||||
*/
|
||||
clojure.string.split = (function() {
|
||||
var split = null;
|
||||
var split__4713 = (function (s,re){
|
||||
return cljs.core.vec.call(null,cljs.core.str.call(null,s).split(re));
|
||||
});
|
||||
var split__4714 = (function (s,re,limit){
|
||||
if(cljs.core.truth_((limit < 1)))
|
||||
{return cljs.core.vec.call(null,cljs.core.str.call(null,s).split(re));
|
||||
} else
|
||||
{var s__4707 = s;
|
||||
var limit__4708 = limit;
|
||||
var parts__4709 = cljs.core.PersistentVector.fromArray([]);
|
||||
|
||||
while(true){
|
||||
if(cljs.core.truth_(cljs.core._EQ_.call(null,limit__4708,1)))
|
||||
{return cljs.core.conj.call(null,parts__4709,s__4707);
|
||||
} else
|
||||
{var temp__3695__auto____4710 = cljs.core.re_find.call(null,re,s__4707);
|
||||
|
||||
if(cljs.core.truth_(temp__3695__auto____4710))
|
||||
{var m__4711 = temp__3695__auto____4710;
|
||||
|
||||
var index__4712 = s__4707.indexOf(m__4711);
|
||||
|
||||
{
|
||||
var G__4716 = s__4707.substring((index__4712 + cljs.core.count.call(null,m__4711)));
|
||||
var G__4717 = (limit__4708 - 1);
|
||||
var G__4718 = cljs.core.conj.call(null,parts__4709,s__4707.substring(0,index__4712));
|
||||
s__4707 = G__4716;
|
||||
limit__4708 = G__4717;
|
||||
parts__4709 = G__4718;
|
||||
continue;
|
||||
}
|
||||
} else
|
||||
{return cljs.core.conj.call(null,parts__4709,s__4707);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
split = function(s,re,limit){
|
||||
switch(arguments.length){
|
||||
case 2 :
|
||||
return split__4713.call(this,s,re);
|
||||
case 3 :
|
||||
return split__4714.call(this,s,re,limit);
|
||||
}
|
||||
throw('Invalid arity: ' + arguments.length);
|
||||
};
|
||||
return split;
|
||||
})()
|
||||
;
|
||||
/**
|
||||
* Splits s on
|
||||
* or
|
||||
* .
|
||||
*/
|
||||
clojure.string.split_lines = (function split_lines(s){
|
||||
return clojure.string.split.call(null,s,/\n|\r\n/);
|
||||
});
|
||||
/**
|
||||
* Removes whitespace from both ends of string.
|
||||
*/
|
||||
clojure.string.trim = (function trim(s){
|
||||
return goog.string.trim.call(null,s);
|
||||
});
|
||||
/**
|
||||
* Removes whitespace from the left side of string.
|
||||
*/
|
||||
clojure.string.triml = (function triml(s){
|
||||
return goog.string.trimLeft.call(null,s);
|
||||
});
|
||||
/**
|
||||
* Removes whitespace from the right side of string.
|
||||
*/
|
||||
clojure.string.trimr = (function trimr(s){
|
||||
return goog.string.trimRight.call(null,s);
|
||||
});
|
||||
/**
|
||||
* Removes all trailing newline \n or return \r characters from
|
||||
* string. Similar to Perl's chomp.
|
||||
*/
|
||||
clojure.string.trim_newline = (function trim_newline(s){
|
||||
var index__4719 = s.length;
|
||||
|
||||
while(true){
|
||||
if(cljs.core.truth_((index__4719 === 0)))
|
||||
{return "";
|
||||
} else
|
||||
{var ch__4720 = cljs.core.get.call(null,s,(index__4719 - 1));
|
||||
|
||||
if(cljs.core.truth_((function (){var or__3548__auto____4721 = cljs.core._EQ_.call(null,ch__4720,"\n");
|
||||
|
||||
if(cljs.core.truth_(or__3548__auto____4721))
|
||||
{return or__3548__auto____4721;
|
||||
} else
|
||||
{return cljs.core._EQ_.call(null,ch__4720,"\r");
|
||||
}
|
||||
})()))
|
||||
{{
|
||||
var G__4722 = (index__4719 - 1);
|
||||
index__4719 = G__4722;
|
||||
continue;
|
||||
}
|
||||
} else
|
||||
{return s.substring(0,index__4719);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
/**
|
||||
* True is s is nil, empty, or contains only whitespace.
|
||||
*/
|
||||
clojure.string.blank_QMARK_ = (function blank_QMARK_(s){
|
||||
var s__4723 = cljs.core.str.call(null,s);
|
||||
|
||||
if(cljs.core.truth_((function (){var or__3548__auto____4724 = cljs.core.not.call(null,s__4723);
|
||||
|
||||
if(cljs.core.truth_(or__3548__auto____4724))
|
||||
{return or__3548__auto____4724;
|
||||
} else
|
||||
{var or__3548__auto____4725 = cljs.core._EQ_.call(null,"",s__4723);
|
||||
|
||||
if(cljs.core.truth_(or__3548__auto____4725))
|
||||
{return or__3548__auto____4725;
|
||||
} else
|
||||
{return cljs.core.re_matches.call(null,/\s+/,s__4723);
|
||||
}
|
||||
}
|
||||
})()))
|
||||
{return true;
|
||||
} else
|
||||
{return false;
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Return a new string, using cmap to escape each character ch
|
||||
* from s as follows:
|
||||
*
|
||||
* If (cmap ch) is nil, append ch to the new string.
|
||||
* If (cmap ch) is non-nil, append (str (cmap ch)) instead.
|
||||
*/
|
||||
clojure.string.escape = (function escape(s,cmap){
|
||||
var buffer__4726 = (new goog.string.StringBuffer());
|
||||
var length__4727 = s.length;
|
||||
|
||||
var index__4728 = 0;
|
||||
|
||||
while(true){
|
||||
if(cljs.core.truth_(cljs.core._EQ_.call(null,length__4727,index__4728)))
|
||||
{return buffer__4726.toString();
|
||||
} else
|
||||
{var ch__4729 = s.charAt(index__4728);
|
||||
|
||||
var temp__3695__auto____4730 = cljs.core.get.call(null,cmap,ch__4729);
|
||||
|
||||
if(cljs.core.truth_(temp__3695__auto____4730))
|
||||
{var replacement__4731 = temp__3695__auto____4730;
|
||||
|
||||
buffer__4726.append(cljs.core.str.call(null,replacement__4731));
|
||||
} else
|
||||
{buffer__4726.append(ch__4729);
|
||||
}
|
||||
{
|
||||
var G__4732 = (index__4728 + 1);
|
||||
index__4728 = G__4732;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
|
@ -6,6 +6,6 @@
|
|||
[net.thegeez/google-closure-library "0.0-1698"]
|
||||
[net.thegeez/clj-browserchannel-server "0.0.4"]
|
||||
[net.thegeez/clj-browserchannel-jetty-adapter "0.0.1"]
|
||||
[net.thegeez/clj-browserchannel-netty-adapter "0.0.1"]
|
||||
#_[net.thegeez/clj-browserchannel-netty-adapter "0.0.1"]
|
||||
]
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(ns chat-demo.core
|
||||
(:require [net.thegeez.browserchannel :as browserchannel]
|
||||
[net.thegeez.jetty-async-adapter :as jetty]
|
||||
[net.thegeez.netty-adapter :as netty]
|
||||
#_[net.thegeez.netty-adapter :as netty]
|
||||
[ring.middleware.resource :as resource]
|
||||
[ring.middleware.file-info :as file]))
|
||||
|
||||
|
|
Reference in a new issue