├── LICENSE.txt
├── MANIFEST.in
├── README.rst
├── dist
├── django-ajax-chat-0.1.tar.gz
└── django-ajax-chat-0.2.tar.gz
├── djangoChat
├── __init__.py
├── admin.py
├── issues.txt
├── models.py
├── static
│ └── djangoChat
│ │ ├── app
│ │ ├── build
│ │ │ └── app.build.js
│ │ └── scripts
│ │ │ ├── channel.js
│ │ │ ├── collections
│ │ │ ├── messages.js
│ │ │ └── users.js
│ │ │ ├── main.js
│ │ │ ├── models
│ │ │ ├── message.js
│ │ │ └── user.js
│ │ │ ├── templates
│ │ │ ├── message.tmpl
│ │ │ └── user.tmpl
│ │ │ ├── vendor
│ │ │ ├── backbone-amd
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ ├── .npmignore
│ │ │ │ ├── .travis.yml
│ │ │ │ └── backbone.js
│ │ │ ├── jquery-legacy
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ └── jquery.js
│ │ │ ├── jquery
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ └── jquery.js
│ │ │ ├── requirejs-text
│ │ │ │ ├── .bower.json
│ │ │ │ └── text.js
│ │ │ ├── requirejs
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ └── require.js
│ │ │ └── underscore-amd
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ ├── .npmignore
│ │ │ │ ├── .travis.yml
│ │ │ │ └── underscore.js
│ │ │ └── views
│ │ │ ├── addMessage.js
│ │ │ ├── message.js
│ │ │ ├── messages.js
│ │ │ ├── user.js
│ │ │ └── users.js
│ │ ├── bower.json
│ │ ├── css
│ │ ├── main.css
│ │ └── normalize.css
│ │ ├── dist
│ │ ├── build.txt
│ │ ├── build
│ │ │ └── app.build.js
│ │ └── scripts
│ │ │ ├── channel.js
│ │ │ ├── collections
│ │ │ ├── messages.js
│ │ │ └── users.js
│ │ │ ├── main.js
│ │ │ ├── models
│ │ │ ├── message.js
│ │ │ └── user.js
│ │ │ ├── templates
│ │ │ ├── message.tmpl
│ │ │ └── user.tmpl
│ │ │ ├── vendor
│ │ │ ├── backbone-amd
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ ├── .npmignore
│ │ │ │ ├── .travis.yml
│ │ │ │ └── backbone.js
│ │ │ ├── jquery-legacy
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ └── jquery.js
│ │ │ ├── jquery
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ └── jquery.js
│ │ │ ├── requirejs-text
│ │ │ │ ├── .bower.json
│ │ │ │ └── text.js
│ │ │ ├── requirejs
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ └── require.js
│ │ │ └── underscore-amd
│ │ │ │ ├── .bower.json
│ │ │ │ ├── .gitignore
│ │ │ │ ├── .npmignore
│ │ │ │ ├── .travis.yml
│ │ │ │ └── underscore.js
│ │ │ └── views
│ │ │ ├── addMessage.js
│ │ │ ├── message.js
│ │ │ ├── messages.js
│ │ │ ├── user.js
│ │ │ └── users.js
│ │ ├── less
│ │ └── main.less
│ │ ├── otherjs
│ │ └── less.js
│ │ └── todo.txt
├── templates
│ └── djangoChat
│ │ ├── base.html
│ │ ├── index.html
│ │ └── login.html
├── tests.py
├── urls.py
└── views.py
├── django_ajax_chat.egg-info
├── PKG-INFO
├── SOURCES.txt
├── dependency_links.txt
└── top_level.txt
└── setup.py
/LICENSE.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sharan01/django-ajax-chat/1ad9575fb90bf100c35a205b21fe60922c026372/LICENSE.txt
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include LICENSE
2 | include README.rst
3 | recursive-include djangoChat/static *
4 | recursive-include djangoChat/templates *
5 |
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | =====
2 | Django Chat
3 | =====
4 |
5 | DjangoChat is a simple Django Chat app
6 |
7 |
8 | demo
9 | ----
10 | http://www.sharan.co/chat/
11 |
12 | Quick start
13 | -----------
14 |
15 | 1. Add "djangoChat" to your INSTALLED_APPS setting like this::
16 |
17 | INSTALLED_APPS = (
18 | ...
19 | 'djangoChat',
20 | )
21 |
22 | 2. Include the polls URLconf in your project urls.py ::
23 |
24 | url(r'^chat/', include('djangoChat.urls')),
25 |
26 | 3. Run `python manage.py syncdb` to create the djangoChat models.
27 |
28 | 4. Start the development server and visit http://127.0.0.1:8000/chat/
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/dist/django-ajax-chat-0.1.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sharan01/django-ajax-chat/1ad9575fb90bf100c35a205b21fe60922c026372/dist/django-ajax-chat-0.1.tar.gz
--------------------------------------------------------------------------------
/dist/django-ajax-chat-0.2.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sharan01/django-ajax-chat/1ad9575fb90bf100c35a205b21fe60922c026372/dist/django-ajax-chat-0.2.tar.gz
--------------------------------------------------------------------------------
/djangoChat/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sharan01/django-ajax-chat/1ad9575fb90bf100c35a205b21fe60922c026372/djangoChat/__init__.py
--------------------------------------------------------------------------------
/djangoChat/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 | from djangoChat.models import Message
3 |
4 |
5 | admin.site.register(Message)
6 | # optional ordering
--------------------------------------------------------------------------------
/djangoChat/issues.txt:
--------------------------------------------------------------------------------
1 | issues
2 | ---------
3 | avatars
4 | encode html for dangerous tags
--------------------------------------------------------------------------------
/djangoChat/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 | from datetime import datetime
3 | from django.contrib.auth.signals import user_logged_in, user_logged_out
4 | from django.contrib.auth.models import User
5 | import urllib, hashlib, binascii
6 |
7 | class Message(models.Model):
8 | user = models.CharField(max_length=200)
9 | message = models.TextField(max_length=200)
10 | time = models.DateTimeField(auto_now_add=True)
11 | gravatar = models.CharField(max_length=300)
12 | def __unicode__(self):
13 | return self.user
14 | # def save(self):
15 | # if self.time == None:
16 | # self.time = datetime.now()
17 | # super(Message, self).save()
18 |
19 |
20 |
21 |
22 | def generate_avatar(email):
23 | a = "http://www.gravatar.com/avatar/"
24 | a+=hashlib.md5(email.lower()).hexdigest()
25 | a+='?d=identicon'
26 | return a
27 | def hash_username(username):
28 | a = binascii.crc32(username)
29 | return a
30 | class ChatUser(models.Model):
31 | user = models.OneToOneField(User)
32 | userID = models.IntegerField()
33 | username = models.CharField(max_length=300)
34 | is_chat_user = models.BooleanField(default=False)
35 | gravatar_url = models.CharField(max_length=300)
36 | last_accessed = models.DateTimeField(auto_now_add=True)
37 |
38 | User.profile = property(lambda u: ChatUser.objects.get_or_create(user=u,defaults={'gravatar_url':generate_avatar(u.email),'username':u.username,'userID':hash_username(u.username)})[0])
39 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/build/app.build.js:
--------------------------------------------------------------------------------
1 | ({
2 | appDir:"../",
3 | baseUrl:"scripts",
4 | dir:"../../dist",
5 | mainConfigFile:"../scripts/main.js",
6 | name:"main",
7 | optimizeCss:"standard"
8 | })
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/channel.js:
--------------------------------------------------------------------------------
1 | define(['backbone'], function (Backbone) {
2 | var channel = _.extend({}, Backbone.Events);
3 | return channel;
4 | });
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/collections/messages.js:
--------------------------------------------------------------------------------
1 | define(['backbone','models/message'],function(Backbone,MsgModel){
2 |
3 | Messages = Backbone.Collection.extend({
4 | model : MsgModel,
5 | url : '/chat/api/'
6 | });
7 |
8 | return Messages;
9 |
10 | });
11 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/collections/users.js:
--------------------------------------------------------------------------------
1 | define(['backbone','models/user'],function(Backbone,usrModel){
2 | return Backbone.Collection.extend({
3 | url:'/chat/api/users/',
4 | model:usrModel
5 | });
6 | });
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/main.js:
--------------------------------------------------------------------------------
1 | require.config({
2 | paths:{
3 | "jquery":"vendor/jquery/jquery",
4 | "underscore":"vendor/underscore-amd/underscore",
5 | "backbone":"vendor/backbone-amd/backbone",
6 | "text":"vendor/requirejs-text/text"
7 | },
8 | urlArgs: "v=" + (new Date()).getTime()
9 | });
10 |
11 | require(['views/messages','views/addMessage','collections/messages', ],function(MsgsView,AddMsg,MsgCollection){
12 |
13 | msgCollec = new MsgCollection(jsonData);
14 | v = new MsgsView({collection:msgCollec});
15 |
16 | a = new AddMsg();
17 | });
18 |
19 | require(['views/users','collections/users'],function(UsersView,UsrCollec){
20 | usrCollec = new UsrCollec();
21 | usersView = new UsersView({collection:usrCollec});
22 |
23 | });
24 |
25 |
26 | setInterval(function(){
27 | msgCollec.fetch({update: true, remove: false});
28 | },2000);
29 | setInterval(function(){
30 | usrCollec.fetch({refresh:true});
31 | console.log('users fetched');
32 | },30000);
33 |
34 |
35 |
36 | require(['jquery'],function($){
37 |
38 | setInterval(function(){
39 | $.get( "/chat/api/users/update/", function( data ) {
40 | console.log("updated");
41 | });
42 | },30000);
43 |
44 |
45 |
46 | });
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/models/message.js:
--------------------------------------------------------------------------------
1 | define(['backbone','jquery'],function(Backbone,$){
2 | Message = Backbone.Model.extend({
3 |
4 | validate: function(attr){
5 | // temporary m so as to not modify attr.msg when jquery trim is called
6 | m = attr.msg;
7 | if($.trim(m) === ''){
8 | return "empty messege";
9 | }
10 | },
11 | initialize: function(){
12 | this.on('invalid',function(model,error){
13 | console.log(error);
14 | });
15 | }
16 | });
17 |
18 | return Message;
19 | });
20 |
21 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/models/user.js:
--------------------------------------------------------------------------------
1 | define(['backbone'],function(){
2 | return Backbone.Model.extend({
3 |
4 | });
5 | });
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/templates/message.tmpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
<%=user%>
6 |
7 |
8 |
9 |
10 | <%=msg%>
11 | <%=time%>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/templates/user.tmpl:
--------------------------------------------------------------------------------
1 |
2 |

