Download:
child 32:ccf41c7443de
parent 30:32d1f208206f
31:d0248d45562f
Anton Shestakov <av6@dwimlabs.net>, Mon, 21 Mar 2016 23:01:44 +0800
contacts: add avatars and fallback option (background color from hashed jid)

17 файлов изменено, 195 вставок(+), 10 удалений(-) [+]
coffee/contacts.coffee file | annotate | diff | comparison | revisions
coffee/index.coffee file | annotate | diff | comparison | revisions
coffee/messages.coffee file | annotate | diff | comparison | revisions
coffee/rivets.coffee file | annotate | diff | comparison | revisions
coffee/tram.coffee file | annotate | diff | comparison | revisions
css/tram-im.css file | annotate | diff | comparison | revisions
index.html file | annotate | diff | comparison | revisions
js/contacts.js file | annotate | diff | comparison | revisions
js/contacts.js.map file | annotate | diff | comparison | revisions
js/index.js file | annotate | diff | comparison | revisions
js/index.js.map file | annotate | diff | comparison | revisions
js/messages.js file | annotate | diff | comparison | revisions
js/messages.js.map file | annotate | diff | comparison | revisions
js/rivets.js file | annotate | diff | comparison | revisions
js/rivets.js.map file | annotate | diff | comparison | revisions
js/tram.js file | annotate | diff | comparison | revisions
js/tram.js.map file | annotate | diff | comparison | revisions
--- a/coffee/contacts.coffee Mon Mar 21 22:56:28 2016 +0800
+++ b/coffee/contacts.coffee Mon Mar 21 23:01:44 2016 +0800
@@ -33,6 +33,32 @@
@on('change:presence change:type', @sort)
+class Tram.AvatarView extends Backbone.View
+ tagName: 'div'
+ className: 'vignette'
+ colors: Tram.colors.avatar
+ template: $('#avatar-template').html()
+
+ hash: (string) ->
+ result = 0
+ for i in [0...string.length]
+ result += string.charCodeAt(i)
+ result
+
+ getHashedColors: ->
+ ci = @hash(@model.get 'jid') % @colors.length
+ "color: white; background: #{ @colors[ci] };"
+
+ render: ->
+ @$el.html @template
+ @rivet = rivets.bind(@el, model: @model, view: this)
+ @
+
+ remove: ->
+ @rivet.unbind()
+ super
+
+
class Tram.ContactView extends Backbone.View
tagName: 'li'
className: 'contact'
@@ -43,6 +69,7 @@
@$el.attr('data-jid', @model.get('jid'))
@$el.html(@template)
+ @$avatarColumn = @$('.avatar-column')
@bind()
@@ -53,6 +80,8 @@
render: ->
@rivet = rivets.bind(@el, model: @model, view: this)
+ av = new Tram.AvatarView(model: @model)
+ @$avatarColumn.prepend av.render().el
@
remove: ->
--- a/coffee/index.coffee Mon Mar 21 22:56:28 2016 +0800
+++ b/coffee/index.coffee Mon Mar 21 23:01:44 2016 +0800
@@ -96,6 +96,14 @@
firstname: getText(vcard.querySelector('N > GIVEN'))
lastname: getText(vcard.querySelector('N > FAMILY'))
+ mime = getText(vcard.querySelector('PHOTO > TYPE'))
+ data = getText(vcard.querySelector('PHOTO > BINVAL'))
+
+ if mime and data
+ contact.set('avatar', mime: mime, data: data)
+ else
+ contact.unset('avatar')
+
failcb = (stanza) ->
console.warn("couldn't get vcard", stanza)
--- a/coffee/messages.coffee Mon Mar 21 22:56:28 2016 +0800
+++ b/coffee/messages.coffee Mon Mar 21 23:01:44 2016 +0800
@@ -56,16 +56,27 @@
initialize: ->
@$el.html(@template)
+ @$avatarColumn = @$('.avatar-column')
@bind()
bind: ->
+ @listenTo(@model, 'change:contact', @updateContact)
+
+ updateContact: ->
+ if not @model.previous('contact')? and @model.get('contact')?
+ av = new Tram.AvatarView(model: contact)
+ @$avatarColumn.prepend(av.render().el)
getHandle: ->
@model.get('contact')?.get('d/handle') or @model.get('from')
render: (model) ->
@rivet = rivets.bind(@el, model: @model, view: this)
+ contact = @model.get('contact')
+ if contact
+ av = new Tram.AvatarView(model: contact)
+ @$avatarColumn.prepend(av.render().el)
@
remove: ->
--- a/coffee/rivets.coffee Mon Mar 21 22:56:28 2016 +0800
+++ b/coffee/rivets.coffee Mon Mar 21 23:01:44 2016 +0800
@@ -12,6 +12,10 @@
obj.set(keypath, value)
+rivets.formatters['first-letter'] = (value) ->
+ if value? then value.charAt(0) else ' '
+
+
rivets.formatters['only'] = (value, allowed...) ->
if value in allowed then value else ''
--- a/coffee/tram.coffee Mon Mar 21 22:56:28 2016 +0800
+++ b/coffee/tram.coffee Mon Mar 21 23:01:44 2016 +0800
@@ -14,3 +14,15 @@
xa: '#d9534f'
unavailable: '#777'
default: '#337ab7'
+ avatar: [
+ '#f75782',
+ '#d27b2b',
+ '#a5902b',
+ '#759d2b',
+ '#2da46b',
+ '#2fa196',
+ '#319db4',
+ '#4292f4',
+ '#c16af4',
+ '#f545cd'
+ ]
--- a/css/tram-im.css Mon Mar 21 22:56:28 2016 +0800
+++ b/css/tram-im.css Mon Mar 21 23:01:44 2016 +0800
@@ -34,9 +34,31 @@
.avatar-column {
position: relative;
}
+.avatar-column .vignette {
+ border-radius: 50%;
+ overflow: hidden;
+ margin-right: 8px;
+ height: 48px;
+ width: 48px;
+ line-height: 48px;
+}
+.avatar-column.uk-invisible .vignette {
+ max-height: 1px;
+}
+.avatar {
+ max-height: 48px;
+ max-width: 48px;
+}
+div.avatar {
+ height: 48px;
+ width: 48px;
+ text-align: center;
+ font-size: 32px;
+ font-weight: 700;
+}
.status-pip {
position: absolute;
- right: 0;
+ right: 8px;
bottom: 0;
border-radius: 50%;
width: 11px;
--- a/index.html Mon Mar 21 22:56:28 2016 +0800
+++ b/index.html Mon Mar 21 23:01:44 2016 +0800
@@ -70,8 +70,13 @@
</div>
</div>
+ <script type="text/template" id="avatar-template">
+ <img class="avatar" rv-if="model:d/avatar" rv-src="model:d/avatar">
+ <div class="avatar" rv-unless="model:d/avatar" rv-text="model:d/handle | first-letter" rv-style="view.getHashedColors < model:jid"></div>
+ </script>
<script type="text/template" id="message-template">
<div class="splitter" rv-if="model:d/split"></div>
+ <div class="column avatar-column" rv-class-uk-invisible="model:d/fold"></div>
<div class="column uk-width-1-1">
<div style="padding-top: 4px;" rv-hide="model:d/fold">
<strong rv-text="view.getHandle < model:contact:d/handle model:from"></strong>
--- a/js/contacts.js Mon Mar 21 22:56:28 2016 +0800
+++ b/js/contacts.js Mon Mar 21 23:01:44 2016 +0800
@@ -65,6 +65,54 @@
})(Backbone.Collection);
+ Tram.AvatarView = (function(superClass) {
+ extend(AvatarView, superClass);
+
+ function AvatarView() {
+ return AvatarView.__super__.constructor.apply(this, arguments);
+ }
+
+ AvatarView.prototype.tagName = 'div';
+
+ AvatarView.prototype.className = 'vignette';
+
+ AvatarView.prototype.colors = Tram.colors.avatar;
+
+ AvatarView.prototype.template = $('#avatar-template').html();
+
+ AvatarView.prototype.hash = function(string) {
+ var i, j, ref, result;
+ result = 0;
+ for (i = j = 0, ref = string.length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
+ result += string.charCodeAt(i);
+ }
+ return result;
+ };
+
+ AvatarView.prototype.getHashedColors = function() {
+ var ci;
+ ci = this.hash(this.model.get('jid')) % this.colors.length;
+ return "color: white; background: " + this.colors[ci] + ";";
+ };
+
+ AvatarView.prototype.render = function() {
+ this.$el.html(this.template);
+ this.rivet = rivets.bind(this.el, {
+ model: this.model,
+ view: this
+ });
+ return this;
+ };
+
+ AvatarView.prototype.remove = function() {
+ this.rivet.unbind();
+ return AvatarView.__super__.remove.apply(this, arguments);
+ };
+
+ return AvatarView;
+
+ })(Backbone.View);
+
Tram.ContactView = (function(superClass) {
extend(ContactView, superClass);
@@ -83,6 +131,7 @@
ContactView.prototype.initialize = function() {
this.$el.attr('data-jid', this.model.get('jid'));
this.$el.html(this.template);
+ this.$avatarColumn = this.$('.avatar-column');
return this.bind();
};
@@ -93,10 +142,15 @@
};
ContactView.prototype.render = function() {
+ var av;
this.rivet = rivets.bind(this.el, {
model: this.model,
view: this
});
+ av = new Tram.AvatarView({
+ model: this.model
+ });
+ this.$avatarColumn.prepend(av.render().el);
return this;
};
--- a/js/contacts.js.map Mon Mar 21 22:56:28 2016 +0800
+++ b/js/contacts.js.map Mon Mar 21 23:01:44 2016 +0800
@@ -6,5 +6,5 @@
"coffee/contacts.coffee"
],
"names": [],
- "mappings": ";AAAA;AAAA,MAAA;;;EAAM,IAAI,CAAC;;;;;;;sBACT,WAAA,GAAa;;sBACb,QAAA,GACE;MAAA,QAAA,EAAU,aAAV;;;sBAEF,UAA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AAb,EADF;OAAA,MAAA;eAGE,IAAC,CAAA,GAAG,CAAC,QAAL,CAAA,CAAe,CAAC,EAAhB,CAAmB,EAAA,GAAK,CAAxB,CAA0B,CAAC,KAA3B,CAAiC,EAAjC,EAHF;;IAJK;;0BASP,MAAA,GAAQ,SAAC,UAAD,EAAa,OAAb;MACN,IAAG,CAAI,OAAO,CAAC,GAAf;eACE,UAAU,CAAC,IAAX,CAAgB,CAAA,SAAA,KAAA;iBAAA,SAAC,KAAD;YACd,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAf,CAAA;mBACA,KAAC,CAAA,GAAG,CAAC,MAAL,CAAY,KAAK,CAAC,IAAI,CAAC,EAAvB;UAFc;QAAA,CAAA,CAAA,CAAA,IAAA,CAAhB,EADF;;IADM;;;;KAdqB,QAAQ,CAAC;AA3FxC"
}
\ No newline at end of file
--- a/js/index.js Mon Mar 21 22:56:28 2016 +0800
+++ b/js/index.js Mon Mar 21 23:01:44 2016 +0800
@@ -117,18 +117,28 @@
getContactProfile = function(contact) {
var bjid, failcb, okcb;
okcb = function(stanza) {
- var vcard;
+ var data, mime, vcard;
vcard = stanza.getElementsByTagName('vCard')[0];
if (!vcard) {
console.warn("no vcard in response", stanza);
return;
}
- return contact.set({
+ contact.set({
nickname: getText(vcard.querySelector('NICKNAME')),
fullname: getText(vcard.querySelector('FN')),
firstname: getText(vcard.querySelector('N > GIVEN')),
lastname: getText(vcard.querySelector('N > FAMILY'))
});
+ mime = getText(vcard.querySelector('PHOTO > TYPE'));
+ data = getText(vcard.querySelector('PHOTO > BINVAL'));
+ if (mime && data) {
+ return contact.set('avatar', {
+ mime: mime,
+ data: data
+ });
+ } else {
+ return contact.unset('avatar');
+ }
};
failcb = function(stanza) {
return console.warn("couldn't get vcard", stanza);
--- a/js/index.js.map Mon Mar 21 22:56:28 2016 +0800
+++ b/js/index.js.map Mon Mar 21 23:01:44 2016 +0800
@@ -6,5 +6,5 @@
"coffee/index.coffee"
],
"names": [],
- "mappings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AI,IAAC,CAAA,QAAL,IAAiB,IAAC,CAAA,KAAD,KAAY,EAA9B,CAAA,IAAsC,CAAC,CAAC,OAAF,KAAa,EAAtD;MACE,CAAC,CAAC,cAAF,CAAA;MACA,KAAA,GAAQ,KAAK,CAAC,IAAN,CAAW,OAAX,CAAmB,CAAC,KAApB,CAA0B,IAA1B;MACR,KAAA,GAAQ,KAAK,CAAC,IAAN,CAAW,OAAX,CAAmB,CAAC,EAApB,CAAuB,KAAA,GAAQ,CAA/B;MACR,IAAG,KAAK,CAAC,MAAN,KAAkB,CAArB;eACE,KAAK,CAAC,KAAN,CAAA,EADF;OAAA,MAAA;eAGE,KAAK,CAAC,IAAN,CAAW,QAAX,CAAoB,CAAC,OAArB,CAA6B,OAA7B,EAHF;OAJF;;EADgC,CAAlC;;EAWA,KAAK,CAAC,IAAN,CAAW,QAAX,CAAoB,CAAC,EAArB,CAAwB,OAAxB,EAAiC,SAAC,CAAD;AAC/B,QAAA;IAAA,CAAC,CAAC,cAAF,CAAA;IACA,EAAA,GAAK;IACL,IAAI,CAAC,UAAU,CAAC,UAAhB,CAA2B,CAAA,CAAE,sBAAF,CAA3B;IACA,EAAA,IAAM,IAAI,CAAC,UAAU,CAAC,gBAAhB,CAAiC,CAAA,CAAE,WAAF,CAAjC,EAAiD,IAAjD;IACN,EAAA,IAAM,IAAI,CAAC,UAAU,CAAC,gBAAhB,CAAiC,CAAA,CAAE,WAAF,CAAjC;IACN,IAAG,EAAH;aACE,CAAC,CAAC,OAAF,CAAU,CAAA,CAAE,WAAF,CAAc,CAAC,GAAf,CAAA,CAAoB,CAAC,IAArB,CAAA,CAAV,EAAuC,CAAA,CAAE,WAAF,CAAc,CAAC,GAAf,CAAA,CAAvC,EADF;;EAN+B,CAAjC;AA9MA"
}
\ No newline at end of file
--- a/js/messages.js Mon Mar 21 22:56:28 2016 +0800
+++ b/js/messages.js Mon Mar 21 23:01:44 2016 +0800
@@ -97,10 +97,23 @@
MessageView.prototype.initialize = function() {
this.$el.html(this.template);
+ this.$avatarColumn = this.$('.avatar-column');
return this.bind();
};
- MessageView.prototype.bind = function() {};
+ MessageView.prototype.bind = function() {
+ return this.listenTo(this.model, 'change:contact', this.updateContact);
+ };
+
+ MessageView.prototype.updateContact = function() {
+ var av;
+ if ((this.model.previous('contact') == null) && (this.model.get('contact') != null)) {
+ av = new Tram.AvatarView({
+ model: contact
+ });
+ return this.$avatarColumn.prepend(av.render().el);
+ }
+ };
MessageView.prototype.getHandle = function() {
var ref;
@@ -108,10 +121,18 @@
};
MessageView.prototype.render = function(model) {
+ var av, contact;
this.rivet = rivets.bind(this.el, {
model: this.model,
view: this
});
+ contact = this.model.get('contact');
+ if (contact) {
+ av = new Tram.AvatarView({
+ model: contact
+ });
+ this.$avatarColumn.prepend(av.render().el);
+ }
return this;
};
--- a/js/messages.js.map Mon Mar 21 22:56:28 2016 +0800
+++ b/js/messages.js.map Mon Mar 21 23:01:44 2016 +0800
@@ -6,5 +6,5 @@
"coffee/messages.coffee"
],
"names": [],
- "mappings": ";AAAA;AAAA,MAAA;;;EAAM,IAAI,CAAC;;;;;;;sBACT,UAAA,GAAY,SAAA;aACV,IAAC,CAAA,EAAD,CAAI,kBAAJ,EAAwB,SAAA;QACtB,IAAG,IAAC,CAAA,GAAD,CAAK,OAAL,CAAH;iBACE,IAAC,CAAA,GAAD,CAAK,UAAL,EAAiB,MAAA,CAAO,IAAC,CAAA,GAAD,CAAK,OAAL,CAAP,CAAjB,EADF;SAAA,MAAA;iBAGE,IAAC,CAAA,KAAD,CAAO,UAAP,EAHF;;MADsB,CAAxB;IADU;;;;KADa,QAAQ,CAAC;;EAS9B,IAAI,CAAC;;;;;;;uBACT,KAAA,GAAO,IAAI,CAAC;;uBACZ,cAAA,GAAgB,EAAA,GAAK,EAAL,GAAU;;uBAC1B,aAAA,GAAe,EAAA,GAAK;;uBAEpB,UAAA,GAAY,SAAC,KAAD;aACV,KAAK,CAAC,GAAN,CAAU,OAAV,CAAkB,CAAC,OAAnB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,CAAC,MAAL,CAAA,CAAnB,KAAoC,IAAC,CAAA,GAAG,CAAC,GAAL,CAAS,CAAT,CAAW,CAAC;IAD/C;;qBAGV,MAAA,GAAQ,SAAA;aACN,IAAC,CAAA,GAAG,CAAC,SAAL,CAAe,IAAC,CAAA,GAAG,CAAC,GAAL,CAAS,CAAT,CAAW,CAAC,YAA3B;IADM;;;;KAnBgB,QAAQ,CAAC;AAtFnC"
}
\ No newline at end of file
--- a/js/rivets.js Mon Mar 21 22:56:28 2016 +0800
+++ b/js/rivets.js Mon Mar 21 23:01:44 2016 +0800
@@ -18,6 +18,14 @@
}
};
+ rivets.formatters['first-letter'] = function(value) {
+ if (value != null) {
+ return value.charAt(0);
+ } else {
+ return ' ';
+ }
+ };
+
rivets.formatters['only'] = function() {
var allowed, value;
value = arguments[0], allowed = 2 <= arguments.length ? slice.call(arguments, 1) : [];
--- a/js/rivets.js.map Mon Mar 21 22:56:28 2016 +0800
+++ b/js/rivets.js.map Mon Mar 21 23:01:44 2016 +0800
@@ -6,5 +6,5 @@
"coffee/rivets.coffee"
],
"names": [],
- "mappings": ";AAAA;AAAA,MAAA;;;EAAA,MAAM,CAAC,QAAS,CAAA,GAAA,CAAhB,GACE;IAAA,OAAA,EAAS,SAAC,GAAD,EAAM,OAAN,EAAe,QAAf;aACP,GAAG,CAAC,EAAJ,CAAO,SAAA,GAAY,OAAnB,EAA4B,QAA5B;IADO,CAAT;IAGA,SAAA,EAAW,SAAC,GAAD,EAAM,OAAN,EAAe,QAAf;aACT,GAAG,CAAC,GAAJ,CAAQ,SAAA,GAAY,OAApB,EAA6B,QAA7B;IADS,CAHX;IAMA,GAAA,EAAK,SAAC,GAAD,EAAM,OAAN;aACH,GAAG,CAAC,GAAJ,CAAQ,OAAR;IADG,CANL;IASA,GAAA,EAAK,SAAC,GAAD,EAAM,OAAN,EAAe,KAAf;aACH,GAAG,CAAC,GAAJ,CAAQ,OAAR,EAAiB,KAAjB;IADG,CATL;;;EAaF,MAAM,CAA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H,GAAG,CAAC,GAAJ,CAAQ,OAAR,EAAiB,KAAjB;IADG,CATL;;;EAaF,MAAM,CAAC,UAAW,CAAA,cAAA,CAAlB,GAAoC,SAAC,KAAD;IAClC,IAAG,aAAH;aAAe,KAAK,CAAC,MAAN,CAAa,CAAb,EAAf;KAAA,MAAA;aAAoC,IAApC;;EADkC;;EAIpC,MAAM,CAAC,UAAW,CAAA,MAAA,CAAlB,GAA4B,SAAA;AAC1B,QAAA;IAD2B,sBAAO;IAClC,IAAG,aAAS,OAAT,EAAA,KAAA,MAAH;aAAyB,MAAzB;KAAA,MAAA;aAAoC,GAApC;;EAD0B;;EAI5B,MAAM,CAAC,UAAW,CAAA,IAAA,CAAlB,GAA0B,SAAC,CAAD,EAAI,CAAJ;WACxB,CAAA,KAAK;EADmB;;EAI1B,MAAM,CAAC,UAAW,CAAA,aAAA,CAAlB,GAAmC,SAAC,KAAD,EAAQ,MAAR;IACjC,IAAG,aAAH;aAAe,KAAK,CAAC,MAAN,CAAa,MAAb,EAAf;KAAA,MAAA;aAAyC,GAAzC;;EADiC;;EAInC,MAAM,CAAC,UAAW,CAAA,UAAA,CAAlB,GAAgC,SAAC,KAAD;IAC9B,IAAG,aAAH;aAAe,KAAK,CAAC,WAAN,CAAA,EAAf;KAAA,MAAA;aAAwC,GAAxC;;EAD8B;;EAIhC,MAAM,CAAC,UAAW,CAAA,UAAA,CAAlB,GAAgC,SAAC,KAAD;IAC9B,IAAG,aAAH;aAAe,KAAK,CAAC,OAAN,CAAA,EAAf;KAAA,MAAA;aAAoC,GAApC;;EAD8B;AAlChC"
}
\ No newline at end of file
--- a/js/tram.js Mon Mar 21 22:56:28 2016 +0800
+++ b/js/tram.js Mon Mar 21 23:01:44 2016 +0800
@@ -16,7 +16,8 @@
xa: '#d9534f',
unavailable: '#777',
"default": '#337ab7'
- }
+ },
+ avatar: ['#f75782', '#d27b2b', '#a5902b', '#759d2b', '#2da46b', '#2fa196', '#319db4', '#4292f4', '#c16af4', '#f545cd']
}
};
--- a/js/tram.js.map Mon Mar 21 22:56:28 2016 +0800
+++ b/js/tram.js.map Mon Mar 21 23:01:44 2016 +0800
@@ -6,5 +6,5 @@
"coffee/tram.coffee"
],
"names": [],
- "mappings": ";AAAA;EAAA,MAAM,CAAC,IAAP,GACE;IAAA,IAAA,EACE;MAAA,MAAA,EAAQ,SAAR;MACA,OAAA,EAAS,KADT;KADF;IAIA,MAAA,EACE;MAAA,IAAA,EAAM,QAAQ,CAAC,IAAf;MACA,MAAA,EAAQ,QAAQ,CAAC,QADjB;KALF;IAQA,MAAA,EACE;MAAA,QAAA,EACE;QAAA,MAAA,EAAQ,SAAR;QACA,IAAA,EAAM,SADN;QAEA,EAAA,EAAI,SAFJ;QAGA,WAAA,EAAa,MAHb;QAIA,SAAA,EAAS,SAJT;OADF;KATF;;AADF"
+ "mappings": ";AAAA;EAAA,MAAM,CAAC,IAAP,GACE;IAAA,IAAA,EACE;MAAA,MAAA,EAAQ,SAAR;MACA,OAAA,EAAS,KADT;KADF;IAIA,MAAA,EACE;MAAA,IAAA,EAAM,QAAQ,CAAC,IAAf;MACA,MAAA,EAAQ,QAAQ,CAAC,QADjB;KALF;IAQA,MAAA,EACE;MAAA,QAAA,EACE;QAAA,MAAA,EAAQ,SAAR;QACA,IAAA,EAAM,SADN;QAEA,EAAA,EAAI,SAFJ;QAGA,WAAA,EAAa,MAHb;QAIA,SAAA,EAAS,SAJT;OADF;MAMA,MAAA,EAAQ,CACN,SADM,EAEN,SAFM,EAGN,SAHM,EAIN,SAJM,EAKN,SALM,EAMN,SANM,EAON,SAPM,EAQN,SARM,EASN,SATM,EAUN,SAVM,CANR;KATF;;AADF"
}
\ No newline at end of file