3 |
4 |
7 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/backbone-amd/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backbone-amd",
3 | "homepage": "https://github.com/amdjs/backbone",
4 | "version": "1.0.0",
5 | "_release": "1.0.0",
6 | "_resolution": {
7 | "type": "version",
8 | "tag": "1.0.0",
9 | "commit": "df9a95275594eee98cd3d372464ee1467fdb7b1f"
10 | },
11 | "_source": "git://github.com/amdjs/backbone.git",
12 | "_target": "*",
13 | "_originalSource": "backbone-amd"
14 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/backbone-amd/.gitignore:
--------------------------------------------------------------------------------
1 | raw
2 | *.sw?
3 | .DS_Store
4 | node_modules
5 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/backbone-amd/.npmignore:
--------------------------------------------------------------------------------
1 | test/
2 | Rakefile
3 | docs/
4 | raw/
5 | examples/
6 | index.html
7 | .jshintrc
8 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/backbone-amd/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 0.8
4 | notifications:
5 | email: false
6 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/jquery-legacy/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery",
3 | "version": "1.10.2",
4 | "description": "jQuery component",
5 | "keywords": [
6 | "jquery",
7 | "component"
8 | ],
9 | "main": "jquery.js",
10 | "license": "MIT",
11 | "homepage": "https://github.com/components/jquery",
12 | "_release": "1.10.2",
13 | "_resolution": {
14 | "type": "version",
15 | "tag": "1.10.2",
16 | "commit": "6b2390db24ba3490ca75251eec4888f7342bf4da"
17 | },
18 | "_source": "git://github.com/components/jquery.git",
19 | "_target": "1.10",
20 | "_originalSource": "jquery"
21 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/jquery-legacy/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/jquery/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery",
3 | "version": "2.0.3",
4 | "description": "jQuery component",
5 | "keywords": [
6 | "jquery",
7 | "component"
8 | ],
9 | "main": "jquery.js",
10 | "license": "MIT",
11 | "homepage": "https://github.com/components/jquery",
12 | "_release": "2.0.3",
13 | "_resolution": {
14 | "type": "version",
15 | "tag": "2.0.3",
16 | "commit": "452a56b52b8f4a032256cdb8b6838f25f0bdb3d2"
17 | },
18 | "_source": "git://github.com/components/jquery.git",
19 | "_target": "*",
20 | "_originalSource": "jquery"
21 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/jquery/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/requirejs-text/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "requirejs-text",
3 | "homepage": "https://github.com/requirejs/text",
4 | "version": "2.0.10",
5 | "_release": "2.0.10",
6 | "_resolution": {
7 | "type": "version",
8 | "tag": "2.0.10",
9 | "commit": "1592cbf9c7ffd703b36a3af4002e86457b8ab5dd"
10 | },
11 | "_source": "git://github.com/requirejs/text.git",
12 | "_target": "*",
13 | "_originalSource": "requirejs-text"
14 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/requirejs-text/text.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3 | * Available via the MIT or new BSD license.
4 | * see: http://github.com/requirejs/text for details
5 | */
6 | /*jslint regexp: true */
7 | /*global require, XMLHttpRequest, ActiveXObject,
8 | define, window, process, Packages,
9 | java, location, Components, FileUtils */
10 |
11 | define(['module'], function (module) {
12 | 'use strict';
13 |
14 | var text, fs, Cc, Ci, xpcIsWindows,
15 | progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
16 | xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
17 | bodyRegExp = /]*>\s*([\s\S]+)\s*<\/body>/im,
18 | hasLocation = typeof location !== 'undefined' && location.href,
19 | defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''),
20 | defaultHostName = hasLocation && location.hostname,
21 | defaultPort = hasLocation && (location.port || undefined),
22 | buildMap = {},
23 | masterConfig = (module.config && module.config()) || {};
24 |
25 | text = {
26 | version: '2.0.10',
27 |
28 | strip: function (content) {
29 | //Strips declarations so that external SVG and XML
30 | //documents can be added to a document without worry. Also, if the string
31 | //is an HTML document, only the part inside the body tag is returned.
32 | if (content) {
33 | content = content.replace(xmlRegExp, "");
34 | var matches = content.match(bodyRegExp);
35 | if (matches) {
36 | content = matches[1];
37 | }
38 | } else {
39 | content = "";
40 | }
41 | return content;
42 | },
43 |
44 | jsEscape: function (content) {
45 | return content.replace(/(['\\])/g, '\\$1')
46 | .replace(/[\f]/g, "\\f")
47 | .replace(/[\b]/g, "\\b")
48 | .replace(/[\n]/g, "\\n")
49 | .replace(/[\t]/g, "\\t")
50 | .replace(/[\r]/g, "\\r")
51 | .replace(/[\u2028]/g, "\\u2028")
52 | .replace(/[\u2029]/g, "\\u2029");
53 | },
54 |
55 | createXhr: masterConfig.createXhr || function () {
56 | //Would love to dump the ActiveX crap in here. Need IE 6 to die first.
57 | var xhr, i, progId;
58 | if (typeof XMLHttpRequest !== "undefined") {
59 | return new XMLHttpRequest();
60 | } else if (typeof ActiveXObject !== "undefined") {
61 | for (i = 0; i < 3; i += 1) {
62 | progId = progIds[i];
63 | try {
64 | xhr = new ActiveXObject(progId);
65 | } catch (e) {}
66 |
67 | if (xhr) {
68 | progIds = [progId]; // so faster next time
69 | break;
70 | }
71 | }
72 | }
73 |
74 | return xhr;
75 | },
76 |
77 | /**
78 | * Parses a resource name into its component parts. Resource names
79 | * look like: module/name.ext!strip, where the !strip part is
80 | * optional.
81 | * @param {String} name the resource name
82 | * @returns {Object} with properties "moduleName", "ext" and "strip"
83 | * where strip is a boolean.
84 | */
85 | parseName: function (name) {
86 | var modName, ext, temp,
87 | strip = false,
88 | index = name.indexOf("."),
89 | isRelative = name.indexOf('./') === 0 ||
90 | name.indexOf('../') === 0;
91 |
92 | if (index !== -1 && (!isRelative || index > 1)) {
93 | modName = name.substring(0, index);
94 | ext = name.substring(index + 1, name.length);
95 | } else {
96 | modName = name;
97 | }
98 |
99 | temp = ext || modName;
100 | index = temp.indexOf("!");
101 | if (index !== -1) {
102 | //Pull off the strip arg.
103 | strip = temp.substring(index + 1) === "strip";
104 | temp = temp.substring(0, index);
105 | if (ext) {
106 | ext = temp;
107 | } else {
108 | modName = temp;
109 | }
110 | }
111 |
112 | return {
113 | moduleName: modName,
114 | ext: ext,
115 | strip: strip
116 | };
117 | },
118 |
119 | xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
120 |
121 | /**
122 | * Is an URL on another domain. Only works for browser use, returns
123 | * false in non-browser environments. Only used to know if an
124 | * optimized .js version of a text resource should be loaded
125 | * instead.
126 | * @param {String} url
127 | * @returns Boolean
128 | */
129 | useXhr: function (url, protocol, hostname, port) {
130 | var uProtocol, uHostName, uPort,
131 | match = text.xdRegExp.exec(url);
132 | if (!match) {
133 | return true;
134 | }
135 | uProtocol = match[2];
136 | uHostName = match[3];
137 |
138 | uHostName = uHostName.split(':');
139 | uPort = uHostName[1];
140 | uHostName = uHostName[0];
141 |
142 | return (!uProtocol || uProtocol === protocol) &&
143 | (!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
144 | ((!uPort && !uHostName) || uPort === port);
145 | },
146 |
147 | finishLoad: function (name, strip, content, onLoad) {
148 | content = strip ? text.strip(content) : content;
149 | if (masterConfig.isBuild) {
150 | buildMap[name] = content;
151 | }
152 | onLoad(content);
153 | },
154 |
155 | load: function (name, req, onLoad, config) {
156 | //Name has format: some.module.filext!strip
157 | //The strip part is optional.
158 | //if strip is present, then that means only get the string contents
159 | //inside a body tag in an HTML string. For XML/SVG content it means
160 | //removing the declarations so the content can be inserted
161 | //into the current doc without problems.
162 |
163 | // Do not bother with the work if a build and text will
164 | // not be inlined.
165 | if (config.isBuild && !config.inlineText) {
166 | onLoad();
167 | return;
168 | }
169 |
170 | masterConfig.isBuild = config.isBuild;
171 |
172 | var parsed = text.parseName(name),
173 | nonStripName = parsed.moduleName +
174 | (parsed.ext ? '.' + parsed.ext : ''),
175 | url = req.toUrl(nonStripName),
176 | useXhr = (masterConfig.useXhr) ||
177 | text.useXhr;
178 |
179 | // Do not load if it is an empty: url
180 | if (url.indexOf('empty:') === 0) {
181 | onLoad();
182 | return;
183 | }
184 |
185 | //Load the text. Use XHR if possible and in a browser.
186 | if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) {
187 | text.get(url, function (content) {
188 | text.finishLoad(name, parsed.strip, content, onLoad);
189 | }, function (err) {
190 | if (onLoad.error) {
191 | onLoad.error(err);
192 | }
193 | });
194 | } else {
195 | //Need to fetch the resource across domains. Assume
196 | //the resource has been optimized into a JS module. Fetch
197 | //by the module name + extension, but do not include the
198 | //!strip part to avoid file system issues.
199 | req([nonStripName], function (content) {
200 | text.finishLoad(parsed.moduleName + '.' + parsed.ext,
201 | parsed.strip, content, onLoad);
202 | });
203 | }
204 | },
205 |
206 | write: function (pluginName, moduleName, write, config) {
207 | if (buildMap.hasOwnProperty(moduleName)) {
208 | var content = text.jsEscape(buildMap[moduleName]);
209 | write.asModule(pluginName + "!" + moduleName,
210 | "define(function () { return '" +
211 | content +
212 | "';});\n");
213 | }
214 | },
215 |
216 | writeFile: function (pluginName, moduleName, req, write, config) {
217 | var parsed = text.parseName(moduleName),
218 | extPart = parsed.ext ? '.' + parsed.ext : '',
219 | nonStripName = parsed.moduleName + extPart,
220 | //Use a '.js' file name so that it indicates it is a
221 | //script that can be loaded across domains.
222 | fileName = req.toUrl(parsed.moduleName + extPart) + '.js';
223 |
224 | //Leverage own load() method to load plugin value, but only
225 | //write out values that do not have the strip argument,
226 | //to avoid any potential issues with ! in file names.
227 | text.load(nonStripName, req, function (value) {
228 | //Use own write() method to construct full module value.
229 | //But need to create shell that translates writeFile's
230 | //write() to the right interface.
231 | var textWrite = function (contents) {
232 | return write(fileName, contents);
233 | };
234 | textWrite.asModule = function (moduleName, contents) {
235 | return write.asModule(moduleName, fileName, contents);
236 | };
237 |
238 | text.write(pluginName, nonStripName, textWrite, config);
239 | }, config);
240 | }
241 | };
242 |
243 | if (masterConfig.env === 'node' || (!masterConfig.env &&
244 | typeof process !== "undefined" &&
245 | process.versions &&
246 | !!process.versions.node &&
247 | !process.versions['node-webkit'])) {
248 | //Using special require.nodeRequire, something added by r.js.
249 | fs = require.nodeRequire('fs');
250 |
251 | text.get = function (url, callback, errback) {
252 | try {
253 | var file = fs.readFileSync(url, 'utf8');
254 | //Remove BOM (Byte Mark Order) from utf8 files if it is there.
255 | if (file.indexOf('\uFEFF') === 0) {
256 | file = file.substring(1);
257 | }
258 | callback(file);
259 | } catch (e) {
260 | errback(e);
261 | }
262 | };
263 | } else if (masterConfig.env === 'xhr' || (!masterConfig.env &&
264 | text.createXhr())) {
265 | text.get = function (url, callback, errback, headers) {
266 | var xhr = text.createXhr(), header;
267 | xhr.open('GET', url, true);
268 |
269 | //Allow plugins direct access to xhr headers
270 | if (headers) {
271 | for (header in headers) {
272 | if (headers.hasOwnProperty(header)) {
273 | xhr.setRequestHeader(header.toLowerCase(), headers[header]);
274 | }
275 | }
276 | }
277 |
278 | //Allow overrides specified in config
279 | if (masterConfig.onXhr) {
280 | masterConfig.onXhr(xhr, url);
281 | }
282 |
283 | xhr.onreadystatechange = function (evt) {
284 | var status, err;
285 | //Do not explicitly handle errors, those should be
286 | //visible via console output in the browser.
287 | if (xhr.readyState === 4) {
288 | status = xhr.status;
289 | if (status > 399 && status < 600) {
290 | //An http 4xx or 5xx error. Signal an error.
291 | err = new Error(url + ' HTTP status: ' + status);
292 | err.xhr = xhr;
293 | errback(err);
294 | } else {
295 | callback(xhr.responseText);
296 | }
297 |
298 | if (masterConfig.onXhrComplete) {
299 | masterConfig.onXhrComplete(xhr, url);
300 | }
301 | }
302 | };
303 | xhr.send(null);
304 | };
305 | } else if (masterConfig.env === 'rhino' || (!masterConfig.env &&
306 | typeof Packages !== 'undefined' && typeof java !== 'undefined')) {
307 | //Why Java, why is this so awkward?
308 | text.get = function (url, callback) {
309 | var stringBuffer, line,
310 | encoding = "utf-8",
311 | file = new java.io.File(url),
312 | lineSeparator = java.lang.System.getProperty("line.separator"),
313 | input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
314 | content = '';
315 | try {
316 | stringBuffer = new java.lang.StringBuffer();
317 | line = input.readLine();
318 |
319 | // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
320 | // http://www.unicode.org/faq/utf_bom.html
321 |
322 | // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
323 | // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
324 | if (line && line.length() && line.charAt(0) === 0xfeff) {
325 | // Eat the BOM, since we've already found the encoding on this file,
326 | // and we plan to concatenating this buffer with others; the BOM should
327 | // only appear at the top of a file.
328 | line = line.substring(1);
329 | }
330 |
331 | if (line !== null) {
332 | stringBuffer.append(line);
333 | }
334 |
335 | while ((line = input.readLine()) !== null) {
336 | stringBuffer.append(lineSeparator);
337 | stringBuffer.append(line);
338 | }
339 | //Make sure we return a JavaScript string and not a Java string.
340 | content = String(stringBuffer.toString()); //String
341 | } finally {
342 | input.close();
343 | }
344 | callback(content);
345 | };
346 | } else if (masterConfig.env === 'xpconnect' || (!masterConfig.env &&
347 | typeof Components !== 'undefined' && Components.classes &&
348 | Components.interfaces)) {
349 | //Avert your gaze!
350 | Cc = Components.classes,
351 | Ci = Components.interfaces;
352 | Components.utils['import']('resource://gre/modules/FileUtils.jsm');
353 | xpcIsWindows = ('@mozilla.org/windows-registry-key;1' in Cc);
354 |
355 | text.get = function (url, callback) {
356 | var inStream, convertStream, fileObj,
357 | readData = {};
358 |
359 | if (xpcIsWindows) {
360 | url = url.replace(/\//g, '\\');
361 | }
362 |
363 | fileObj = new FileUtils.File(url);
364 |
365 | //XPCOM, you so crazy
366 | try {
367 | inStream = Cc['@mozilla.org/network/file-input-stream;1']
368 | .createInstance(Ci.nsIFileInputStream);
369 | inStream.init(fileObj, 1, 0, false);
370 |
371 | convertStream = Cc['@mozilla.org/intl/converter-input-stream;1']
372 | .createInstance(Ci.nsIConverterInputStream);
373 | convertStream.init(inStream, "utf-8", inStream.available(),
374 | Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
375 |
376 | convertStream.readString(inStream.available(), readData);
377 | convertStream.close();
378 | inStream.close();
379 | callback(readData.value);
380 | } catch (e) {
381 | throw new Error((fileObj && fileObj.path || '') + ': ' + e);
382 | }
383 | };
384 | }
385 | return text;
386 | });
387 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/requirejs/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "requirejs",
3 | "homepage": "https://github.com/jrburke/requirejs",
4 | "version": "2.1.8",
5 | "_release": "2.1.8",
6 | "_resolution": {
7 | "type": "version",
8 | "tag": "2.1.8",
9 | "commit": "2b083dbb358e8c1876b059434d4b571d8f87534a"
10 | },
11 | "_source": "git://github.com/jrburke/requirejs.git",
12 | "_target": "*",
13 | "_originalSource": "requirejs"
14 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/requirejs/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | docs/jquery-require-sample/webapp-build/
3 | docs/jquery-require-sample/dist
4 | dist/dist-site/
5 | dist/dist-build/
6 | shrinktest.sh
7 | tests/layers/allplugins-require.js
8 | tests/packages/optimizing/built/
9 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "underscore-amd",
3 | "homepage": "https://github.com/amdjs/underscore",
4 | "version": "1.5.1",
5 | "_release": "1.5.1",
6 | "_resolution": {
7 | "type": "version",
8 | "tag": "1.5.1",
9 | "commit": "569cb933afaf17d1a0874a62fb4b47fc793e824a"
10 | },
11 | "_source": "git://github.com/amdjs/underscore.git",
12 | "_target": "*",
13 | "_originalSource": "underscore-amd"
14 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/.gitignore:
--------------------------------------------------------------------------------
1 | raw
2 | node_modules
3 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/.npmignore:
--------------------------------------------------------------------------------
1 | test/
2 | Rakefile
3 | docs/
4 | raw/
5 | index.html
6 | underscore-min.js
7 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 0.8
4 | notifications:
5 | email: false
6 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/underscore.js:
--------------------------------------------------------------------------------
1 | // Underscore.js 1.5.1
2 | // http://underscorejs.org
3 | // (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4 | // Underscore may be freely distributed under the MIT license.
5 |
6 | (function() {
7 |
8 | // Baseline setup
9 | // --------------
10 |
11 | // Establish the root object, `window` in the browser, or `global` on the server.
12 | var root = this;
13 |
14 | // Save the previous value of the `_` variable.
15 | var previousUnderscore = root._;
16 |
17 | // Establish the object that gets returned to break out of a loop iteration.
18 | var breaker = {};
19 |
20 | // Save bytes in the minified (but not gzipped) version:
21 | var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
22 |
23 | // Create quick reference variables for speed access to core prototypes.
24 | var
25 | push = ArrayProto.push,
26 | slice = ArrayProto.slice,
27 | concat = ArrayProto.concat,
28 | toString = ObjProto.toString,
29 | hasOwnProperty = ObjProto.hasOwnProperty;
30 |
31 | // All **ECMAScript 5** native function implementations that we hope to use
32 | // are declared here.
33 | var
34 | nativeForEach = ArrayProto.forEach,
35 | nativeMap = ArrayProto.map,
36 | nativeReduce = ArrayProto.reduce,
37 | nativeReduceRight = ArrayProto.reduceRight,
38 | nativeFilter = ArrayProto.filter,
39 | nativeEvery = ArrayProto.every,
40 | nativeSome = ArrayProto.some,
41 | nativeIndexOf = ArrayProto.indexOf,
42 | nativeLastIndexOf = ArrayProto.lastIndexOf,
43 | nativeIsArray = Array.isArray,
44 | nativeKeys = Object.keys,
45 | nativeBind = FuncProto.bind;
46 |
47 | // Create a safe reference to the Underscore object for use below.
48 | var _ = function(obj) {
49 | if (obj instanceof _) return obj;
50 | if (!(this instanceof _)) return new _(obj);
51 | this._wrapped = obj;
52 | };
53 |
54 | // Export the Underscore object for **Node.js**, with
55 | // backwards-compatibility for the old `require()` API. If we're in
56 | // the browser, add `_` as a global object via a string identifier,
57 | // for Closure Compiler "advanced" mode.
58 | if (typeof exports !== 'undefined') {
59 | if (typeof module !== 'undefined' && module.exports) {
60 | exports = module.exports = _;
61 | }
62 | exports._ = _;
63 | } else {
64 | root._ = _;
65 | }
66 |
67 | // Current version.
68 | _.VERSION = '1.5.1';
69 |
70 | // Collection Functions
71 | // --------------------
72 |
73 | // The cornerstone, an `each` implementation, aka `forEach`.
74 | // Handles objects with the built-in `forEach`, arrays, and raw objects.
75 | // Delegates to **ECMAScript 5**'s native `forEach` if available.
76 | var each = _.each = _.forEach = function(obj, iterator, context) {
77 | if (obj == null) return;
78 | if (nativeForEach && obj.forEach === nativeForEach) {
79 | obj.forEach(iterator, context);
80 | } else if (obj.length === +obj.length) {
81 | for (var i = 0, l = obj.length; i < l; i++) {
82 | if (iterator.call(context, obj[i], i, obj) === breaker) return;
83 | }
84 | } else {
85 | for (var key in obj) {
86 | if (_.has(obj, key)) {
87 | if (iterator.call(context, obj[key], key, obj) === breaker) return;
88 | }
89 | }
90 | }
91 | };
92 |
93 | // Return the results of applying the iterator to each element.
94 | // Delegates to **ECMAScript 5**'s native `map` if available.
95 | _.map = _.collect = function(obj, iterator, context) {
96 | var results = [];
97 | if (obj == null) return results;
98 | if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
99 | each(obj, function(value, index, list) {
100 | results.push(iterator.call(context, value, index, list));
101 | });
102 | return results;
103 | };
104 |
105 | var reduceError = 'Reduce of empty array with no initial value';
106 |
107 | // **Reduce** builds up a single result from a list of values, aka `inject`,
108 | // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
109 | _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
110 | var initial = arguments.length > 2;
111 | if (obj == null) obj = [];
112 | if (nativeReduce && obj.reduce === nativeReduce) {
113 | if (context) iterator = _.bind(iterator, context);
114 | return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
115 | }
116 | each(obj, function(value, index, list) {
117 | if (!initial) {
118 | memo = value;
119 | initial = true;
120 | } else {
121 | memo = iterator.call(context, memo, value, index, list);
122 | }
123 | });
124 | if (!initial) throw new TypeError(reduceError);
125 | return memo;
126 | };
127 |
128 | // The right-associative version of reduce, also known as `foldr`.
129 | // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
130 | _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
131 | var initial = arguments.length > 2;
132 | if (obj == null) obj = [];
133 | if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
134 | if (context) iterator = _.bind(iterator, context);
135 | return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
136 | }
137 | var length = obj.length;
138 | if (length !== +length) {
139 | var keys = _.keys(obj);
140 | length = keys.length;
141 | }
142 | each(obj, function(value, index, list) {
143 | index = keys ? keys[--length] : --length;
144 | if (!initial) {
145 | memo = obj[index];
146 | initial = true;
147 | } else {
148 | memo = iterator.call(context, memo, obj[index], index, list);
149 | }
150 | });
151 | if (!initial) throw new TypeError(reduceError);
152 | return memo;
153 | };
154 |
155 | // Return the first value which passes a truth test. Aliased as `detect`.
156 | _.find = _.detect = function(obj, iterator, context) {
157 | var result;
158 | any(obj, function(value, index, list) {
159 | if (iterator.call(context, value, index, list)) {
160 | result = value;
161 | return true;
162 | }
163 | });
164 | return result;
165 | };
166 |
167 | // Return all the elements that pass a truth test.
168 | // Delegates to **ECMAScript 5**'s native `filter` if available.
169 | // Aliased as `select`.
170 | _.filter = _.select = function(obj, iterator, context) {
171 | var results = [];
172 | if (obj == null) return results;
173 | if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
174 | each(obj, function(value, index, list) {
175 | if (iterator.call(context, value, index, list)) results.push(value);
176 | });
177 | return results;
178 | };
179 |
180 | // Return all the elements for which a truth test fails.
181 | _.reject = function(obj, iterator, context) {
182 | return _.filter(obj, function(value, index, list) {
183 | return !iterator.call(context, value, index, list);
184 | }, context);
185 | };
186 |
187 | // Determine whether all of the elements match a truth test.
188 | // Delegates to **ECMAScript 5**'s native `every` if available.
189 | // Aliased as `all`.
190 | _.every = _.all = function(obj, iterator, context) {
191 | iterator || (iterator = _.identity);
192 | var result = true;
193 | if (obj == null) return result;
194 | if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
195 | each(obj, function(value, index, list) {
196 | if (!(result = result && iterator.call(context, value, index, list))) return breaker;
197 | });
198 | return !!result;
199 | };
200 |
201 | // Determine if at least one element in the object matches a truth test.
202 | // Delegates to **ECMAScript 5**'s native `some` if available.
203 | // Aliased as `any`.
204 | var any = _.some = _.any = function(obj, iterator, context) {
205 | iterator || (iterator = _.identity);
206 | var result = false;
207 | if (obj == null) return result;
208 | if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
209 | each(obj, function(value, index, list) {
210 | if (result || (result = iterator.call(context, value, index, list))) return breaker;
211 | });
212 | return !!result;
213 | };
214 |
215 | // Determine if the array or object contains a given value (using `===`).
216 | // Aliased as `include`.
217 | _.contains = _.include = function(obj, target) {
218 | if (obj == null) return false;
219 | if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
220 | return any(obj, function(value) {
221 | return value === target;
222 | });
223 | };
224 |
225 | // Invoke a method (with arguments) on every item in a collection.
226 | _.invoke = function(obj, method) {
227 | var args = slice.call(arguments, 2);
228 | var isFunc = _.isFunction(method);
229 | return _.map(obj, function(value) {
230 | return (isFunc ? method : value[method]).apply(value, args);
231 | });
232 | };
233 |
234 | // Convenience version of a common use case of `map`: fetching a property.
235 | _.pluck = function(obj, key) {
236 | return _.map(obj, function(value){ return value[key]; });
237 | };
238 |
239 | // Convenience version of a common use case of `filter`: selecting only objects
240 | // containing specific `key:value` pairs.
241 | _.where = function(obj, attrs, first) {
242 | if (_.isEmpty(attrs)) return first ? void 0 : [];
243 | return _[first ? 'find' : 'filter'](obj, function(value) {
244 | for (var key in attrs) {
245 | if (attrs[key] !== value[key]) return false;
246 | }
247 | return true;
248 | });
249 | };
250 |
251 | // Convenience version of a common use case of `find`: getting the first object
252 | // containing specific `key:value` pairs.
253 | _.findWhere = function(obj, attrs) {
254 | return _.where(obj, attrs, true);
255 | };
256 |
257 | // Return the maximum element or (element-based computation).
258 | // Can't optimize arrays of integers longer than 65,535 elements.
259 | // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
260 | _.max = function(obj, iterator, context) {
261 | if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
262 | return Math.max.apply(Math, obj);
263 | }
264 | if (!iterator && _.isEmpty(obj)) return -Infinity;
265 | var result = {computed : -Infinity, value: -Infinity};
266 | each(obj, function(value, index, list) {
267 | var computed = iterator ? iterator.call(context, value, index, list) : value;
268 | computed > result.computed && (result = {value : value, computed : computed});
269 | });
270 | return result.value;
271 | };
272 |
273 | // Return the minimum element (or element-based computation).
274 | _.min = function(obj, iterator, context) {
275 | if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
276 | return Math.min.apply(Math, obj);
277 | }
278 | if (!iterator && _.isEmpty(obj)) return Infinity;
279 | var result = {computed : Infinity, value: Infinity};
280 | each(obj, function(value, index, list) {
281 | var computed = iterator ? iterator.call(context, value, index, list) : value;
282 | computed < result.computed && (result = {value : value, computed : computed});
283 | });
284 | return result.value;
285 | };
286 |
287 | // Shuffle an array.
288 | _.shuffle = function(obj) {
289 | var rand;
290 | var index = 0;
291 | var shuffled = [];
292 | each(obj, function(value) {
293 | rand = _.random(index++);
294 | shuffled[index - 1] = shuffled[rand];
295 | shuffled[rand] = value;
296 | });
297 | return shuffled;
298 | };
299 |
300 | // An internal function to generate lookup iterators.
301 | var lookupIterator = function(value) {
302 | return _.isFunction(value) ? value : function(obj){ return obj[value]; };
303 | };
304 |
305 | // Sort the object's values by a criterion produced by an iterator.
306 | _.sortBy = function(obj, value, context) {
307 | var iterator = lookupIterator(value);
308 | return _.pluck(_.map(obj, function(value, index, list) {
309 | return {
310 | value : value,
311 | index : index,
312 | criteria : iterator.call(context, value, index, list)
313 | };
314 | }).sort(function(left, right) {
315 | var a = left.criteria;
316 | var b = right.criteria;
317 | if (a !== b) {
318 | if (a > b || a === void 0) return 1;
319 | if (a < b || b === void 0) return -1;
320 | }
321 | return left.index < right.index ? -1 : 1;
322 | }), 'value');
323 | };
324 |
325 | // An internal function used for aggregate "group by" operations.
326 | var group = function(obj, value, context, behavior) {
327 | var result = {};
328 | var iterator = lookupIterator(value == null ? _.identity : value);
329 | each(obj, function(value, index) {
330 | var key = iterator.call(context, value, index, obj);
331 | behavior(result, key, value);
332 | });
333 | return result;
334 | };
335 |
336 | // Groups the object's values by a criterion. Pass either a string attribute
337 | // to group by, or a function that returns the criterion.
338 | _.groupBy = function(obj, value, context) {
339 | return group(obj, value, context, function(result, key, value) {
340 | (_.has(result, key) ? result[key] : (result[key] = [])).push(value);
341 | });
342 | };
343 |
344 | // Counts instances of an object that group by a certain criterion. Pass
345 | // either a string attribute to count by, or a function that returns the
346 | // criterion.
347 | _.countBy = function(obj, value, context) {
348 | return group(obj, value, context, function(result, key) {
349 | if (!_.has(result, key)) result[key] = 0;
350 | result[key]++;
351 | });
352 | };
353 |
354 | // Use a comparator function to figure out the smallest index at which
355 | // an object should be inserted so as to maintain order. Uses binary search.
356 | _.sortedIndex = function(array, obj, iterator, context) {
357 | iterator = iterator == null ? _.identity : lookupIterator(iterator);
358 | var value = iterator.call(context, obj);
359 | var low = 0, high = array.length;
360 | while (low < high) {
361 | var mid = (low + high) >>> 1;
362 | iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
363 | }
364 | return low;
365 | };
366 |
367 | // Safely create a real, live array from anything iterable.
368 | _.toArray = function(obj) {
369 | if (!obj) return [];
370 | if (_.isArray(obj)) return slice.call(obj);
371 | if (obj.length === +obj.length) return _.map(obj, _.identity);
372 | return _.values(obj);
373 | };
374 |
375 | // Return the number of elements in an object.
376 | _.size = function(obj) {
377 | if (obj == null) return 0;
378 | return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
379 | };
380 |
381 | // Array Functions
382 | // ---------------
383 |
384 | // Get the first element of an array. Passing **n** will return the first N
385 | // values in the array. Aliased as `head` and `take`. The **guard** check
386 | // allows it to work with `_.map`.
387 | _.first = _.head = _.take = function(array, n, guard) {
388 | if (array == null) return void 0;
389 | return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
390 | };
391 |
392 | // Returns everything but the last entry of the array. Especially useful on
393 | // the arguments object. Passing **n** will return all the values in
394 | // the array, excluding the last N. The **guard** check allows it to work with
395 | // `_.map`.
396 | _.initial = function(array, n, guard) {
397 | return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
398 | };
399 |
400 | // Get the last element of an array. Passing **n** will return the last N
401 | // values in the array. The **guard** check allows it to work with `_.map`.
402 | _.last = function(array, n, guard) {
403 | if (array == null) return void 0;
404 | if ((n != null) && !guard) {
405 | return slice.call(array, Math.max(array.length - n, 0));
406 | } else {
407 | return array[array.length - 1];
408 | }
409 | };
410 |
411 | // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
412 | // Especially useful on the arguments object. Passing an **n** will return
413 | // the rest N values in the array. The **guard**
414 | // check allows it to work with `_.map`.
415 | _.rest = _.tail = _.drop = function(array, n, guard) {
416 | return slice.call(array, (n == null) || guard ? 1 : n);
417 | };
418 |
419 | // Trim out all falsy values from an array.
420 | _.compact = function(array) {
421 | return _.filter(array, _.identity);
422 | };
423 |
424 | // Internal implementation of a recursive `flatten` function.
425 | var flatten = function(input, shallow, output) {
426 | if (shallow && _.every(input, _.isArray)) {
427 | return concat.apply(output, input);
428 | }
429 | each(input, function(value) {
430 | if (_.isArray(value) || _.isArguments(value)) {
431 | shallow ? push.apply(output, value) : flatten(value, shallow, output);
432 | } else {
433 | output.push(value);
434 | }
435 | });
436 | return output;
437 | };
438 |
439 | // Return a completely flattened version of an array.
440 | _.flatten = function(array, shallow) {
441 | return flatten(array, shallow, []);
442 | };
443 |
444 | // Return a version of the array that does not contain the specified value(s).
445 | _.without = function(array) {
446 | return _.difference(array, slice.call(arguments, 1));
447 | };
448 |
449 | // Produce a duplicate-free version of the array. If the array has already
450 | // been sorted, you have the option of using a faster algorithm.
451 | // Aliased as `unique`.
452 | _.uniq = _.unique = function(array, isSorted, iterator, context) {
453 | if (_.isFunction(isSorted)) {
454 | context = iterator;
455 | iterator = isSorted;
456 | isSorted = false;
457 | }
458 | var initial = iterator ? _.map(array, iterator, context) : array;
459 | var results = [];
460 | var seen = [];
461 | each(initial, function(value, index) {
462 | if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) {
463 | seen.push(value);
464 | results.push(array[index]);
465 | }
466 | });
467 | return results;
468 | };
469 |
470 | // Produce an array that contains the union: each distinct element from all of
471 | // the passed-in arrays.
472 | _.union = function() {
473 | return _.uniq(_.flatten(arguments, true));
474 | };
475 |
476 | // Produce an array that contains every item shared between all the
477 | // passed-in arrays.
478 | _.intersection = function(array) {
479 | var rest = slice.call(arguments, 1);
480 | return _.filter(_.uniq(array), function(item) {
481 | return _.every(rest, function(other) {
482 | return _.indexOf(other, item) >= 0;
483 | });
484 | });
485 | };
486 |
487 | // Take the difference between one array and a number of other arrays.
488 | // Only the elements present in just the first array will remain.
489 | _.difference = function(array) {
490 | var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
491 | return _.filter(array, function(value){ return !_.contains(rest, value); });
492 | };
493 |
494 | // Zip together multiple lists into a single array -- elements that share
495 | // an index go together.
496 | _.zip = function() {
497 | var length = _.max(_.pluck(arguments, "length").concat(0));
498 | var results = new Array(length);
499 | for (var i = 0; i < length; i++) {
500 | results[i] = _.pluck(arguments, '' + i);
501 | }
502 | return results;
503 | };
504 |
505 | // Converts lists into objects. Pass either a single array of `[key, value]`
506 | // pairs, or two parallel arrays of the same length -- one of keys, and one of
507 | // the corresponding values.
508 | _.object = function(list, values) {
509 | if (list == null) return {};
510 | var result = {};
511 | for (var i = 0, l = list.length; i < l; i++) {
512 | if (values) {
513 | result[list[i]] = values[i];
514 | } else {
515 | result[list[i][0]] = list[i][1];
516 | }
517 | }
518 | return result;
519 | };
520 |
521 | // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
522 | // we need this function. Return the position of the first occurrence of an
523 | // item in an array, or -1 if the item is not included in the array.
524 | // Delegates to **ECMAScript 5**'s native `indexOf` if available.
525 | // If the array is large and already in sort order, pass `true`
526 | // for **isSorted** to use binary search.
527 | _.indexOf = function(array, item, isSorted) {
528 | if (array == null) return -1;
529 | var i = 0, l = array.length;
530 | if (isSorted) {
531 | if (typeof isSorted == 'number') {
532 | i = (isSorted < 0 ? Math.max(0, l + isSorted) : isSorted);
533 | } else {
534 | i = _.sortedIndex(array, item);
535 | return array[i] === item ? i : -1;
536 | }
537 | }
538 | if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
539 | for (; i < l; i++) if (array[i] === item) return i;
540 | return -1;
541 | };
542 |
543 | // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
544 | _.lastIndexOf = function(array, item, from) {
545 | if (array == null) return -1;
546 | var hasIndex = from != null;
547 | if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
548 | return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
549 | }
550 | var i = (hasIndex ? from : array.length);
551 | while (i--) if (array[i] === item) return i;
552 | return -1;
553 | };
554 |
555 | // Generate an integer Array containing an arithmetic progression. A port of
556 | // the native Python `range()` function. See
557 | // [the Python documentation](http://docs.python.org/library/functions.html#range).
558 | _.range = function(start, stop, step) {
559 | if (arguments.length <= 1) {
560 | stop = start || 0;
561 | start = 0;
562 | }
563 | step = arguments[2] || 1;
564 |
565 | var len = Math.max(Math.ceil((stop - start) / step), 0);
566 | var idx = 0;
567 | var range = new Array(len);
568 |
569 | while(idx < len) {
570 | range[idx++] = start;
571 | start += step;
572 | }
573 |
574 | return range;
575 | };
576 |
577 | // Function (ahem) Functions
578 | // ------------------
579 |
580 | // Reusable constructor function for prototype setting.
581 | var ctor = function(){};
582 |
583 | // Create a function bound to a given object (assigning `this`, and arguments,
584 | // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
585 | // available.
586 | _.bind = function(func, context) {
587 | var args, bound;
588 | if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
589 | if (!_.isFunction(func)) throw new TypeError;
590 | args = slice.call(arguments, 2);
591 | return bound = function() {
592 | if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
593 | ctor.prototype = func.prototype;
594 | var self = new ctor;
595 | ctor.prototype = null;
596 | var result = func.apply(self, args.concat(slice.call(arguments)));
597 | if (Object(result) === result) return result;
598 | return self;
599 | };
600 | };
601 |
602 | // Partially apply a function by creating a version that has had some of its
603 | // arguments pre-filled, without changing its dynamic `this` context.
604 | _.partial = function(func) {
605 | var args = slice.call(arguments, 1);
606 | return function() {
607 | return func.apply(this, args.concat(slice.call(arguments)));
608 | };
609 | };
610 |
611 | // Bind all of an object's methods to that object. Useful for ensuring that
612 | // all callbacks defined on an object belong to it.
613 | _.bindAll = function(obj) {
614 | var funcs = slice.call(arguments, 1);
615 | if (funcs.length === 0) throw new Error("bindAll must be passed function names");
616 | each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
617 | return obj;
618 | };
619 |
620 | // Memoize an expensive function by storing its results.
621 | _.memoize = function(func, hasher) {
622 | var memo = {};
623 | hasher || (hasher = _.identity);
624 | return function() {
625 | var key = hasher.apply(this, arguments);
626 | return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
627 | };
628 | };
629 |
630 | // Delays a function for the given number of milliseconds, and then calls
631 | // it with the arguments supplied.
632 | _.delay = function(func, wait) {
633 | var args = slice.call(arguments, 2);
634 | return setTimeout(function(){ return func.apply(null, args); }, wait);
635 | };
636 |
637 | // Defers a function, scheduling it to run after the current call stack has
638 | // cleared.
639 | _.defer = function(func) {
640 | return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
641 | };
642 |
643 | // Returns a function, that, when invoked, will only be triggered at most once
644 | // during a given window of time. Normally, the throttled function will run
645 | // as much as it can, without ever going more than once per `wait` duration;
646 | // but if you'd like to disable the execution on the leading edge, pass
647 | // `{leading: false}`. To disable execution on the trailing edge, ditto.
648 | _.throttle = function(func, wait, options) {
649 | var context, args, result;
650 | var timeout = null;
651 | var previous = 0;
652 | options || (options = {});
653 | var later = function() {
654 | previous = options.leading === false ? 0 : new Date;
655 | timeout = null;
656 | result = func.apply(context, args);
657 | };
658 | return function() {
659 | var now = new Date;
660 | if (!previous && options.leading === false) previous = now;
661 | var remaining = wait - (now - previous);
662 | context = this;
663 | args = arguments;
664 | if (remaining <= 0) {
665 | clearTimeout(timeout);
666 | timeout = null;
667 | previous = now;
668 | result = func.apply(context, args);
669 | } else if (!timeout && options.trailing !== false) {
670 | timeout = setTimeout(later, remaining);
671 | }
672 | return result;
673 | };
674 | };
675 |
676 | // Returns a function, that, as long as it continues to be invoked, will not
677 | // be triggered. The function will be called after it stops being called for
678 | // N milliseconds. If `immediate` is passed, trigger the function on the
679 | // leading edge, instead of the trailing.
680 | _.debounce = function(func, wait, immediate) {
681 | var result;
682 | var timeout = null;
683 | return function() {
684 | var context = this, args = arguments;
685 | var later = function() {
686 | timeout = null;
687 | if (!immediate) result = func.apply(context, args);
688 | };
689 | var callNow = immediate && !timeout;
690 | clearTimeout(timeout);
691 | timeout = setTimeout(later, wait);
692 | if (callNow) result = func.apply(context, args);
693 | return result;
694 | };
695 | };
696 |
697 | // Returns a function that will be executed at most one time, no matter how
698 | // often you call it. Useful for lazy initialization.
699 | _.once = function(func) {
700 | var ran = false, memo;
701 | return function() {
702 | if (ran) return memo;
703 | ran = true;
704 | memo = func.apply(this, arguments);
705 | func = null;
706 | return memo;
707 | };
708 | };
709 |
710 | // Returns the first function passed as an argument to the second,
711 | // allowing you to adjust arguments, run code before and after, and
712 | // conditionally execute the original function.
713 | _.wrap = function(func, wrapper) {
714 | return function() {
715 | var args = [func];
716 | push.apply(args, arguments);
717 | return wrapper.apply(this, args);
718 | };
719 | };
720 |
721 | // Returns a function that is the composition of a list of functions, each
722 | // consuming the return value of the function that follows.
723 | _.compose = function() {
724 | var funcs = arguments;
725 | return function() {
726 | var args = arguments;
727 | for (var i = funcs.length - 1; i >= 0; i--) {
728 | args = [funcs[i].apply(this, args)];
729 | }
730 | return args[0];
731 | };
732 | };
733 |
734 | // Returns a function that will only be executed after being called N times.
735 | _.after = function(times, func) {
736 | return function() {
737 | if (--times < 1) {
738 | return func.apply(this, arguments);
739 | }
740 | };
741 | };
742 |
743 | // Object Functions
744 | // ----------------
745 |
746 | // Retrieve the names of an object's properties.
747 | // Delegates to **ECMAScript 5**'s native `Object.keys`
748 | _.keys = nativeKeys || function(obj) {
749 | if (obj !== Object(obj)) throw new TypeError('Invalid object');
750 | var keys = [];
751 | for (var key in obj) if (_.has(obj, key)) keys.push(key);
752 | return keys;
753 | };
754 |
755 | // Retrieve the values of an object's properties.
756 | _.values = function(obj) {
757 | var values = [];
758 | for (var key in obj) if (_.has(obj, key)) values.push(obj[key]);
759 | return values;
760 | };
761 |
762 | // Convert an object into a list of `[key, value]` pairs.
763 | _.pairs = function(obj) {
764 | var pairs = [];
765 | for (var key in obj) if (_.has(obj, key)) pairs.push([key, obj[key]]);
766 | return pairs;
767 | };
768 |
769 | // Invert the keys and values of an object. The values must be serializable.
770 | _.invert = function(obj) {
771 | var result = {};
772 | for (var key in obj) if (_.has(obj, key)) result[obj[key]] = key;
773 | return result;
774 | };
775 |
776 | // Return a sorted list of the function names available on the object.
777 | // Aliased as `methods`
778 | _.functions = _.methods = function(obj) {
779 | var names = [];
780 | for (var key in obj) {
781 | if (_.isFunction(obj[key])) names.push(key);
782 | }
783 | return names.sort();
784 | };
785 |
786 | // Extend a given object with all the properties in passed-in object(s).
787 | _.extend = function(obj) {
788 | each(slice.call(arguments, 1), function(source) {
789 | if (source) {
790 | for (var prop in source) {
791 | obj[prop] = source[prop];
792 | }
793 | }
794 | });
795 | return obj;
796 | };
797 |
798 | // Return a copy of the object only containing the whitelisted properties.
799 | _.pick = function(obj) {
800 | var copy = {};
801 | var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
802 | each(keys, function(key) {
803 | if (key in obj) copy[key] = obj[key];
804 | });
805 | return copy;
806 | };
807 |
808 | // Return a copy of the object without the blacklisted properties.
809 | _.omit = function(obj) {
810 | var copy = {};
811 | var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
812 | for (var key in obj) {
813 | if (!_.contains(keys, key)) copy[key] = obj[key];
814 | }
815 | return copy;
816 | };
817 |
818 | // Fill in a given object with default properties.
819 | _.defaults = function(obj) {
820 | each(slice.call(arguments, 1), function(source) {
821 | if (source) {
822 | for (var prop in source) {
823 | if (obj[prop] === void 0) obj[prop] = source[prop];
824 | }
825 | }
826 | });
827 | return obj;
828 | };
829 |
830 | // Create a (shallow-cloned) duplicate of an object.
831 | _.clone = function(obj) {
832 | if (!_.isObject(obj)) return obj;
833 | return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
834 | };
835 |
836 | // Invokes interceptor with the obj, and then returns obj.
837 | // The primary purpose of this method is to "tap into" a method chain, in
838 | // order to perform operations on intermediate results within the chain.
839 | _.tap = function(obj, interceptor) {
840 | interceptor(obj);
841 | return obj;
842 | };
843 |
844 | // Internal recursive comparison function for `isEqual`.
845 | var eq = function(a, b, aStack, bStack) {
846 | // Identical objects are equal. `0 === -0`, but they aren't identical.
847 | // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
848 | if (a === b) return a !== 0 || 1 / a == 1 / b;
849 | // A strict comparison is necessary because `null == undefined`.
850 | if (a == null || b == null) return a === b;
851 | // Unwrap any wrapped objects.
852 | if (a instanceof _) a = a._wrapped;
853 | if (b instanceof _) b = b._wrapped;
854 | // Compare `[[Class]]` names.
855 | var className = toString.call(a);
856 | if (className != toString.call(b)) return false;
857 | switch (className) {
858 | // Strings, numbers, dates, and booleans are compared by value.
859 | case '[object String]':
860 | // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
861 | // equivalent to `new String("5")`.
862 | return a == String(b);
863 | case '[object Number]':
864 | // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
865 | // other numeric values.
866 | return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
867 | case '[object Date]':
868 | case '[object Boolean]':
869 | // Coerce dates and booleans to numeric primitive values. Dates are compared by their
870 | // millisecond representations. Note that invalid dates with millisecond representations
871 | // of `NaN` are not equivalent.
872 | return +a == +b;
873 | // RegExps are compared by their source patterns and flags.
874 | case '[object RegExp]':
875 | return a.source == b.source &&
876 | a.global == b.global &&
877 | a.multiline == b.multiline &&
878 | a.ignoreCase == b.ignoreCase;
879 | }
880 | if (typeof a != 'object' || typeof b != 'object') return false;
881 | // Assume equality for cyclic structures. The algorithm for detecting cyclic
882 | // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
883 | var length = aStack.length;
884 | while (length--) {
885 | // Linear search. Performance is inversely proportional to the number of
886 | // unique nested structures.
887 | if (aStack[length] == a) return bStack[length] == b;
888 | }
889 | // Objects with different constructors are not equivalent, but `Object`s
890 | // from different frames are.
891 | var aCtor = a.constructor, bCtor = b.constructor;
892 | if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
893 | _.isFunction(bCtor) && (bCtor instanceof bCtor))) {
894 | return false;
895 | }
896 | // Add the first object to the stack of traversed objects.
897 | aStack.push(a);
898 | bStack.push(b);
899 | var size = 0, result = true;
900 | // Recursively compare objects and arrays.
901 | if (className == '[object Array]') {
902 | // Compare array lengths to determine if a deep comparison is necessary.
903 | size = a.length;
904 | result = size == b.length;
905 | if (result) {
906 | // Deep compare the contents, ignoring non-numeric properties.
907 | while (size--) {
908 | if (!(result = eq(a[size], b[size], aStack, bStack))) break;
909 | }
910 | }
911 | } else {
912 | // Deep compare objects.
913 | for (var key in a) {
914 | if (_.has(a, key)) {
915 | // Count the expected number of properties.
916 | size++;
917 | // Deep compare each member.
918 | if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
919 | }
920 | }
921 | // Ensure that both objects contain the same number of properties.
922 | if (result) {
923 | for (key in b) {
924 | if (_.has(b, key) && !(size--)) break;
925 | }
926 | result = !size;
927 | }
928 | }
929 | // Remove the first object from the stack of traversed objects.
930 | aStack.pop();
931 | bStack.pop();
932 | return result;
933 | };
934 |
935 | // Perform a deep comparison to check if two objects are equal.
936 | _.isEqual = function(a, b) {
937 | return eq(a, b, [], []);
938 | };
939 |
940 | // Is a given array, string, or object empty?
941 | // An "empty" object has no enumerable own-properties.
942 | _.isEmpty = function(obj) {
943 | if (obj == null) return true;
944 | if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
945 | for (var key in obj) if (_.has(obj, key)) return false;
946 | return true;
947 | };
948 |
949 | // Is a given value a DOM element?
950 | _.isElement = function(obj) {
951 | return !!(obj && obj.nodeType === 1);
952 | };
953 |
954 | // Is a given value an array?
955 | // Delegates to ECMA5's native Array.isArray
956 | _.isArray = nativeIsArray || function(obj) {
957 | return toString.call(obj) == '[object Array]';
958 | };
959 |
960 | // Is a given variable an object?
961 | _.isObject = function(obj) {
962 | return obj === Object(obj);
963 | };
964 |
965 | // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
966 | each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
967 | _['is' + name] = function(obj) {
968 | return toString.call(obj) == '[object ' + name + ']';
969 | };
970 | });
971 |
972 | // Define a fallback version of the method in browsers (ahem, IE), where
973 | // there isn't any inspectable "Arguments" type.
974 | if (!_.isArguments(arguments)) {
975 | _.isArguments = function(obj) {
976 | return !!(obj && _.has(obj, 'callee'));
977 | };
978 | }
979 |
980 | // Optimize `isFunction` if appropriate.
981 | if (typeof (/./) !== 'function') {
982 | _.isFunction = function(obj) {
983 | return typeof obj === 'function';
984 | };
985 | }
986 |
987 | // Is a given object a finite number?
988 | _.isFinite = function(obj) {
989 | return isFinite(obj) && !isNaN(parseFloat(obj));
990 | };
991 |
992 | // Is the given value `NaN`? (NaN is the only number which does not equal itself).
993 | _.isNaN = function(obj) {
994 | return _.isNumber(obj) && obj != +obj;
995 | };
996 |
997 | // Is a given value a boolean?
998 | _.isBoolean = function(obj) {
999 | return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
1000 | };
1001 |
1002 | // Is a given value equal to null?
1003 | _.isNull = function(obj) {
1004 | return obj === null;
1005 | };
1006 |
1007 | // Is a given variable undefined?
1008 | _.isUndefined = function(obj) {
1009 | return obj === void 0;
1010 | };
1011 |
1012 | // Shortcut function for checking if an object has a given property directly
1013 | // on itself (in other words, not on a prototype).
1014 | _.has = function(obj, key) {
1015 | return hasOwnProperty.call(obj, key);
1016 | };
1017 |
1018 | // Utility Functions
1019 | // -----------------
1020 |
1021 | // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
1022 | // previous owner. Returns a reference to the Underscore object.
1023 | _.noConflict = function() {
1024 | root._ = previousUnderscore;
1025 | return this;
1026 | };
1027 |
1028 | // Keep the identity function around for default iterators.
1029 | _.identity = function(value) {
1030 | return value;
1031 | };
1032 |
1033 | // Run a function **n** times.
1034 | _.times = function(n, iterator, context) {
1035 | var accum = Array(Math.max(0, n));
1036 | for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
1037 | return accum;
1038 | };
1039 |
1040 | // Return a random integer between min and max (inclusive).
1041 | _.random = function(min, max) {
1042 | if (max == null) {
1043 | max = min;
1044 | min = 0;
1045 | }
1046 | return min + Math.floor(Math.random() * (max - min + 1));
1047 | };
1048 |
1049 | // List of HTML entities for escaping.
1050 | var entityMap = {
1051 | escape: {
1052 | '&': '&',
1053 | '<': '<',
1054 | '>': '>',
1055 | '"': '"',
1056 | "'": ''',
1057 | '/': '/'
1058 | }
1059 | };
1060 | entityMap.unescape = _.invert(entityMap.escape);
1061 |
1062 | // Regexes containing the keys and values listed immediately above.
1063 | var entityRegexes = {
1064 | escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'),
1065 | unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g')
1066 | };
1067 |
1068 | // Functions for escaping and unescaping strings to/from HTML interpolation.
1069 | _.each(['escape', 'unescape'], function(method) {
1070 | _[method] = function(string) {
1071 | if (string == null) return '';
1072 | return ('' + string).replace(entityRegexes[method], function(match) {
1073 | return entityMap[method][match];
1074 | });
1075 | };
1076 | });
1077 |
1078 | // If the value of the named `property` is a function then invoke it with the
1079 | // `object` as context; otherwise, return it.
1080 | _.result = function(object, property) {
1081 | if (object == null) return void 0;
1082 | var value = object[property];
1083 | return _.isFunction(value) ? value.call(object) : value;
1084 | };
1085 |
1086 | // Add your own custom functions to the Underscore object.
1087 | _.mixin = function(obj) {
1088 | each(_.functions(obj), function(name){
1089 | var func = _[name] = obj[name];
1090 | _.prototype[name] = function() {
1091 | var args = [this._wrapped];
1092 | push.apply(args, arguments);
1093 | return result.call(this, func.apply(_, args));
1094 | };
1095 | });
1096 | };
1097 |
1098 | // Generate a unique integer id (unique within the entire client session).
1099 | // Useful for temporary DOM ids.
1100 | var idCounter = 0;
1101 | _.uniqueId = function(prefix) {
1102 | var id = ++idCounter + '';
1103 | return prefix ? prefix + id : id;
1104 | };
1105 |
1106 | // By default, Underscore uses ERB-style template delimiters, change the
1107 | // following template settings to use alternative delimiters.
1108 | _.templateSettings = {
1109 | evaluate : /<%([\s\S]+?)%>/g,
1110 | interpolate : /<%=([\s\S]+?)%>/g,
1111 | escape : /<%-([\s\S]+?)%>/g
1112 | };
1113 |
1114 | // When customizing `templateSettings`, if you don't want to define an
1115 | // interpolation, evaluation or escaping regex, we need one that is
1116 | // guaranteed not to match.
1117 | var noMatch = /(.)^/;
1118 |
1119 | // Certain characters need to be escaped so that they can be put into a
1120 | // string literal.
1121 | var escapes = {
1122 | "'": "'",
1123 | '\\': '\\',
1124 | '\r': 'r',
1125 | '\n': 'n',
1126 | '\t': 't',
1127 | '\u2028': 'u2028',
1128 | '\u2029': 'u2029'
1129 | };
1130 |
1131 | var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
1132 |
1133 | // JavaScript micro-templating, similar to John Resig's implementation.
1134 | // Underscore templating handles arbitrary delimiters, preserves whitespace,
1135 | // and correctly escapes quotes within interpolated code.
1136 | _.template = function(text, data, settings) {
1137 | var render;
1138 | settings = _.defaults({}, settings, _.templateSettings);
1139 |
1140 | // Combine delimiters into one regular expression via alternation.
1141 | var matcher = new RegExp([
1142 | (settings.escape || noMatch).source,
1143 | (settings.interpolate || noMatch).source,
1144 | (settings.evaluate || noMatch).source
1145 | ].join('|') + '|$', 'g');
1146 |
1147 | // Compile the template source, escaping string literals appropriately.
1148 | var index = 0;
1149 | var source = "__p+='";
1150 | text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
1151 | source += text.slice(index, offset)
1152 | .replace(escaper, function(match) { return '\\' + escapes[match]; });
1153 |
1154 | if (escape) {
1155 | source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
1156 | }
1157 | if (interpolate) {
1158 | source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
1159 | }
1160 | if (evaluate) {
1161 | source += "';\n" + evaluate + "\n__p+='";
1162 | }
1163 | index = offset + match.length;
1164 | return match;
1165 | });
1166 | source += "';\n";
1167 |
1168 | // If a variable is not specified, place data values in local scope.
1169 | if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
1170 |
1171 | source = "var __t,__p='',__j=Array.prototype.join," +
1172 | "print=function(){__p+=__j.call(arguments,'');};\n" +
1173 | source + "return __p;\n";
1174 |
1175 | try {
1176 | render = new Function(settings.variable || 'obj', '_', source);
1177 | } catch (e) {
1178 | e.source = source;
1179 | throw e;
1180 | }
1181 |
1182 | if (data) return render(data, _);
1183 | var template = function(data) {
1184 | return render.call(this, data, _);
1185 | };
1186 |
1187 | // Provide the compiled function source as a convenience for precompilation.
1188 | template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
1189 |
1190 | return template;
1191 | };
1192 |
1193 | // Add a "chain" function, which will delegate to the wrapper.
1194 | _.chain = function(obj) {
1195 | return _(obj).chain();
1196 | };
1197 |
1198 | // OOP
1199 | // ---------------
1200 | // If Underscore is called as a function, it returns a wrapped object that
1201 | // can be used OO-style. This wrapper holds altered versions of all the
1202 | // underscore functions. Wrapped objects may be chained.
1203 |
1204 | // Helper function to continue chaining intermediate results.
1205 | var result = function(obj) {
1206 | return this._chain ? _(obj).chain() : obj;
1207 | };
1208 |
1209 | // Add all of the Underscore functions to the wrapper object.
1210 | _.mixin(_);
1211 |
1212 | // Add all mutator Array functions to the wrapper.
1213 | each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
1214 | var method = ArrayProto[name];
1215 | _.prototype[name] = function() {
1216 | var obj = this._wrapped;
1217 | method.apply(obj, arguments);
1218 | if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0];
1219 | return result.call(this, obj);
1220 | };
1221 | });
1222 |
1223 | // Add all accessor Array functions to the wrapper.
1224 | each(['concat', 'join', 'slice'], function(name) {
1225 | var method = ArrayProto[name];
1226 | _.prototype[name] = function() {
1227 | return result.call(this, method.apply(this._wrapped, arguments));
1228 | };
1229 | });
1230 |
1231 | _.extend(_.prototype, {
1232 |
1233 | // Start chaining a wrapped Underscore object.
1234 | chain: function() {
1235 | this._chain = true;
1236 | return this;
1237 | },
1238 |
1239 | // Extracts the result from a wrapped and chained object.
1240 | value: function() {
1241 | return this._wrapped;
1242 | }
1243 |
1244 | });
1245 |
1246 | // AMD define happens at the end for compatibility with AMD loaders
1247 | // that don't enforce next-turn semantics on modules.
1248 | if (typeof define === 'function' && define.amd) {
1249 | define('underscore', function() {
1250 | return _;
1251 | });
1252 | }
1253 |
1254 | }).call(this);
1255 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/views/addMessage.js:
--------------------------------------------------------------------------------
1 | define(['backbone','channel'],function(Backbone,Channel){
2 |
3 | return Backbone.View.extend({
4 | el:'.input-area',
5 | events:{
6 | 'click .submit' : 'submit',
7 | 'keypress textarea':'submitOnEnter'
8 | },
9 |
10 | submit : function(){
11 | nwmsg = this.$el.find('textarea').val();
12 | this.$el.find('textarea').val('');
13 | Channel.trigger('addMsg',nwmsg); // reciever messages.view
14 | //auto_scroll();
15 | },
16 | submitOnEnter:function(e){
17 | console.log(e.keyCode);
18 | if(e.keyCode===13 && !e.shiftKey){
19 | this.submit();
20 | }
21 | }
22 | });
23 | });
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/views/message.js:
--------------------------------------------------------------------------------
1 | define(['backbone','underscore','text!templates/message.tmpl'],function(Backbone,_,MessageTmpl){
2 |
3 | return Backbone.View.extend({
4 | tagName : 'div',
5 | className : 'monologue',
6 | template : _.template(MessageTmpl),
7 |
8 | render : function(){
9 | this.$el.html(this.template(this.model.toJSON()));
10 | return this;
11 | }
12 | });
13 | });
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/views/messages.js:
--------------------------------------------------------------------------------
1 | define(['backbone','views/message','channel'],function(Backbone,MsgView,Channel){
2 |
3 | return Backbone.View.extend({
4 |
5 | tagName : 'div',
6 | className : 'chatMsgs',
7 | initialize : function(){
8 | $('.chatBox').html(this.el);
9 | this.collection.on("add", this.addOne, this);
10 | Channel.on('addMsg',this.addMsg,this);
11 | this.render();
12 | //scroll to bottom after render
13 | $("html, body").animate({ scrollTop: $(document).height() }, 1000);
14 | },
15 | render : function(){
16 | this.collection.each(this.addone,this);
17 | return this;
18 | },
19 | addOne : function(msg){
20 | var newMsg = new MsgView({model:msg});
21 | this.$el.append(newMsg.render().el);
22 | //autoscroll
23 | if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
24 |
25 | $('html, body').animate({scrollTop:$(document).height()}, 500);
26 | }
27 |
28 | },
29 | addone : function(msg){
30 | // for inital rnder without scroll animation
31 | var newMsg = new MsgView({model:msg});
32 | this.$el.append(newMsg.render().el);
33 | },
34 | addMsg : function(m){
35 | this.collection.create({msg:m},{wait:true});
36 | }
37 | });
38 |
39 | });
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/views/user.js:
--------------------------------------------------------------------------------
1 | define(['backbone','underscore','text!templates/user.tmpl'],function(Backbone,_,usrTmpl){
2 | return Backbone.View.extend({
3 | tagName : 'div',
4 | className : 's_user',
5 | template : _.template(usrTmpl),
6 |
7 | render : function(){
8 | this.$el.html(this.template(this.model.toJSON()));
9 | return this;
10 | }
11 | });
12 | });
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/app/scripts/views/users.js:
--------------------------------------------------------------------------------
1 | define(['backbone','views/user'],function(Backbone,usrView){
2 |
3 | return Backbone.View.extend({
4 |
5 | el : '.onlineUsers',
6 | initialize : function(){
7 |
8 | this.collection.fetch();
9 | //this.collection.on("add", this.addOne, this);
10 | this.collection.on('add',this.render,this);
11 | this.collection.on('remove',this.render,this);
12 | },
13 | render : function(){
14 | console.log('........................................rendering............');
15 | this.$el.html('');
16 | this.collection.each(this.addOne,this);
17 | return this;
18 | },
19 | addOne : function(usr){
20 | var newUsr = new usrView({model:usr});
21 | this.$el.append(newUsr.render().el);
22 | }
23 | });
24 | });
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name":"Chat",
3 | "version":"0.2",
4 | "dependencies":{
5 | "jquery-legacy":"jquery#1.10",
6 | "jquery":null,
7 | "underscore-amd":null,
8 | "backbone-amd":null,
9 | "requirejs":null,
10 | "requirejs-text":null
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/css/main.css:
--------------------------------------------------------------------------------
1 | body {
2 | color: #000000;
3 | background-color: #E9E9E9;
4 | }
5 | .clear-both {
6 | clear: both;
7 | float: none;
8 | height: 0;
9 | }
10 | .chatBox {
11 | position: absolute;
12 | top: 0;
13 | left: 0;
14 | width: 80%;
15 | }
16 | .chatBox .chatMsgs {
17 | margin-bottom: 100px;
18 | }
19 | .monologue {
20 | margin-bottom: 10px;
21 | }
22 | .monologue .signature {
23 | float: left;
24 | width: 10%;
25 | margin-right: 20px;
26 | }
27 | .monologue .signature .username {
28 | width: 70%;
29 | float: right;
30 | font-size: 12px;
31 | line-height: 1.2em;
32 | overflow: hidden;
33 | margin-top: 5px;
34 | text-align: right;
35 | word-wrap: break-word;
36 | }
37 | .monologue .signature .avatar {
38 | width: 20%;
39 | float: right;
40 | margin-left: 5px;
41 |
42 | }
43 | .monologue .signature .avatar img{
44 | box-shadow: 0px 1px 3px #aaa;
45 | }
46 | .monologue .messages {
47 | float: left;
48 | width: 80%;
49 | padding: 5px 10px;
50 | background-color: #fff;
51 | border-radius: 5px;
52 | word-wrap: break-word;
53 | box-shadow: 1px 1px 1px 0px #bbb;
54 | color:#444;
55 | }
56 | .monologue .msg span{
57 | font-size: 7px;
58 | float: right;
59 | background-color: #eee;
60 | padding: 5px;
61 | font-weight: bold;
62 |
63 | }
64 | /*=======================================================================*/
65 | .sidebar {
66 | width: 18%;
67 | z-index: 5;
68 | position: fixed;
69 | right: 0;
70 | }
71 | .sidebar .side {
72 | background-color: #fff;
73 | border-radius: 5px;
74 | padding: 10px;
75 | margin-right: 20px;
76 | box-shadow: 0px 1px 3px #aaa;
77 | }
78 | .side h2 {
79 | color: #333;
80 | }
81 | .onlineUsers .s_user {
82 | margin-bottom: 10px;
83 | }
84 | .onlineUsers .s_user .s_avatar {
85 | float: left;
86 | }
87 | .onlineUsers .s_user .s_username {
88 | float: left;
89 | }
90 | .onlineUsers .s_user .s_username a {
91 | text-decoration: none;
92 | font-size: 18px;
93 | color: #333;
94 | margin-left: 5px;
95 | word-wrap: break-word;
96 | }
97 | /* ================================================================= */
98 | .input-area {
99 | position: fixed;
100 | bottom: 0;
101 | z-index: 6;
102 | width: 100%;
103 | background-color: #ddd;
104 | height: 75px;
105 | box-shadow: 0px -2px 10px 1px #555555;
106 | }
107 | .input-area img {
108 | float: left;
109 | text-align: center;
110 | margin: 5px;
111 | }
112 | .input-area .input-box {
113 | float: left;
114 | width: 60%;
115 | background-color: #fff;
116 | resize: none;
117 | border: none;
118 | margin: 5px;
119 | height: 64px;
120 | }
121 | .input-area .submit {
122 | float: left;
123 | width: 8%;
124 | height: 64px;
125 | margin: 5px;
126 | }
127 | #footer {
128 | position: fixed;
129 | left: 0px;
130 | bottom: 0px;
131 | height: 70px;
132 | width: 100%;
133 | background: #999;
134 | z-index: 9;
135 | }
136 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/css/normalize.css:
--------------------------------------------------------------------------------
1 | /*! normalize.css v2.1.3 | MIT License | git.io/normalize */
2 |
3 | /* ==========================================================================
4 | HTML5 display definitions
5 | ========================================================================== */
6 |
7 | /**
8 | * Correct `block` display not defined in IE 8/9.
9 | */
10 |
11 | article,
12 | aside,
13 | details,
14 | figcaption,
15 | figure,
16 | footer,
17 | header,
18 | hgroup,
19 | main,
20 | nav,
21 | section,
22 | summary {
23 | display: block;
24 | }
25 |
26 | /**
27 | * Correct `inline-block` display not defined in IE 8/9.
28 | */
29 |
30 | audio,
31 | canvas,
32 | video {
33 | display: inline-block;
34 | }
35 |
36 | /**
37 | * Prevent modern browsers from displaying `audio` without controls.
38 | * Remove excess height in iOS 5 devices.
39 | */
40 |
41 | audio:not([controls]) {
42 | display: none;
43 | height: 0;
44 | }
45 |
46 | /**
47 | * Address `[hidden]` styling not present in IE 8/9.
48 | * Hide the `template` element in IE, Safari, and Firefox < 22.
49 | */
50 |
51 | [hidden],
52 | template {
53 | display: none;
54 | }
55 |
56 | /* ==========================================================================
57 | Base
58 | ========================================================================== */
59 |
60 | /**
61 | * 1. Set default font family to sans-serif.
62 | * 2. Prevent iOS text size adjust after orientation change, without disabling
63 | * user zoom.
64 | */
65 |
66 | html {
67 | font-family: sans-serif; /* 1 */
68 | -ms-text-size-adjust: 100%; /* 2 */
69 | -webkit-text-size-adjust: 100%; /* 2 */
70 | }
71 |
72 | /**
73 | * Remove default margin.
74 | */
75 |
76 | body {
77 | margin: 0;
78 | }
79 |
80 | /* ==========================================================================
81 | Links
82 | ========================================================================== */
83 |
84 | /**
85 | * Remove the gray background color from active links in IE 10.
86 | */
87 |
88 | a {
89 | background: transparent;
90 | }
91 |
92 | /**
93 | * Address `outline` inconsistency between Chrome and other browsers.
94 | */
95 |
96 | a:focus {
97 | outline: thin dotted;
98 | }
99 |
100 | /**
101 | * Improve readability when focused and also mouse hovered in all browsers.
102 | */
103 |
104 | a:active,
105 | a:hover {
106 | outline: 0;
107 | }
108 |
109 | /* ==========================================================================
110 | Typography
111 | ========================================================================== */
112 |
113 | /**
114 | * Address variable `h1` font-size and margin within `section` and `article`
115 | * contexts in Firefox 4+, Safari 5, and Chrome.
116 | */
117 |
118 | h1 {
119 | font-size: 2em;
120 | margin: 0.67em 0;
121 | }
122 |
123 | /**
124 | * Address styling not present in IE 8/9, Safari 5, and Chrome.
125 | */
126 |
127 | abbr[title] {
128 | border-bottom: 1px dotted;
129 | }
130 |
131 | /**
132 | * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
133 | */
134 |
135 | b,
136 | strong {
137 | font-weight: bold;
138 | }
139 |
140 | /**
141 | * Address styling not present in Safari 5 and Chrome.
142 | */
143 |
144 | dfn {
145 | font-style: italic;
146 | }
147 |
148 | /**
149 | * Address differences between Firefox and other browsers.
150 | */
151 |
152 | hr {
153 | -moz-box-sizing: content-box;
154 | box-sizing: content-box;
155 | height: 0;
156 | }
157 |
158 | /**
159 | * Address styling not present in IE 8/9.
160 | */
161 |
162 | mark {
163 | background: #ff0;
164 | color: #000;
165 | }
166 |
167 | /**
168 | * Correct font family set oddly in Safari 5 and Chrome.
169 | */
170 |
171 | code,
172 | kbd,
173 | pre,
174 | samp {
175 | font-family: monospace, serif;
176 | font-size: 1em;
177 | }
178 |
179 | /**
180 | * Improve readability of pre-formatted text in all browsers.
181 | */
182 |
183 | pre {
184 | white-space: pre-wrap;
185 | }
186 |
187 | /**
188 | * Set consistent quote types.
189 | */
190 |
191 | q {
192 | quotes: "\201C" "\201D" "\2018" "\2019";
193 | }
194 |
195 | /**
196 | * Address inconsistent and variable font size in all browsers.
197 | */
198 |
199 | small {
200 | font-size: 80%;
201 | }
202 |
203 | /**
204 | * Prevent `sub` and `sup` affecting `line-height` in all browsers.
205 | */
206 |
207 | sub,
208 | sup {
209 | font-size: 75%;
210 | line-height: 0;
211 | position: relative;
212 | vertical-align: baseline;
213 | }
214 |
215 | sup {
216 | top: -0.5em;
217 | }
218 |
219 | sub {
220 | bottom: -0.25em;
221 | }
222 |
223 | /* ==========================================================================
224 | Embedded content
225 | ========================================================================== */
226 |
227 | /**
228 | * Remove border when inside `a` element in IE 8/9.
229 | */
230 |
231 | img {
232 | border: 0;
233 | }
234 |
235 | /**
236 | * Correct overflow displayed oddly in IE 9.
237 | */
238 |
239 | svg:not(:root) {
240 | overflow: hidden;
241 | }
242 |
243 | /* ==========================================================================
244 | Figures
245 | ========================================================================== */
246 |
247 | /**
248 | * Address margin not present in IE 8/9 and Safari 5.
249 | */
250 |
251 | figure {
252 | margin: 0;
253 | }
254 |
255 | /* ==========================================================================
256 | Forms
257 | ========================================================================== */
258 |
259 | /**
260 | * Define consistent border, margin, and padding.
261 | */
262 |
263 | fieldset {
264 | border: 1px solid #c0c0c0;
265 | margin: 0 2px;
266 | padding: 0.35em 0.625em 0.75em;
267 | }
268 |
269 | /**
270 | * 1. Correct `color` not being inherited in IE 8/9.
271 | * 2. Remove padding so people aren't caught out if they zero out fieldsets.
272 | */
273 |
274 | legend {
275 | border: 0; /* 1 */
276 | padding: 0; /* 2 */
277 | }
278 |
279 | /**
280 | * 1. Correct font family not being inherited in all browsers.
281 | * 2. Correct font size not being inherited in all browsers.
282 | * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
283 | */
284 |
285 | button,
286 | input,
287 | select,
288 | textarea {
289 | font-family: inherit; /* 1 */
290 | font-size: 100%; /* 2 */
291 | margin: 0; /* 3 */
292 | }
293 |
294 | /**
295 | * Address Firefox 4+ setting `line-height` on `input` using `!important` in
296 | * the UA stylesheet.
297 | */
298 |
299 | button,
300 | input {
301 | line-height: normal;
302 | }
303 |
304 | /**
305 | * Address inconsistent `text-transform` inheritance for `button` and `select`.
306 | * All other form control elements do not inherit `text-transform` values.
307 | * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
308 | * Correct `select` style inheritance in Firefox 4+ and Opera.
309 | */
310 |
311 | button,
312 | select {
313 | text-transform: none;
314 | }
315 |
316 | /**
317 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
318 | * and `video` controls.
319 | * 2. Correct inability to style clickable `input` types in iOS.
320 | * 3. Improve usability and consistency of cursor style between image-type
321 | * `input` and others.
322 | */
323 |
324 | button,
325 | html input[type="button"], /* 1 */
326 | input[type="reset"],
327 | input[type="submit"] {
328 | -webkit-appearance: button; /* 2 */
329 | cursor: pointer; /* 3 */
330 | }
331 |
332 | /**
333 | * Re-set default cursor for disabled elements.
334 | */
335 |
336 | button[disabled],
337 | html input[disabled] {
338 | cursor: default;
339 | }
340 |
341 | /**
342 | * 1. Address box sizing set to `content-box` in IE 8/9/10.
343 | * 2. Remove excess padding in IE 8/9/10.
344 | */
345 |
346 | input[type="checkbox"],
347 | input[type="radio"] {
348 | box-sizing: border-box; /* 1 */
349 | padding: 0; /* 2 */
350 | }
351 |
352 | /**
353 | * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
354 | * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
355 | * (include `-moz` to future-proof).
356 | */
357 |
358 | input[type="search"] {
359 | -webkit-appearance: textfield; /* 1 */
360 | -moz-box-sizing: content-box;
361 | -webkit-box-sizing: content-box; /* 2 */
362 | box-sizing: content-box;
363 | }
364 |
365 | /**
366 | * Remove inner padding and search cancel button in Safari 5 and Chrome
367 | * on OS X.
368 | */
369 |
370 | input[type="search"]::-webkit-search-cancel-button,
371 | input[type="search"]::-webkit-search-decoration {
372 | -webkit-appearance: none;
373 | }
374 |
375 | /**
376 | * Remove inner padding and border in Firefox 4+.
377 | */
378 |
379 | button::-moz-focus-inner,
380 | input::-moz-focus-inner {
381 | border: 0;
382 | padding: 0;
383 | }
384 |
385 | /**
386 | * 1. Remove default vertical scrollbar in IE 8/9.
387 | * 2. Improve readability and alignment in all browsers.
388 | */
389 |
390 | textarea {
391 | overflow: auto; /* 1 */
392 | vertical-align: top; /* 2 */
393 | }
394 |
395 | /* ==========================================================================
396 | Tables
397 | ========================================================================== */
398 |
399 | /**
400 | * Remove most spacing between table cells.
401 | */
402 |
403 | table {
404 | border-collapse: collapse;
405 | border-spacing: 0;
406 | }
407 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/build.txt:
--------------------------------------------------------------------------------
1 |
2 | scripts/main.js
3 | ----------------
4 | scripts/vendor/underscore-amd/underscore.js
5 | scripts/vendor/jquery/jquery.js
6 | scripts/vendor/backbone-amd/backbone.js
7 | scripts/vendor/requirejs-text/text.js
8 | text!templates/message.tmpl
9 | scripts/views/message.js
10 | scripts/channel.js
11 | scripts/views/messages.js
12 | scripts/views/addMessage.js
13 | scripts/models/message.js
14 | scripts/collections/messages.js
15 | text!templates/user.tmpl
16 | scripts/views/user.js
17 | scripts/views/users.js
18 | scripts/models/user.js
19 | scripts/collections/users.js
20 | scripts/main.js
21 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/build/app.build.js:
--------------------------------------------------------------------------------
1 | ({appDir:"../",baseUrl:"scripts",dir:"../../dist",mainConfigFile:"../scripts/main.js",name:"main",optimizeCss:"standard"});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/channel.js:
--------------------------------------------------------------------------------
1 | define(["backbone"],function(e){var t=_.extend({},e.Events);return t});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/collections/messages.js:
--------------------------------------------------------------------------------
1 | define(["backbone","models/message"],function(e,t){return Messages=e.Collection.extend({model:t,url:"/chat/api/"}),Messages});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/collections/users.js:
--------------------------------------------------------------------------------
1 | define(["backbone","models/user"],function(e,t){return e.Collection.extend({url:"/chat/api/users/",model:t})});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/models/message.js:
--------------------------------------------------------------------------------
1 | define(["backbone","jquery"],function(e,t){return Message=e.Model.extend({validate:function(e){m=e.msg;if(t.trim(m)==="")return"empty messege"},initialize:function(){this.on("invalid",function(e,t){console.log(t)})}}),Message});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/models/user.js:
--------------------------------------------------------------------------------
1 | define(["backbone"],function(){return Backbone.Model.extend({})});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/templates/message.tmpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
<%=user%>
6 |
7 |
8 |
9 |
10 | <%=msg%>
11 | <%=time%>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/templates/user.tmpl:
--------------------------------------------------------------------------------
1 |
2 |

3 |
4 |
7 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backbone-amd",
3 | "homepage": "https://github.com/amdjs/backbone",
4 | "version": "1.0.0",
5 | "_release": "1.0.0",
6 | "_resolution": {
7 | "type": "version",
8 | "tag": "1.0.0",
9 | "commit": "df9a95275594eee98cd3d372464ee1467fdb7b1f"
10 | },
11 | "_source": "git://github.com/amdjs/backbone.git",
12 | "_target": "*",
13 | "_originalSource": "backbone-amd"
14 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/.gitignore:
--------------------------------------------------------------------------------
1 | raw
2 | *.sw?
3 | .DS_Store
4 | node_modules
5 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/.npmignore:
--------------------------------------------------------------------------------
1 | test/
2 | Rakefile
3 | docs/
4 | raw/
5 | examples/
6 | index.html
7 | .jshintrc
8 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 0.8
4 | notifications:
5 | email: false
6 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/backbone.js:
--------------------------------------------------------------------------------
1 | // (c) 2010-2013 Jeremy Ashkenas, DocumentCloud Inc.
2 | // Backbone may be freely distributed under the MIT license.
3 | // For all details and documentation:
4 | // http://backbonejs.org
5 |
6 | (function(e,t){typeof exports!="undefined"?t(e,exports,require("underscore")):typeof define=="function"&&define.amd?define(["underscore","jquery","exports"],function(n,r,i){e.Backbone=t(e,i,n,r)}):e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)})(this,function(e,t,n,r){var i=e.Backbone,s=[],o=s.push,u=s.slice,a=s.splice;t.VERSION="1.0.0",t.$=r,t.noConflict=function(){return e.Backbone=i,this},t.emulateHTTP=!1,t.emulateJSON=!1;var f=t.Events={on:function(e,t,n){if(!c(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,r){if(!c(this,"once",e,[t,r])||!t)return this;var i=this,s=n.once(function(){i.off(e,s),t.apply(this,arguments)});return s._callback=t,this.on(e,s,r)},off:function(e,t,r){var i,s,o,u,a,f,l,h;if(!this._events||!c(this,"off",e,[t,r]))return this;if(!e&&!t&&!r)return this._events={},this;u=e?[e]:n.keys(this._events);for(a=0,f=u.length;a").attr(e);this.setElement(r,!1)}else this.setElement(n.result(this,"el"),!1)}}),t.sync=function(e,r,i){var s=N[e];n.defaults(i||(i={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var o={type:s,dataType:"json"};i.url||(o.url=n.result(r,"url")||j()),i.data==null&&r&&(e==="create"||e==="update"||e==="patch")&&(o.contentType="application/json",o.data=JSON.stringify(i.attrs||r.toJSON(i))),i.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{});if(i.emulateHTTP&&(s==="PUT"||s==="DELETE"||s==="PATCH")){o.type="POST",i.emulateJSON&&(o.data._method=s);var u=i.beforeSend;i.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",s);if(u)return u.apply(this,arguments)}}o.type!=="GET"&&!i.emulateJSON&&(o.processData=!1),o.type==="PATCH"&&window.ActiveXObject&&(!window.external||!window.external.msActiveXFilteringEnabled)&&(o.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var a=i.xhr=t.ajax(n.extend(o,i));return r.trigger("request",r,a,i),a};var N={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var C=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},k=/\((.*?)\)/g,L=/(\(\?)?:\w+/g,A=/\*\w+/g,O=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(C.prototype,f,{initialize:function(){},route:function(e,r,i){n.isRegExp(e)||(e=this._routeToRegExp(e)),n.isFunction(r)&&(i=r,r=""),i||(i=this[r]);var s=this;return t.history.route(e,function(n){var o=s._extractParameters(e,n);i&&i.apply(s,o),s.trigger.apply(s,["route:"+r].concat(o)),s.trigger("route",r,o),t.history.trigger("route",s,r,o)}),this},navigate:function(e,n){return t.history.navigate(e,n),this},_bindRoutes:function(){if(!this.routes)return;this.routes=n.result(this,"routes");var e,t=n.keys(this.routes);while((e=t.pop())!=null)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(O,"\\$&").replace(k,"(?:$1)?").replace(L,function(e,t){return t?e:"([^/]+)"}).replace(A,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var r=e.exec(t).slice(1);return n.map(r,function(e){return e?decodeURIComponent(e):null})}});var M=t.History=function(){this.handlers=[],n.bindAll(this,"checkUrl"),typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},_=/^[#\/]|\s+$/g,D=/^\/+|\/+$/g,P=/msie [\w.]+/,H=/\/$/;M.started=!1,n.extend(M.prototype,f,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(H,"");e.indexOf(n)||(e=e.substr(n.length))}else e=this.getHash();return e.replace(_,"")},start:function(e){if(M.started)throw new Error("Backbone.history has already been started");M.started=!0,this.options=n.extend({},{root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment(),i=document.documentMode,s=P.exec(navigator.userAgent.toLowerCase())&&(!i||i<=7);this.root=("/"+this.root+"/").replace(D,"/"),s&&this._wantsHashChange&&(this.iframe=t.$('').hide().appendTo("body")[0].contentWindow,this.navigate(r)),this._hasPushState?t.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!s?t.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=r;var o=this.location,u=o.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!u)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&u&&o.hash&&(this.fragment=this.getHash().replace(_,""),this.history.replaceState({},document.title,this.root+this.fragment+o.search));if(!this.options.silent)return this.loadUrl()},stop:function(){t.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),M.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(e){var t=this.fragment=this.getFragment(e),r=n.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0});return r},navigate:function(e,t){if(!M.started)return!1;if(!t||t===!0)t={trigger:t};e=this.getFragment(e||"");if(this.fragment===e)return;this.fragment=e;var n=this.root+e;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}t.trigger&&this.loadUrl(e)},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),t.history=new M;var B=function(e,t){var r=this,i;e&&n.has(e,"constructor")?i=e.constructor:i=function(){return r.apply(this,arguments)},n.extend(i,r,t);var s=function(){this.constructor=i};return s.prototype=r.prototype,i.prototype=new s,e&&n.extend(i.prototype,e),i.__super__=r.prototype,i};d.extend=g.extend=C.extend=S.extend=M.extend=B;var j=function(){throw new Error('A "url" property or function must be specified')},F=function(e,t){var n=t.error;t.error=function(r){n&&n(e,r,t),e.trigger("error",e,r,t)}};return t});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/jquery-legacy/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery",
3 | "version": "1.10.2",
4 | "description": "jQuery component",
5 | "keywords": [
6 | "jquery",
7 | "component"
8 | ],
9 | "main": "jquery.js",
10 | "license": "MIT",
11 | "homepage": "https://github.com/components/jquery",
12 | "_release": "1.10.2",
13 | "_resolution": {
14 | "type": "version",
15 | "tag": "1.10.2",
16 | "commit": "6b2390db24ba3490ca75251eec4888f7342bf4da"
17 | },
18 | "_source": "git://github.com/components/jquery.git",
19 | "_target": "1.10",
20 | "_originalSource": "jquery"
21 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/jquery-legacy/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/jquery/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery",
3 | "version": "2.0.3",
4 | "description": "jQuery component",
5 | "keywords": [
6 | "jquery",
7 | "component"
8 | ],
9 | "main": "jquery.js",
10 | "license": "MIT",
11 | "homepage": "https://github.com/components/jquery",
12 | "_release": "2.0.3",
13 | "_resolution": {
14 | "type": "version",
15 | "tag": "2.0.3",
16 | "commit": "452a56b52b8f4a032256cdb8b6838f25f0bdb3d2"
17 | },
18 | "_source": "git://github.com/components/jquery.git",
19 | "_target": "*",
20 | "_originalSource": "jquery"
21 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/jquery/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/requirejs-text/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "requirejs-text",
3 | "homepage": "https://github.com/requirejs/text",
4 | "version": "2.0.10",
5 | "_release": "2.0.10",
6 | "_resolution": {
7 | "type": "version",
8 | "tag": "2.0.10",
9 | "commit": "1592cbf9c7ffd703b36a3af4002e86457b8ab5dd"
10 | },
11 | "_source": "git://github.com/requirejs/text.git",
12 | "_target": "*",
13 | "_originalSource": "requirejs-text"
14 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/requirejs-text/text.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3 | * Available via the MIT or new BSD license.
4 | * see: http://github.com/requirejs/text for details
5 | */
6 |
7 | define(["module"],function(e){var t,n,r,i,s,o=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],u=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,a=/]*>\s*([\s\S]+)\s*<\/body>/im,f=typeof location!="undefined"&&location.href,l=f&&location.protocol&&location.protocol.replace(/\:/,""),c=f&&location.hostname,h=f&&(location.port||undefined),p={},d=e.config&&e.config()||{};t={version:"2.0.10",strip:function(e){if(e){e=e.replace(u,"");var t=e.match(a);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:d.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=o[t];try{e=new ActiveXObject(n)}catch(r){}if(e){o=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.indexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1,e.length)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,d.isBuild&&(p[e]=r),i(r)},load:function(e,n,r,i){if(i.isBuild&&!i.inlineText){r();return}d.isBuild=i.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),u=n.toUrl(o),a=d.useXhr||t.useXhr;if(u.indexOf("empty:")===0){r();return}!f||a(u,l,c,h)?t.get(u,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(p.hasOwnProperty(n)){var s=t.jsEscape(p[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(d.env==="node"||!d.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node&&!process.versions["node-webkit"])n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");i.indexOf("")===0&&(i=i.substring(1)),t(i)}catch(s){r(s)}};else if(d.env==="xhr"||!d.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);d.onXhr&&d.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r(o)):n(s.responseText),d.onXhrComplete&&d.onXhrComplete(s,e))},s.send(null)};else if(d.env==="rhino"||!d.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),r!==null&&n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};else if(d.env==="xpconnect"||!d.env&&typeof Components!="undefined"&&Components.classes&&Components.interfaces)r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in r,t.get=function(e,t){var n,o,u,a={};s&&(e=e.replace(/\//g,"\\")),u=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(u,1,0,!1),o=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),o.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(n.available(),a),o.close(),n.close(),t(a.value)}catch(f){throw new Error((u&&u.path||"")+": "+f)}};return t});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/requirejs/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "requirejs",
3 | "homepage": "https://github.com/jrburke/requirejs",
4 | "version": "2.1.8",
5 | "_release": "2.1.8",
6 | "_resolution": {
7 | "type": "version",
8 | "tag": "2.1.8",
9 | "commit": "2b083dbb358e8c1876b059434d4b571d8f87534a"
10 | },
11 | "_source": "git://github.com/jrburke/requirejs.git",
12 | "_target": "*",
13 | "_originalSource": "requirejs"
14 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/requirejs/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | docs/jquery-require-sample/webapp-build/
3 | docs/jquery-require-sample/dist
4 | dist/dist-site/
5 | dist/dist-build/
6 | shrinktest.sh
7 | tests/layers/allplugins-require.js
8 | tests/packages/optimizing/built/
9 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/requirejs/require.js:
--------------------------------------------------------------------------------
1 | /** vim: et:ts=4:sw=4:sts=4
2 | * @license RequireJS 2.1.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3 | * Available via the MIT or new BSD license.
4 | * see: http://github.com/jrburke/requirejs for details
5 | */
6 |
7 | var requirejs,require,define;(function(global){function isFunction(e){return ostring.call(e)==="[object Function]"}function isArray(e){return ostring.call(e)==="[object Array]"}function each(e,t){if(e){var n;for(n=0;n-1;n-=1)if(e[n]&&t(e[n],n,e))break}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var n;for(n in e)if(hasProp(e,n)&&t(e[n],n))break}function mixin(e,t,n,r){return t&&eachProp(t,function(t,i){if(n||!hasProp(e,i))r&&typeof t!="string"?(e[i]||(e[i]={}),mixin(e[i],t,n,r)):e[i]=t}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,n,r){var i=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return i.requireType=e,i.requireModules=r,n&&(i.originalError=n),i}function newContext(e){function v(e){var t,n;for(t=0;e[t];t+=1){n=e[t];if(n===".")e.splice(t,1),t-=1;else if(n===".."){if(t===1&&(e[2]===".."||e[0]===".."))break;t>0&&(e.splice(t-1,2),t-=2)}}}function m(e,t,n){var r,i,s,u,a,f,l,c,h,p,d,m=t&&t.split("/"),g=m,y=o.map,b=y&&y["*"];e&&e.charAt(0)==="."&&(t?(getOwn(o.pkgs,t)?g=m=[t]:g=m.slice(0,m.length-1),e=g.concat(e.split("/")),v(e),i=getOwn(o.pkgs,r=e[0]),e=e.join("/"),i&&e===r+"/"+i.main&&(e=r)):e.indexOf("./")===0&&(e=e.substring(2)));if(n&&y&&(m||b)){u=e.split("/");for(a=u.length;a>0;a-=1){l=u.slice(0,a).join("/");if(m)for(f=m.length;f>0;f-=1){s=getOwn(y,m.slice(0,f).join("/"));if(s){s=getOwn(s,l);if(s){c=s,h=a;break}}}if(c)break;!p&&b&&getOwn(b,l)&&(p=getOwn(b,l),d=a)}!c&&p&&(c=p,h=d),c&&(u.splice(0,h,c),e=u.join("/"))}return e}function g(e){isBrowser&&each(scripts(),function(t){if(t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===r.contextName)return t.parentNode.removeChild(t),!0})}function y(e){var t=getOwn(o.paths,e);if(t&&isArray(t)&&t.length>1)return g(e),t.shift(),r.require.undef(e),r.require([e]),!0}function b(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function w(e,t,n,i){var s,o,u,a,f=null,l=t?t.name:null,h=e,v=!0,g="";return e||(v=!1,e="_@r"+(p+=1)),a=b(e),f=a[0],e=a[1],f&&(f=m(f,l,i),o=getOwn(c,f)),e&&(f?o&&o.normalize?g=o.normalize(e,function(e){return m(e,l,i)}):g=m(e,l,i):(g=m(e,l,i),a=b(g),f=a[0],g=a[1],n=!0,s=r.nameToUrl(g))),u=f&&!o&&!n?"_unnormalized"+(d+=1):"",{prefix:f,name:g,parentMap:t,unnormalized:!!u,url:s,originalName:h,isDefine:v,id:(f?f+"!"+g:g)+u}}function E(e){var t=e.id,n=getOwn(u,t);return n||(n=u[t]=new r.Module(e)),n}function S(e,t,n){var r=e.id,i=getOwn(u,r);hasProp(c,r)&&(!i||i.defineEmitComplete)?t==="defined"&&n(c[r]):(i=E(e),i.error&&t==="error"?n(i.error):i.on(t,n))}function x(e,t){var n=e.requireModules,r=!1;t?t(e):(each(n,function(t){var n=getOwn(u,t);n&&(n.error=e,n.events.error&&(r=!0,n.emit("error",e)))}),r||req.onError(e))}function T(){globalDefQueue.length&&(apsp.apply(l,[l.length-1,0].concat(globalDefQueue)),globalDefQueue=[])}function N(e){delete u[e],delete a[e]}function C(e,t,n){var r=e.map.id;e.error?e.emit("error",e.error):(t[r]=!0,each(e.depMaps,function(r,i){var s=r.id,o=getOwn(u,s);o&&!e.depMatched[i]&&!n[s]&&(getOwn(t,s)?(e.defineDep(i,c[s]),e.check()):C(o,t,n))}),n[r]=!0)}function k(){var e,n,i,u,f=o.waitSeconds*1e3,l=f&&r.startTime+f<(new Date).getTime(),c=[],h=[],p=!1,d=!0;if(t)return;t=!0,eachProp(a,function(t){e=t.map,n=e.id;if(!t.enabled)return;e.isDefine||h.push(t);if(!t.error)if(!t.inited&&l)y(n)?(u=!0,p=!0):(c.push(n),g(n));else if(!t.inited&&t.fetched&&e.isDefine){p=!0;if(!e.prefix)return d=!1}});if(l&&c.length)return i=makeError("timeout","Load timeout for modules: "+c,null,c),i.contextName=r.contextName,x(i);d&&each(h,function(e){C(e,{},{})}),(!l||u)&&p&&(isBrowser||isWebWorker)&&!s&&(s=setTimeout(function(){s=0,k()},50)),t=!1}function L(e){hasProp(c,e[0])||E(w(e[0],null,!0)).init(e[1],e[2])}function A(e,t,n,r){e.detachEvent&&!isOpera?r&&e.detachEvent(r,t):e.removeEventListener(n,t,!1)}function O(e){var t=e.currentTarget||e.srcElement;return A(t,r.onScriptLoad,"load","onreadystatechange"),A(t,r.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function M(){var e;T();while(l.length){e=l.shift();if(e[0]===null)return x(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));L(e)}}var t,n,r,i,s,o={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},u={},a={},f={},l=[],c={},h={},p=1,d=1;return i={require:function(e){return e.require?e.require:e.require=r.makeRequire(e.map)},exports:function(e){e.usingExports=!0;if(e.map.isDefine)return e.exports?e.exports:e.exports=c[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){var t,n=getOwn(o.pkgs,e.map.id);return t=n?getOwn(o.config,e.map.id+"/"+n.main):getOwn(o.config,e.map.id),t||{}},exports:c[e.map.id]}}},n=function(e){this.events=getOwn(f,e.id)||{},this.map=e,this.shim=getOwn(o.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},n.prototype={init:function(e,t,n,r){r=r||{};if(this.inited)return;this.factory=t,n?this.on("error",n):this.events.error&&(n=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=r.ignore,r.enabled||this.enabled?this.enable():this.check()},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(this.fetched)return;this.fetched=!0,r.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();r.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}))},load:function(){var e=this.map.url;h[e]||(h[e]=!0,r.load(this.map.id,e))},check:function(){if(!this.enabled||this.enabling)return;var e,t,n=this.map.id,i=this.depExports,s=this.exports,o=this.factory;if(!this.inited)this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){this.defining=!0;if(this.depCount<1&&!this.defined){if(isFunction(o)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{s=r.execCb(n,o,i,s)}catch(u){e=u}else s=r.execCb(n,o,i,s);this.map.isDefine&&(t=this.module,t&&t.exports!==undefined&&t.exports!==this.exports?s=t.exports:s===undefined&&this.usingExports&&(s=this.exports));if(e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",x(this.error=e)}else s=o;this.exports=s,this.map.isDefine&&!this.ignore&&(c[n]=s,req.onResourceLoad&&req.onResourceLoad(r,this.map,this.depMaps)),N(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}},callPlugin:function(){var e=this.map,t=e.id,n=w(e.prefix);this.depMaps.push(n),S(n,"defined",bind(this,function(n){var i,s,a,f=this.map.name,l=this.map.parentMap?this.map.parentMap.name:null,c=r.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){n.normalize&&(f=n.normalize(f,function(e){return m(e,l,!0)})||""),s=w(e.prefix+"!"+f,this.map.parentMap),S(s,"defined",bind(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),a=getOwn(u,s.id),a&&(this.depMaps.push(s),this.events.error&&a.on("error",bind(this,function(e){this.emit("error",e)})),a.enable());return}i=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),i.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(u,function(e){e.map.id.indexOf(t+"_unnormalized")===0&&N(e.map.id)}),x(e)}),i.fromText=bind(this,function(n,s){var u=e.name,a=w(u),f=useInteractive;s&&(n=s),f&&(useInteractive=!1),E(a),hasProp(o.config,t)&&(o.config[u]=o.config[t]);try{req.exec(n)}catch(l){return x(makeError("fromtexteval","fromText eval for "+t+" failed: "+l,l,[t]))}f&&(useInteractive=!0),this.depMaps.push(a),r.completeLoad(u),c([u],i)}),n.load(e.name,c,i,o)})),r.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){a[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var n,s,o;if(typeof e=="string"){e=w(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,o=getOwn(i,e.id);if(o){this.depExports[t]=o(this);return}this.depCount+=1,S(e,"defined",bind(this,function(e){this.defineDep(t,e),this.check()})),this.errback&&S(e,"error",bind(this,this.errback))}n=e.id,s=u[n],!hasProp(i,n)&&s&&!s.enabled&&r.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(u,e.id);t&&!t.enabled&&r.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var n=this.events[e];n||(n=this.events[e]=[]),n.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),e==="error"&&delete this.events[e]}},r={config:o,contextName:e,registry:u,defined:c,urlFetched:h,defQueue:l,Module:n,makeModuleMap:w,nextTick:req.nextTick,onError:x,configure:function(e){e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/");var t=o.pkgs,n=o.shim,i={paths:!0,config:!0,map:!0};eachProp(e,function(e,t){i[t]?t==="map"?(o.map||(o.map={}),mixin(o[t],e,!0,!0)):mixin(o[t],e,!0):o[t]=e}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),(e.exports||e.init)&&!e.exportsFn&&(e.exportsFn=r.makeShimExports(e)),n[t]=e}),o.shim=n),e.packages&&(each(e.packages,function(e){var n;e=typeof e=="string"?{name:e}:e,n=e.location,t[e.name]={name:e.name,location:n||e.name,main:(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}}),o.pkgs=t),eachProp(u,function(e,t){!e.inited&&!e.map.unnormalized&&(e.map=w(t))}),(e.deps||e.callback)&&r.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,n){function s(o,a,f){var l,h,p;return n.enableBuildCallback&&a&&isFunction(a)&&(a.__requireJsBuild=!0),typeof o=="string"?isFunction(a)?x(makeError("requireargs","Invalid require call"),f):t&&hasProp(i,o)?i[o](u[t.id]):req.get?req.get(r,o,t,s):(h=w(o,t,!1,!0),l=h.id,hasProp(c,l)?c[l]:x(makeError("notloaded",'Module name "'+l+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(M(),r.nextTick(function(){M(),p=E(w(null,t)),p.skipMap=n.skipMap,p.init(o,a,f,{enabled:!0}),k()}),s)}return n=n||{},mixin(s,{isBrowser:isBrowser,toUrl:function(e){var n,i=e.lastIndexOf("."),s=e.split("/")[0],o=s==="."||s==="..";return i!==-1&&(!o||i>1)&&(n=e.substring(i,e.length),e=e.substring(0,i)),r.nameToUrl(m(e,t&&t.id,!0),n,!0)},defined:function(e){return hasProp(c,w(e,t,!1,!0).id)},specified:function(e){return e=w(e,t,!1,!0).id,hasProp(c,e)||hasProp(u,e)}}),t||(s.undef=function(e){T();var n=w(e,t,!0),r=getOwn(u,e);delete c[e],delete h[n.url],delete f[e],r&&(r.events.defined&&(f[e]=r.events),N(e))}),s},enable:function(e){var t=getOwn(u,e.id);t&&E(e).enable()},completeLoad:function(e){var t,n,r,i=getOwn(o.shim,e)||{},s=i.exports;T();while(l.length){n=l.shift();if(n[0]===null){n[0]=e;if(t)break;t=!0}else n[0]===e&&(t=!0);L(n)}r=getOwn(u,e);if(!t&&!hasProp(c,e)&&r&&!r.inited){if(o.enforceDefine&&(!s||!getGlobal(s))){if(y(e))return;return x(makeError("nodefine","No define call for "+e,null,[e]))}L([e,i.deps||[],i.exportsFn])}k()},nameToUrl:function(e,t,n){var r,i,s,u,a,f,l,c,h;if(req.jsExtRegExp.test(e))c=e+(t||"");else{r=o.paths,i=o.pkgs,a=e.split("/");for(f=a.length;f>0;f-=1){l=a.slice(0,f).join("/"),s=getOwn(i,l),h=getOwn(r,l);if(h){isArray(h)&&(h=h[0]),a.splice(0,f,h);break}if(s){e===s.name?u=s.location+"/"+s.main:u=s.location,a.splice(0,f,u);break}}c=a.join("/"),c+=t||(/\?/.test(c)||n?"":".js"),c=(c.charAt(0)==="/"||c.match(/^[\w\+\.\-]+:/)?"":o.baseUrl)+c}return o.urlArgs?c+((c.indexOf("?")===-1?"?":"&")+o.urlArgs):c},load:function(e,t){req.load(r,e,t)},execCb:function(e,t,n,r){return t.apply(r,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=O(e);r.completeLoad(t.id)}},onScriptError:function(e){var t=O(e);if(!y(t.id))return x(makeError("scripterror","Script error for: "+t.id,e,[t.id]))}},r.require=r.makeRequire(),r}function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"?interactiveScript:(eachReverse(scripts(),function(e){if(e.readyState==="interactive")return interactiveScript=e}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.8",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,apsp=ap.splice,isBrowser=typeof window!="undefined"&&!!navigator&&!!window.document,isWebWorker=!isBrowser&&typeof importScripts!="undefined",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera!="undefined"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if(typeof define!="undefined")return;if(typeof requirejs!="undefined"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=undefined}typeof require!="undefined"&&!isFunction(require)&&(cfg=require,require=undefined),req=requirejs=function(e,t,n,r){var i,s,o=defContextName;return!isArray(e)&&typeof e!="string"&&(s=e,isArray(t)?(e=t,t=n,n=r):e=[]),s&&s.context&&(o=s.context),i=getOwn(contexts,o),i||(i=contexts[o]=req.s.newContext(o)),s&&i.configure(s),i.require(e,t,n)},req.config=function(e){return req(e)},req.nextTick=typeof setTimeout!="undefined"?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,n){var r=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return r.type=e.scriptType||"text/javascript",r.charset="utf-8",r.async=!0,r},req.load=function(e,t,n){var r=e&&e.config||{},i;if(isBrowser)return i=req.createNode(r,t,n),i.setAttribute("data-requirecontext",e.contextName),i.setAttribute("data-requiremodule",t),i.attachEvent&&!(i.attachEvent.toString&&i.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,i.attachEvent("onreadystatechange",e.onScriptLoad)):(i.addEventListener("load",e.onScriptLoad,!1),i.addEventListener("error",e.onScriptError,!1)),i.src=n,currentlyAddingScript=i,baseElement?head.insertBefore(i,baseElement):head.appendChild(i),currentlyAddingScript=null,i;if(isWebWorker)try{importScripts(n),e.completeLoad(t)}catch(s){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+n,s,[t]))}},isBrowser&&eachReverse(scripts(),function(e){head||(head=e.parentNode),dataMain=e.getAttribute("data-main");if(dataMain)return mainScript=dataMain,cfg.baseUrl||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(e,t,n){var r,i;typeof e!="string"&&(n=t,t=e,e=null),isArray(t)||(n=t,t=null),!t&&isFunction(n)&&(t=[],n.length&&(n.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(e,n){t.push(n)}),t=(n.length===1?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(r=currentlyAddingScript||getInteractiveScript(),r&&(e||(e=r.getAttribute("data-requiremodule")),i=contexts[r.getAttribute("data-requirecontext")])),(i?i.defQueue:globalDefQueue).push([e,t,n])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this);
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "underscore-amd",
3 | "homepage": "https://github.com/amdjs/underscore",
4 | "version": "1.5.1",
5 | "_release": "1.5.1",
6 | "_resolution": {
7 | "type": "version",
8 | "tag": "1.5.1",
9 | "commit": "569cb933afaf17d1a0874a62fb4b47fc793e824a"
10 | },
11 | "_source": "git://github.com/amdjs/underscore.git",
12 | "_target": "*",
13 | "_originalSource": "underscore-amd"
14 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/.gitignore:
--------------------------------------------------------------------------------
1 | raw
2 | node_modules
3 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/.npmignore:
--------------------------------------------------------------------------------
1 | test/
2 | Rakefile
3 | docs/
4 | raw/
5 | index.html
6 | underscore-min.js
7 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 0.8
4 | notifications:
5 | email: false
6 |
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/underscore.js:
--------------------------------------------------------------------------------
1 | // Underscore.js 1.5.1
2 | // http://underscorejs.org
3 | // (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4 | // Underscore may be freely distributed under the MIT license.
5 |
6 | (function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.5.1";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&r.push(e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?void 0:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;or||n===void 0)return 1;if(n>>1;n.call(r,e[u])=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=x.max(x.pluck(arguments,"length").concat(0)),t=new Array(e);for(var n=0;n=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&t.push(n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;var o=e.constructor,u=t.constructor;if(o!==u&&!(x.isFunction(o)&&o instanceof o&&x.isFunction(u)&&u instanceof u))return!1;n.push(e),r.push(t);var a=0,l=!0;if(i=="[object Array]"){a=e.length,l=a==t.length;if(l)while(a--)if(!(l=M(e[a],t[a],n,r)))break}else{for(var c in e)if(x.has(e,c)){a++;if(!(l=x.has(t,c)&&M(e[c],t[c],n,r)))break}if(l){for(c in t)if(x.has(t,c)&&!(a--))break;l=!a}}return n.pop(),r.pop(),l};x.isEqual=function(e,t){return M(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(Math.max(0,e));for(var i=0;i":">",'"':""","'":"'","/":"/"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return void 0;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=++P+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(j,function(e){return"\\"+B[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),typeof define=="function"&&define.amd&&define("underscore",[],function(){return x})}).call(this);
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/views/addMessage.js:
--------------------------------------------------------------------------------
1 | define(["backbone","channel"],function(e,t){return e.View.extend({el:".input-area",events:{"click .submit":"submit","keypress textarea":"submitOnEnter"},submit:function(){nwmsg=this.$el.find("textarea").val(),this.$el.find("textarea").val(""),t.trigger("addMsg",nwmsg)},submitOnEnter:function(e){console.log(e.keyCode),e.keyCode===13&&!e.shiftKey&&this.submit()}})});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/views/message.js:
--------------------------------------------------------------------------------
1 | define(["backbone","underscore","text!templates/message.tmpl"],function(e,t,n){return e.View.extend({tagName:"div",className:"monologue",template:t.template(n),render:function(){return this.$el.html(this.template(this.model.toJSON())),this}})});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/views/messages.js:
--------------------------------------------------------------------------------
1 | define(["backbone","views/message","channel"],function(e,t,n){return e.View.extend({tagName:"div",className:"chatMsgs",initialize:function(){$(".chatBox").html(this.el),this.collection.on("add",this.addOne,this),n.on("addMsg",this.addMsg,this),this.render(),$("html, body").animate({scrollTop:$(document).height()},1e3)},render:function(){return this.collection.each(this.addone,this),this},addOne:function(e){var n=new t({model:e});this.$el.append(n.render().el),$(window).scrollTop()+$(window).height()>$(document).height()-100&&$("html, body").animate({scrollTop:$(document).height()},500)},addone:function(e){var n=new t({model:e});this.$el.append(n.render().el)},addMsg:function(e){this.collection.create({msg:e},{wait:!0})}})});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/views/user.js:
--------------------------------------------------------------------------------
1 | define(["backbone","underscore","text!templates/user.tmpl"],function(e,t,n){return e.View.extend({tagName:"div",className:"s_user",template:t.template(n),render:function(){return this.$el.html(this.template(this.model.toJSON())),this}})});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/dist/scripts/views/users.js:
--------------------------------------------------------------------------------
1 | define(["backbone","views/user"],function(e,t){return e.View.extend({el:".onlineUsers",initialize:function(){this.collection.fetch(),this.collection.on("add",this.render,this),this.collection.on("remove",this.render,this)},render:function(){return console.log("........................................rendering............"),this.$el.html(""),this.collection.each(this.addOne,this),this},addOne:function(e){var n=new t({model:e});this.$el.append(n.render().el)}})});
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/less/main.less:
--------------------------------------------------------------------------------
1 | @color: #000;
2 |
3 | body {
4 | color: @color;
5 | }
6 | .clear-both{
7 | clear:both;
8 | float: none;
9 | height:0;
10 | }
11 | .chatBox {
12 | position: absolute;
13 | top: 0;
14 | left: 0;
15 | width: 80%;
16 |
17 | }
18 | .chatBox .chatMsgs{
19 | margin-bottom: 100px;
20 | }
21 | .monologue{
22 | margin-bottom: 10px;
23 | }
24 | .monologue .signature{
25 | float: left;
26 | width:10%;
27 | margin-right: 20px;
28 | }
29 | .monologue .signature .username{
30 | width:70%;
31 | float: right;
32 | font-size: 12px;
33 | line-height: 1.2em;
34 | overflow: hidden;
35 | margin-top: 5px;
36 | text-align: right;
37 | word-wrap:break-word;
38 |
39 | }
40 | .monologue .signature .avatar{
41 | width:20%;
42 | float: right;
43 | margin-left:5px;
44 | }
45 |
46 | .monologue .messages{
47 | float: left;
48 | width:80%;
49 | padding: 5px 10px;
50 | background-color: #eee;
51 | border-radius: 5px;
52 | word-wrap:break-word;
53 | }
54 | /*=======================================================================*/
55 | .sidebar {
56 | width: 18%;
57 | z-index: 5;
58 | position: fixed;
59 | right: 0;
60 | }
61 |
62 | .sidebar .side{
63 | background-color: #eee;
64 | border-radius: 5px;
65 | padding: 10px;
66 | margin-right: 20px;
67 | }
68 | .side h2{
69 | color: #333;
70 | }
71 | .onlineUsers .s_user{
72 | margin-bottom: 10px;
73 | }
74 | .onlineUsers .s_user .s_avatar{
75 | float: left;
76 | }
77 | .onlineUsers .s_user .s_username{
78 | float: left;
79 | }
80 | .onlineUsers .s_user .s_username a{
81 | text-decoration: none;
82 | font-size: 18px;
83 | color: #333;
84 | margin-left: 5px;
85 | word-wrap:break-word;
86 | }
87 |
88 | /* ================================================================= */
89 | .input-area{
90 | position: fixed;
91 | bottom: 0;
92 | z-index:6;
93 | width: 100%;
94 |
95 | background-color: #ccc;
96 | height:75px;
97 | box-shadow: 0px -2px 10px 1px #555;
98 |
99 | }
100 | .input-area img{
101 |
102 | float: left;
103 | text-align: center;
104 | margin: 5px;
105 | }
106 | .input-area .input-box{
107 | float: left;
108 | width:60%;
109 | background-color: #eee;
110 | resize:none;
111 |
112 | border:none;
113 | margin: 5px;
114 | height: 64px;
115 | }
116 | .input-area .submit{
117 | float: left;
118 | width:8%;
119 | height: 64px;
120 | margin: 5px;
121 | }
122 |
123 |
124 |
125 | #footer {
126 | position:fixed;
127 | left:0px;
128 | bottom:0px;
129 | height:70px;
130 | width:100%;
131 | background:#999;
132 | z-index: 9;
133 | }
--------------------------------------------------------------------------------
/djangoChat/static/djangoChat/todo.txt:
--------------------------------------------------------------------------------
1 | chat input format options - links images youtube embbed etc
2 | escape html
3 | allow selected tags in input
4 |
5 | admin stuff
6 | -------------------
7 | see logs
8 | ban users
9 |
10 |
11 | private messages ???
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/djangoChat/templates/djangoChat/base.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Django Chat Demo
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 | {% block body %}
17 | Hello, world!
18 |
19 |
20 |
21 | {% endblock body %}
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/djangoChat/templates/djangoChat/index.html:
--------------------------------------------------------------------------------
1 | {% extends "djangoChat/base.html" %}
2 | {% block body %}
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | {% endblock body %}
--------------------------------------------------------------------------------
/djangoChat/templates/djangoChat/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Log In
5 |
6 |
7 |
8 |
9 |
10 |
16 |
{{error}}
17 |
18 |
19 |
20 | for testing
21 | username = test , password = test
22 | username = test2 , password = test2
23 | username = test3 , password = test3
24 | username = test4 , password = test4
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/djangoChat/tests.py:
--------------------------------------------------------------------------------
1 | """
2 | This file demonstrates writing tests using the unittest module. These will pass
3 | when you run "manage.py test".
4 |
5 | Replace this with more appropriate tests for your application.
6 | """
7 |
8 | from django.test import TestCase
9 |
10 |
11 | class SimpleTest(TestCase):
12 | def test_basic_addition(self):
13 | """
14 | Tests that 1 + 1 always equals 2.
15 | """
16 | self.assertEqual(1 + 1, 2)
17 |
--------------------------------------------------------------------------------
/djangoChat/urls.py:
--------------------------------------------------------------------------------
1 | from django.conf.urls import patterns, url
2 |
3 | from djangoChat import views
4 |
5 | urlpatterns = patterns('',
6 | url(r'^$', views.index, name='index'),
7 | url(r'^login/$',views.login,name='login'),
8 | url(r'^logout/$',views.logout,name='logout'),
9 | url(r'^api/$',views.chat_api,name='chat_api'),
10 | url(r'^api/users/$',views.logged_chat_users,name='logged_chat_users'),
11 | url(r'^api/users/update/$',views.update_time,name='update_time')
12 | )
--------------------------------------------------------------------------------
/djangoChat/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 | from django.http import HttpResponseRedirect
3 | from django.http import HttpResponse
4 | from django.contrib import auth
5 | from django.core.context_processors import csrf
6 | from django.core.urlresolvers import reverse
7 | from django.views.decorators.csrf import csrf_exempt
8 | import json
9 | from djangoChat.models import Message, ChatUser
10 | from django.contrib.auth.models import User
11 | import datetime
12 | from django.utils.timezone import now as utcnow
13 | from django.utils.safestring import mark_safe
14 |
15 |
16 |
17 | def index(request):
18 |
19 | if request.user.username and request.user.profile.is_chat_user:
20 | # intial chat json data
21 |
22 | r = Message.objects.order_by('-time')[:20]
23 | res = []
24 | for msgs in reversed(r) :
25 | res.append({'id':msgs.id,'user':msgs.user,'msg':msgs.message,'time':msgs.time.strftime('%I:%M:%S %p').lstrip('0'),'gravatar':msgs.gravatar})
26 |
27 | data = json.dumps(res)
28 | # end json
29 | context = {'data':mark_safe(data)}
30 | return render(request, 'djangoChat/index.html', context)
31 | else:
32 | return HttpResponseRedirect(reverse('login'))
33 |
34 | def login(request):
35 | if request.user.username and request.user.profile.is_chat_user:
36 | return HttpResponseRedirect(reverse('index'))
37 | context = {'error':''}
38 |
39 | if request.method == 'POST':
40 | username = request.POST.get('username','') #retunr '' if no username
41 | password = request.POST.get('password','')
42 |
43 | user = auth.authenticate(username=username,password=password)
44 |
45 | if user is not None:
46 | auth.login(request,user)
47 | cu = request.user.profile
48 | cu.is_chat_user = True
49 | cu.last_accessed = utcnow()
50 | cu.save()
51 |
52 |
53 |
54 | return HttpResponseRedirect(reverse('index'))
55 | else:
56 | context['error'] = ' wrong credentials try again'
57 | return render(request,'djangoChat/login.html',context)
58 |
59 |
60 | context.update(csrf(request))
61 | return render(request,'djangoChat/login.html',context)
62 |
63 |
64 | def logout(request):
65 | cu = request.user.profile
66 | cu.is_chat_user = False
67 | cu.save()
68 | return HttpResponse('succesfully logged out of chat')
69 |
70 | @csrf_exempt
71 | def chat_api(request):
72 | if request.method == 'POST':
73 | d = json.loads(request.body)
74 | msg = d.get('msg')
75 | user = request.user.username
76 | gravatar = request.user.profile.gravatar_url
77 | m = Message(user=user,message=msg,gravatar=gravatar)
78 | m.save()
79 |
80 |
81 | res = {'id':m.id,'msg':m.message,'user':m.user,'time':m.time.strftime('%I:%M:%S %p').lstrip('0'),'gravatar':m.gravatar}
82 | data = json.dumps(res)
83 | return HttpResponse(data,content_type="application/json")
84 |
85 |
86 | # get request
87 | r = Message.objects.order_by('-time')[:20]
88 | res = []
89 | for msgs in reversed(r) :
90 | res.append({'id':msgs.id,'user':msgs.user,'msg':msgs.message,'time':msgs.time.strftime('%I:%M:%S %p').lstrip('0'),'gravatar':msgs.gravatar})
91 |
92 | data = json.dumps(res)
93 |
94 |
95 | return HttpResponse(data,content_type="application/json")
96 |
97 |
98 | def logged_chat_users(request):
99 |
100 | u = ChatUser.objects.filter(is_chat_user=True)
101 | for k in u:
102 | print k.username
103 | for j in u:
104 | elapsed = utcnow() - j.last_accessed
105 | if elapsed > datetime.timedelta(seconds=45):
106 | print elapsed
107 | j.is_chat_user = False
108 | j.save()
109 |
110 | uu = ChatUser.objects.filter(is_chat_user=True)
111 | print "after check time and update"
112 | for k in uu:
113 | print k.username
114 |
115 | d = []
116 | for i in uu:
117 | d.append({'username': i.username,'gravatar':i.gravatar_url,'id':i.userID})
118 | data = json.dumps(d)
119 |
120 |
121 | return HttpResponse(data,content_type="application/json")
122 |
123 |
124 | def update_time(request):
125 | if request.user.username:
126 | print request.user.username
127 | u = request.user.profile
128 | print u.last_accessed
129 | print utcnow()
130 | u.last_accessed = utcnow()
131 | u.is_chat_user = True
132 | u.save()
133 | print u.last_accessed
134 | return HttpResponse('updated')
135 | return HttpResponse('who are you?')
--------------------------------------------------------------------------------
/django_ajax_chat.egg-info/PKG-INFO:
--------------------------------------------------------------------------------
1 | Metadata-Version: 1.1
2 | Name: django-ajax-chat
3 | Version: 0.2
4 | Summary: A simple Django ajax chat.
5 | Home-page: https://github.com/sharan01/django-ajax-chat
6 | Author: sharan salokye
7 | Author-email: salokye@sharan.co
8 | License: MIT License
9 | Description: =====
10 | Django Chat
11 | =====
12 |
13 | DjangoChat is a simple Django Chat app
14 |
15 |
16 | demo
17 | ----
18 | http://www.sharan.co/chat/
19 |
20 | Quick start
21 | -----------
22 |
23 | 1. Add "djangoChat" to your INSTALLED_APPS setting like this::
24 |
25 | INSTALLED_APPS = (
26 | ...
27 | 'djangoChat',
28 | )
29 |
30 | 2. Include the polls URLconf in your project urls.py like this::
31 |
32 | url(r'^chat/', include('djangoChat.urls')),
33 |
34 | 3. Run `python manage.py migrate` to create the djangoChat models.
35 |
36 | 4. Start the development server and visit http://127.0.0.1:8000/chat/
37 |
38 | =====
39 | to do list
40 | =====
41 | improve sidebar
42 | chat input format options - links images youtube embbed etc
43 | escape html
44 | allow selected tags in input
45 |
46 | admin stuff
47 | see logs
48 | private messages ???
49 |
50 |
51 |
52 | Platform: UNKNOWN
53 | Classifier: Environment :: Web Environment
54 | Classifier: Framework :: Django
55 | Classifier: Intended Audience :: Developers
56 | Classifier: License :: OSI Approved :: MIT License
57 | Classifier: Operating System :: OS Independent
58 | Classifier: Programming Language :: Python
59 | Classifier: Programming Language :: Python :: 2
60 | Classifier: Programming Language :: Python :: 2.7
61 | Classifier: Topic :: Internet :: WWW/HTTP
62 | Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
63 |
--------------------------------------------------------------------------------
/django_ajax_chat.egg-info/SOURCES.txt:
--------------------------------------------------------------------------------
1 | MANIFEST.in
2 | README.rst
3 | setup.py
4 | djangoChat/__init__.py
5 | djangoChat/admin.py
6 | djangoChat/models.py
7 | djangoChat/tests.py
8 | djangoChat/urls.py
9 | djangoChat/views.py
10 | djangoChat/static/djangoChat/bower.json
11 | djangoChat/static/djangoChat/todo.txt
12 | djangoChat/static/djangoChat/app/build/app.build.js
13 | djangoChat/static/djangoChat/app/scripts/channel.js
14 | djangoChat/static/djangoChat/app/scripts/main.js
15 | djangoChat/static/djangoChat/app/scripts/collections/messages.js
16 | djangoChat/static/djangoChat/app/scripts/collections/users.js
17 | djangoChat/static/djangoChat/app/scripts/models/message.js
18 | djangoChat/static/djangoChat/app/scripts/models/user.js
19 | djangoChat/static/djangoChat/app/scripts/templates/message.tmpl
20 | djangoChat/static/djangoChat/app/scripts/templates/user.tmpl
21 | djangoChat/static/djangoChat/app/scripts/vendor/backbone-amd/.bower.json
22 | djangoChat/static/djangoChat/app/scripts/vendor/backbone-amd/.gitignore
23 | djangoChat/static/djangoChat/app/scripts/vendor/backbone-amd/.npmignore
24 | djangoChat/static/djangoChat/app/scripts/vendor/backbone-amd/.travis.yml
25 | djangoChat/static/djangoChat/app/scripts/vendor/backbone-amd/backbone.js
26 | djangoChat/static/djangoChat/app/scripts/vendor/jquery/.bower.json
27 | djangoChat/static/djangoChat/app/scripts/vendor/jquery/.gitignore
28 | djangoChat/static/djangoChat/app/scripts/vendor/jquery/jquery.js
29 | djangoChat/static/djangoChat/app/scripts/vendor/jquery-legacy/.bower.json
30 | djangoChat/static/djangoChat/app/scripts/vendor/jquery-legacy/.gitignore
31 | djangoChat/static/djangoChat/app/scripts/vendor/jquery-legacy/jquery.js
32 | djangoChat/static/djangoChat/app/scripts/vendor/requirejs/.bower.json
33 | djangoChat/static/djangoChat/app/scripts/vendor/requirejs/.gitignore
34 | djangoChat/static/djangoChat/app/scripts/vendor/requirejs/require.js
35 | djangoChat/static/djangoChat/app/scripts/vendor/requirejs-text/.bower.json
36 | djangoChat/static/djangoChat/app/scripts/vendor/requirejs-text/text.js
37 | djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/.bower.json
38 | djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/.gitignore
39 | djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/.npmignore
40 | djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/.travis.yml
41 | djangoChat/static/djangoChat/app/scripts/vendor/underscore-amd/underscore.js
42 | djangoChat/static/djangoChat/app/scripts/views/addMessage.js
43 | djangoChat/static/djangoChat/app/scripts/views/message.js
44 | djangoChat/static/djangoChat/app/scripts/views/messages.js
45 | djangoChat/static/djangoChat/app/scripts/views/user.js
46 | djangoChat/static/djangoChat/app/scripts/views/users.js
47 | djangoChat/static/djangoChat/css/main.css
48 | djangoChat/static/djangoChat/css/normalize.css
49 | djangoChat/static/djangoChat/dist/build.txt
50 | djangoChat/static/djangoChat/dist/build/app.build.js
51 | djangoChat/static/djangoChat/dist/scripts/channel.js
52 | djangoChat/static/djangoChat/dist/scripts/main.js
53 | djangoChat/static/djangoChat/dist/scripts/collections/messages.js
54 | djangoChat/static/djangoChat/dist/scripts/collections/users.js
55 | djangoChat/static/djangoChat/dist/scripts/models/message.js
56 | djangoChat/static/djangoChat/dist/scripts/models/user.js
57 | djangoChat/static/djangoChat/dist/scripts/templates/message.tmpl
58 | djangoChat/static/djangoChat/dist/scripts/templates/user.tmpl
59 | djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/.bower.json
60 | djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/.gitignore
61 | djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/.npmignore
62 | djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/.travis.yml
63 | djangoChat/static/djangoChat/dist/scripts/vendor/backbone-amd/backbone.js
64 | djangoChat/static/djangoChat/dist/scripts/vendor/jquery/.bower.json
65 | djangoChat/static/djangoChat/dist/scripts/vendor/jquery/.gitignore
66 | djangoChat/static/djangoChat/dist/scripts/vendor/jquery/jquery.js
67 | djangoChat/static/djangoChat/dist/scripts/vendor/jquery-legacy/.bower.json
68 | djangoChat/static/djangoChat/dist/scripts/vendor/jquery-legacy/.gitignore
69 | djangoChat/static/djangoChat/dist/scripts/vendor/jquery-legacy/jquery.js
70 | djangoChat/static/djangoChat/dist/scripts/vendor/requirejs/.bower.json
71 | djangoChat/static/djangoChat/dist/scripts/vendor/requirejs/.gitignore
72 | djangoChat/static/djangoChat/dist/scripts/vendor/requirejs/require.js
73 | djangoChat/static/djangoChat/dist/scripts/vendor/requirejs-text/.bower.json
74 | djangoChat/static/djangoChat/dist/scripts/vendor/requirejs-text/text.js
75 | djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/.bower.json
76 | djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/.gitignore
77 | djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/.npmignore
78 | djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/.travis.yml
79 | djangoChat/static/djangoChat/dist/scripts/vendor/underscore-amd/underscore.js
80 | djangoChat/static/djangoChat/dist/scripts/views/addMessage.js
81 | djangoChat/static/djangoChat/dist/scripts/views/message.js
82 | djangoChat/static/djangoChat/dist/scripts/views/messages.js
83 | djangoChat/static/djangoChat/dist/scripts/views/user.js
84 | djangoChat/static/djangoChat/dist/scripts/views/users.js
85 | djangoChat/static/djangoChat/less/main.less
86 | djangoChat/static/djangoChat/otherjs/less.js
87 | djangoChat/templates/djangoChat/base.html
88 | djangoChat/templates/djangoChat/index.html
89 | djangoChat/templates/djangoChat/login.html
90 | django_ajax_chat.egg-info/PKG-INFO
91 | django_ajax_chat.egg-info/SOURCES.txt
92 | django_ajax_chat.egg-info/dependency_links.txt
93 | django_ajax_chat.egg-info/top_level.txt
--------------------------------------------------------------------------------
/django_ajax_chat.egg-info/dependency_links.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/django_ajax_chat.egg-info/top_level.txt:
--------------------------------------------------------------------------------
1 | djangoChat
2 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | import os
2 | from setuptools import setup
3 |
4 | README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
5 |
6 | # allow setup.py to be run from any path
7 | os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
8 |
9 | setup(
10 | name='django-ajax-chat',
11 | version='0.2',
12 | packages=['djangoChat'],
13 | include_package_data=True,
14 | license='MIT License',
15 | description='A simple Django ajax chat.',
16 | long_description=README,
17 | url='https://github.com/sharan01/django-ajax-chat',
18 | author='sharan salokye',
19 | author_email='salokye@sharan.co',
20 | classifiers=[
21 | 'Environment :: Web Environment',
22 | 'Framework :: Django',
23 | 'Intended Audience :: Developers',
24 | 'License :: OSI Approved :: MIT License', # example license
25 | 'Operating System :: OS Independent',
26 | 'Programming Language :: Python',
27 | # replace these appropriately if you are using Python 3
28 | 'Programming Language :: Python :: 2',
29 | 'Programming Language :: Python :: 2.7',
30 | 'Topic :: Internet :: WWW/HTTP',
31 | 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
32 | ],
33 | )
34 |
35 |
36 |
--------------------------------------------------------------------------------