Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
File diff suppressed because one or more lines are too long
183
assets/webapps/sms.gaiamobile.org/views/inbox/index.html
Normal file
183
assets/webapps/sms.gaiamobile.org/views/inbox/index.html
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US" dir="ltr">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
|
||||
<meta charset="utf-8">
|
||||
<meta name="theme-group" content="theme-communications">
|
||||
<meta name="theme-color" content="var(--header-background)">
|
||||
<title>Inbox</title>
|
||||
|
||||
<!--App Style root.css-->
|
||||
<link rel="stylesheet" type="text/css" href="/views/shared/style/root.css">
|
||||
|
||||
<!-- Stable Building blocks -->
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/animations.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/action_menu.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/option_menu.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/buttons.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/confirm.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/edit_mode.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/switches.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/lists.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/tabs.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/progress_activity.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/style/status.css">
|
||||
<link rel="stylesheet" type="text/css" href="/shared/elements/gaia-icons/gaia-icons.css">
|
||||
|
||||
<!-- App styles -->
|
||||
<link rel="stylesheet" type="text/css" href="/views/shared/style/sms.css">
|
||||
<link rel="stylesheet" type="text/css" href="/views/shared/style/panel.css">
|
||||
<link rel="stylesheet" type="text/css" href="/views/shared/style/edit-mode.css">
|
||||
<link rel="stylesheet" type="text/css" href="/views/shared/style/notification.css">
|
||||
<link rel="stylesheet" type="text/css" href="/views/shared/style/common.css">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/views/inbox/style/inbox.css">
|
||||
<link rel="stylesheet" type="text/css" href="/views/inbox/style/edit-mode.css">
|
||||
|
||||
<!-- Localization -->
|
||||
<meta name="defaultLanguage" content="en-US">
|
||||
<meta name="availableLanguages" content="ar:201601260729, bg:201601260729, bn-BD:201601260729, ca:201601260729, cs:201601260729, da:201601260729, de:201601260729, el:201601260729, en-US:201601260729, es:201601260729, eu:201601260729, fr:201601260729, gl:201601260729, hr:201601260729, hu:201601260729, it:201601260729, ja:201601260729, km:201601260729, ko:201601260729, lt:201601260729, mk:201601260729, ms:201601260729, ne-NP:201601260729, nl:201601260729, pa:201601260729, pl:201601260729, pt-BR:201601260729, ro:201601260729, ru:201601260729, sk:201601260729, sq:201601260729, sr-Cyrl:201601260729, sr-Latn:201601260729, sv-SE:201601260729, tr:201601260729, zh-CN:201601260729, zh-TW:201601260729">
|
||||
<link rel="localization" href="/locales-obj/views.inbox.index.{locale}.json">
|
||||
|
||||
<!-- <script defer="" src="/mocks/navigator_moz_icc_manager.js"></script> -->
|
||||
<!-- Firefox Desktop shims -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Web Components -->
|
||||
<!-- <script defer="" src="/shared/elements/config.js"></script> -->
|
||||
<link rel="stylesheet" type="text/css" href="app://theme.gaiamobile.org/shared/elements/gaia-theme/gaia-theme.css">
|
||||
<script async="" src="/shared/elements/gaia-header/dist/gaia-header.js"></script>
|
||||
<!-- Shared code -->
|
||||
<!-- <script defer="" src="/shared/js/intl/l20n.js"></script> -->
|
||||
<!-- Should be removed while gecko support navigator.mozHour12 API -->
|
||||
<!-- <script defer="" src="/shared/js/date_time_helper.js"></script> -->
|
||||
<!-- <script defer="" src="/shared/js/template.js"></script> -->
|
||||
<!-- <script defer="" src="/shared/js/async_storage.js"></script> -->
|
||||
<!-- <script defer="" src="/shared/js/lazy_loader.js"></script> -->
|
||||
<!-- <script defer="" src="/shared/js/sticky_header.js"></script> -->
|
||||
<!-- <script defer="" src="/shared/js/contact_photo_helper.js"></script> -->
|
||||
|
||||
<!-- <script defer="" src="/shared/js/fb/fb_request.js"></script> -->
|
||||
<!-- <script defer="" src="/shared/js/fb/fb_data_reader.js"></script> -->
|
||||
<!-- <script defer="" src="/shared/js/fb/fb_reader_utils.js"></script> -->
|
||||
|
||||
<!-- <script defer="" src="/shared/js/event_dispatcher.js"></script> -->
|
||||
|
||||
<!-- <script defer="" src="/views/shared/js/utils.js"></script> -->
|
||||
<!-- <script defer="" src="/views/shared/js/navigation.js"></script> -->
|
||||
<!-- <script defer="" src="/views/shared/js/inter_instance_event_dispatcher.js"></script> -->
|
||||
<!-- <script defer="" src="/views/shared/js/time_headers.js"></script> -->
|
||||
<!-- <script defer="" src="/views/shared/js/contacts.js"></script> -->
|
||||
<!-- <script defer="" src="/services/js/drafts.js"></script> -->
|
||||
<!-- <script defer="" src="/services/js/threads.js"></script> -->
|
||||
<!-- <script defer="" src="/views/inbox/js/inbox.js"></script> -->
|
||||
<!-- <script defer="" src="/views/shared/js/settings.js"></script> -->
|
||||
<!-- <script defer="" src="/lib/bridge/client.js"></script> -->
|
||||
<!-- <script defer="" src="/lib/bridge/plugins/stream/client.js"></script> -->
|
||||
<!-- <script defer="" src="/services/js/conversation/conversation_client.js"></script> -->
|
||||
<!-- <script defer="" src="/services/js/message_manager.js"></script> -->
|
||||
<!-- <script defer="" src="/views/shared/js/app.js"></script> -->
|
||||
<!-- <script defer="" src="/views/inbox/js/startup.js"></script> -->
|
||||
<!-- <script defer="" src="/views/shared/js/bootstrap.js"></script> --><script src="./gaia_build_defer_index.js" defer="" type="text/javascript"></script>
|
||||
|
||||
<!-- Lazy load scripts
|
||||
<script defer src="/shared/js/option_menu.js"></script>
|
||||
<script defer src="/views/shared/js/dialog.js"></script>
|
||||
<script defer src="/views/shared/js/waiting_screen.js"></script>
|
||||
<script defer src="/views/shared/js/activity_picker.js"></script>
|
||||
-->
|
||||
<meta content="2.5" name="appVersion"></head>
|
||||
|
||||
<body role="application" class="skin-comms theme-communications">
|
||||
<iframe src="/views/shared/shim_host.html" class="shim-host" hidden=""></iframe>
|
||||
<article id="main-wrapper" class="wrapper">
|
||||
<section class="panel panel-InboxView" role="region" aria-hidden="true">
|
||||
<!-- title-start and title-end indicates the button widths respectively
|
||||
at the start and end of the line -->
|
||||
<!-- see https://github.com/gaia-components/gaia-header/ for more information -->
|
||||
<!-- WARNING: the actual value depends on the actual CSS being used in gaia-header -->
|
||||
<gaia-header class="view-header regular-header" title-start="0" title-end="100">
|
||||
<h1 data-l10n-id="messages">Messages</h1>
|
||||
<a aria-label="New message" href="#/composer" id="threads-composer-link" data-icon="compose" data-l10n-id="composeLink"></a>
|
||||
<a aria-label="Actions" id="threads-options-button" data-icon="more" data-l10n-id="actionsButton"></a>
|
||||
<a aria-label="Settings" id="threads-settings-button" data-icon="settings" data-l10n-id="settingsButton"></a>
|
||||
</gaia-header>
|
||||
<article id="threads-container" class="view-body edit-container" data-type="list">
|
||||
</article>
|
||||
|
||||
<div id="threads-no-messages">
|
||||
<div id="no-result-message">
|
||||
<p data-l10n-id="noMessages-title">No messages</p>
|
||||
<p data-l10n-id="noMessages-text-2">Start a conversation now</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="threads-edit-form" role="dialog" data-type="edit">
|
||||
<section role="region" class="theme-settings">
|
||||
<gaia-header id="threads-edit-header" action="close" no-font-fit="">
|
||||
<h1 id="threads-edit-mode" data-l10n-id="selectThreads-title">Select</h1>
|
||||
<button id="threads-check-uncheck-all-button" class="edit-button" data-l10n-id="select-all">Select all</button>
|
||||
</gaia-header>
|
||||
</section>
|
||||
<div class="bottom-tab" role="region">
|
||||
<ul class="bb-tablist">
|
||||
<li role="presentation">
|
||||
<button id="threads-delete-button" class="disable-when-dialog-animates" data-action="delete-button"></button>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<button id="threads-read-unread-button" data-action="mark-as-read"></button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<section id="threads-draft-saved-banner" class="hide" role="status">
|
||||
<p data-l10n-id="message-draft-saved">Message saved as draft</p>
|
||||
</section>
|
||||
|
||||
<div id="sticky"></div>
|
||||
</section>
|
||||
</article>
|
||||
|
||||
<article id="loading">
|
||||
<form role="dialog" data-type="confirm" class="loading-container">
|
||||
<section>
|
||||
<p class="loading-header" data-l10n-id="deleting-messages">Deleting…</p>
|
||||
<div role="status">
|
||||
<progress class="small"></progress>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
</article>
|
||||
|
||||
<!--
|
||||
- Templates
|
||||
-->
|
||||
|
||||
<div id="messages-thread-tmpl" class="hide">
|
||||
<!--
|
||||
<label class="pack-checkbox negative">
|
||||
<input type="checkbox" value="${id}" data-mode="${mode}">
|
||||
<span></span>
|
||||
</label>
|
||||
<a href="${hash}">
|
||||
<aside role="note" class="icon icon-unread icon-draft js-conversation-state"></aside>
|
||||
<aside class="pack-end threadlist-item-picture"
|
||||
role="img" aria-label="Contact photo"
|
||||
data-l10n-id="contact-photo">
|
||||
<span data-type="img"></span>
|
||||
</aside>
|
||||
<p class="threadlist-item-title"><bdi class="ellipsis-dir-fix"></bdi></p>
|
||||
<p class="summary">
|
||||
<time data-time-update="true" data-time-only="true" data-time="${timestamp}"></time>
|
||||
<span class="mms-icon" data-l10n-id="mms-label">MMS</span>
|
||||
<span dir="auto" class="body-text js-conversation-body ellipsis-dir-fix"></span>
|
||||
</p>
|
||||
</a>
|
||||
-->
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
53
assets/webapps/sms.gaiamobile.org/views/inbox/js/inbox.js
Normal file
53
assets/webapps/sms.gaiamobile.org/views/inbox/js/inbox.js
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
;;(function(exports){'use strict';const privateMembers=new WeakMap();function createBdiNode(content){var bdi=document.createElement('bdi');bdi.textContent=content;return bdi;}
|
||||
var InboxView={DRAFT_SAVED_DURATION:5000,FIRST_PANEL_THREAD_COUNT:9,timeouts:{onDraftSaved:null},count:0,inEditMode:false,notifyAboutSavedDraftWithId:null,init:function inbox_init(){this.tmpl={thread:Template('messages-thread-tmpl')};['container','no-messages','read-unread-button','check-uncheck-all-button','composer-link','delete-button','edit-header','options-button','settings-button','edit-mode','edit-form','draft-saved-banner'].forEach(function(id){this[Utils.camelCase(id)]=document.getElementById('threads-'+id);},this);this.mainWrapper=document.getElementById('main-wrapper');this.composerLink.addEventListener('click',this.launchComposer.bind(this));this.readUnreadButton.addEventListener('click',()=>{this.markReadUnread(this.selectionHandler.selectedList,this.readUnreadButton.dataset.action==='mark-as-read');});this.deleteButton.addEventListener('click',()=>{this.delete(this.selectionHandler.selectedList);});this.editHeader.addEventListener('action',this.cancelEdit.bind(this));this.optionsButton.addEventListener('click',this.showOptions.bind(this));this.settingsButton.addEventListener('click',function oSettings(){ActivityPicker.openSettings();});this.container.addEventListener('click',this);this.container.addEventListener('contextmenu',this);this.editForm.addEventListener('submit',this);navigator.mozContacts.addEventListener('contactchange',this.updateContactsInfo.bind(this));MessageManager.on('message-sending',this.onMessageSending.bind(this));MessageManager.on('message-received',this.onMessageReceived.bind(this));MessageManager.on('threads-deleted',this.onThreadsDeleted.bind(this));Drafts.on('deleted',this.onDraftDeleted.bind(this));Drafts.on('saved',this.onDraftSaved.bind(this));privateMembers.set(this,{groupThreadTitleMaxLength:(window.innerWidth-100)/10});this.once('fully-loaded',()=>{this.ensureReadAheadSetting();});this.once('visually-loaded',()=>{this.initStickyHeader();});this.sticky=null;},initStickyHeader:function inbox_initStickyHeader(){if(!this.sticky){this.sticky=new StickyHeader(this.container,document.getElementById('sticky'));}},beforeEnter:function inbox_beforeEnter(args={}){if(this.notifyAboutSavedDraftWithId){this.showDraftSavedBanner();this.notifyAboutSavedDraftWithId=null;}},beforeLeave:function inbox_beforeLeave(){this.cancelEdit();},getIdIterator:function inbox_getIdIterator(){return Threads.keys();},setContact:function inbox_setContact(node){var threadId=node.dataset.threadId;var draftId=node.dataset.draftId;var threadOrDraft=draftId?Drafts.byDraftId(+draftId):Threads.get(+threadId);if(!threadOrDraft){throw new Error('Thread node is invalid!');}
|
||||
var threadNumbers=threadOrDraft.participants||threadOrDraft.recipients;var titleContainer=node.querySelector('.threadlist-item-title');var title=titleContainer.firstElementChild;var picture=node.querySelector('.threadlist-item-picture');if(!threadNumbers||!threadNumbers.length){title.setAttribute('data-l10n-id','no-recipient');return;}
|
||||
function*updateThreadNode(number){var contact=yield InboxView.findContact(number,{photoURL:true});var isContact=!!contact.isContact;picture.classList.toggle('has-picture',isContact);picture.classList.toggle('default-picture',isContact&&!contact.photoURL);title.textContent=contact.title||number;var photoUrl=node.dataset.photoUrl;if(photoUrl){window.URL.revokeObjectURL(photoUrl);}
|
||||
if(contact.photoURL){node.dataset.photoUrl=contact.photoURL;}else if(photoUrl){node.dataset.photoUrl='';}
|
||||
if(contact.photoURL){picture.firstElementChild.style.backgroundImage=['url('+contact.photoURL+')','url(/views/inbox/style/images/default_contact_image.png)'].join(', ');}else{picture.firstElementChild.style.backgroundImage=null;}}
|
||||
function*updateGroupThreadNode(numbers,titleMaxLength){var contactTitle,number;var i=0;var threadTitleLength=0;var groupTitle=document.createElement('span');var separatorNode=document.createElement('span');separatorNode.setAttribute('data-l10n-id','thread-participant-separator');picture.firstElementChild.textContent=numbers.length;picture.classList.add('has-picture','group-picture');while(i<numbers.length&&threadTitleLength<titleMaxLength){number=numbers[i++];contactTitle=(yield InboxView.findContact(number)).title||number;if(threadTitleLength>0){groupTitle.appendChild(separatorNode.cloneNode(true));}
|
||||
groupTitle.appendChild(createBdiNode(contactTitle));threadTitleLength+=contactTitle.length;}
|
||||
titleContainer.replaceChild(groupTitle,title);}
|
||||
if(!title.textContent){title.textContent=threadNumbers[0];}
|
||||
if(threadNumbers.length===1){return Utils.Promise.async(updateThreadNode)(threadNumbers[0]);}
|
||||
return Utils.Promise.async(updateGroupThreadNode)(threadNumbers,privateMembers.get(this).groupThreadTitleMaxLength);},findContact:function(number,options){return Contacts.findByAddress(number).then(function(contacts){var details=Utils.getContactDetails(number,contacts,options);if(!details.isContact){Contacts.addUnknown(number);}
|
||||
return details;});},handleEvent:function inbox_handleEvent(event){var parent=event.target.parentNode;var threadId=parent.dataset.threadId;switch(event.type){case'click':if(this.inEditMode){return;}
|
||||
if(threadId){event.preventDefault();var draftId=parent.dataset.draftId;if(draftId){Navigation.toPanel('composer',{draftId:+draftId,});}else{Navigation.toPanel('thread',{id:+threadId});}}
|
||||
break;case'contextmenu':if(this.inEditMode||!threadId){return;}
|
||||
event.preventDefault();event.stopPropagation();var params={type:'action',header:{l10nId:'thread-options'},items:[{l10nId:'delete-thread',method:this.delete.bind(this,[threadId])}]};var thread=Threads.get(+threadId);if(!thread.isDraft){var isRead=thread.unreadCount>0;var l10nKey=isRead?'mark-as-read':'mark-as-unread';params.items.push({l10nId:l10nKey,method:this.markReadUnread.bind(this,[threadId],isRead)});}
|
||||
params.items.push({l10nId:'cancel'});var options=new OptionMenu(params);options.show();break;case'submit':event.preventDefault();break;}},launchComposer:function inbox_launchComposer(e){e.preventDefault();Navigation.toPanel('composer');},updateSelectionStatus:function inbox_updateSelectionStatus(){var selected=this.selectionHandler;if(this.selectionHandler.allSelected()){this.checkUncheckAllButton.setAttribute('data-l10n-id','deselect-all');}else{this.checkUncheckAllButton.setAttribute('data-l10n-id','select-all');}
|
||||
if(selected.selectedCount){this.deleteButton.disabled=false;document.l10n.setAttributes(this.editMode,'selected-threads',{n:selected.selectedCount});var hasUnreadselected=selected.selectedList.some((id)=>{var thread=Threads.get(id);if(thread&&thread.unreadCount){return thread.unreadCount>0;}
|
||||
return false;});var allDraft=selected.selectedList.every((id)=>{return(Threads.get(id).isDraft);});if(allDraft){this.readUnreadButton.disabled=true;}else{if(!hasUnreadselected){this.readUnreadButton.dataset.action='mark-as-unread';}else{this.readUnreadButton.dataset.action='mark-as-read';}
|
||||
this.readUnreadButton.disabled=false;}}else{this.deleteButton.disabled=true;this.readUnreadButton.disabled=true;document.l10n.setAttributes(this.editMode,'selectThreads-title');}},markReadUnread:function inbox_markReadUnread(selected,isRead){selected.forEach((id)=>{var thread=Threads.get(+id);var readStatusMatched=!!thread.unreadCount^isRead;var markable=thread&&!thread.isDraft&&(isRead||!thread.getDraft());if(markable&&!readStatusMatched){thread.unreadCount=isRead?0:1;this.mark(thread.id,isRead?'read':'unread');MessageManager.markThreadRead(thread.id,isRead);}});this.cancelEdit();},removeConversationDOM(conversationId){var li=document.getElementById('thread-'+conversationId);var parent;var photoUrl=li&&li.dataset.photoUrl;if(photoUrl){window.URL.revokeObjectURL(photoUrl);}
|
||||
if(li){parent=li.parentNode;li.remove();}
|
||||
if(parent&&!parent.firstElementChild){parent.previousSibling.remove();parent.remove();this.sticky&&this.sticky.refresh();if(!this.container.querySelector('li')){this.setEmpty(true);}}},delete:function inbox_delete(selected){function performDeletion(){var threadIdsToDelete=[],messageIdsToDelete=[],threadCountToDelete=0;function exitEditMode(){InboxView.cancelEdit();WaitingScreen.hide();}
|
||||
function onAllThreadMessagesRetrieved(){if(!--threadCountToDelete){MessageManager.deleteMessages(messageIdsToDelete);threadIdsToDelete.forEach(function(threadId){InboxView.deleteThread(threadId);});messageIdsToDelete=threadIdsToDelete=null;exitEditMode();}}
|
||||
function onThreadMessageRetrieved(message){messageIdsToDelete.push(message.id);return true;}
|
||||
WaitingScreen.show();threadIdsToDelete=selected.reduce(function(list,value){var threadId=+value;if(Threads.get(threadId).isDraft){InboxView.deleteThread(threadId);}else{list.push(threadId);}
|
||||
return list;},[]);if(!threadIdsToDelete.length){exitEditMode();return;}
|
||||
threadCountToDelete=threadIdsToDelete.length;threadIdsToDelete.forEach(function(threadId){MessageManager.getMessages({filter:{threadId:threadId},each:onThreadMessageRetrieved,end:onAllThreadMessagesRetrieved});});}
|
||||
return Utils.confirm({id:'deleteThreads-confirmation-message',args:{n:selected.length}},null,{text:'delete',className:'danger'}).then(performDeletion.bind(this));},setEmpty:function inbox_setEmpty(empty){var panel=document.querySelector('.panel-InboxView');panel.classList.toggle('threadlist-is-empty',!!empty);},showOptions:function inbox_options(){var params={items:[{l10nId:'selectThreads-label',method:this.startEdit.bind(this)},{l10nId:'settings',method:function oSettings(){ActivityPicker.openSettings();}},{l10nId:'cancel',incomplete:true}]};new OptionMenu(params).show();},startEdit:function inbox_edit(){function editModeSetup(){this.inEditMode=true;this.selectionHandler.cleanForm();this.mainWrapper.classList.toggle('edit');}
|
||||
this.editHeader.removeAttribute('no-font-fit');if(!this.selectionHandler){LazyLoader.load(['/views/shared/js/selection_handler.js','/shared/style/edit_mode.css','/shared/style/switches.css','/views/shared/style/edit-mode.css','/shared/style/tabs.css','/views/inbox/style/edit-mode.css'],()=>{this.selectionHandler=new SelectionHandler({container:this.container,checkUncheckAllButton:this.checkUncheckAllButton,updateSelectionStatus:this.updateSelectionStatus.bind(this),getIdIterator:this.getIdIterator.bind(this),isInEditMode:this.isInEditMode.bind(this)});this.editForm.classList.remove('hide');editModeSetup.call(this);});}else{editModeSetup.call(this);}},isInEditMode:function inbox_isInEditMode(){return this.inEditMode;},cancelEdit:function inbox_cancelEdit(){this.inEditMode=false;this.mainWrapper.classList.remove('edit');},renderDrafts:function inbox_renderDrafts(){return Drafts.request().then(()=>{for(var draft of Drafts.getAll()){if(draft.threadId){if(document.getElementById(`thread-${draft.threadId}`)){this.updateThread(Threads.get(draft.threadId),{conversationDraft:true});}}else{this.setEmpty(false);if(!Threads.has(draft.id)){var thread=Thread.create(draft);Threads.set(draft.id,thread);this.appendThread(thread);}}}
|
||||
this.sticky&&this.sticky.refresh();});},prepareRendering:function inbox_prepareRendering(){this.container.innerHTML='';this.renderDrafts();},startRendering:function inbox_startRenderingThreads(){this.setEmpty(false);},finalizeRendering:function inbox_finalizeRendering(empty){if(empty){this.setEmpty(true);}
|
||||
if(!empty){TimeHeaders.updateAll('header[data-time-update]');}
|
||||
this.sticky&&this.sticky.refresh();},ensureReadAheadSetting:function inbox_ensureReadAheadSettting(){Settings.setReadAheadThreadRetrieval(this.FIRST_PANEL_THREAD_COUNT);},renderThreads:function inbox_renderThreads(){window.performance.mark('willRenderThreads');var hasThreads=false;var firstPanelCount=this.FIRST_PANEL_THREAD_COUNT;this.prepareRendering();function onRenderThread(thread){Threads.set(thread.id,thread);if(!hasThreads){hasThreads=true;this.startRendering();}
|
||||
this.appendThread(thread);if(--firstPanelCount===0){this.emit('visually-loaded');}}
|
||||
function onThreadsRendered(){this.finalizeRendering(!(hasThreads||Drafts.size));if(firstPanelCount>0){this.emit('visually-loaded');}}
|
||||
MessageManager.getThreads({each:onRenderThread.bind(this),end:onThreadsRendered.bind(this),done:()=>Drafts.request().then(()=>this.emit('fully-loaded'))});},updateConversationContent(node,record){var id=record.id;var thread=Threads.get(id);var isDraft=thread.isDraft;var draft=thread.getDraft();var body=record.body;var type=record.lastMessageType;var iconLabel='';if(draft&&draft.timestamp>=record.timestamp){body=draft.content.find((content)=>typeof content==='string');type=draft.type;}
|
||||
node.dataset.lastMessageType=type;if(draft){node.classList.add('draft');if(isDraft){node.dataset.draftId=draft.id;node.classList.add('is-draft');iconLabel='is-draft';}else{node.classList.add('has-draft');iconLabel='has-draft';}}else{node.classList.remove('draft','has-draft','is-draft');}
|
||||
if(record.unreadCount>0){node.classList.add('unread');iconLabel='unread-thread';}else{node.classList.remove('unread');}
|
||||
node.querySelector('.js-conversation-body').textContent=body||'';var stateIndicator=node.querySelector('.js-conversation-state');if(iconLabel){document.l10n.setAttributes(stateIndicator,iconLabel);}else{stateIndicator.removeAttribute('data-l10n-id');}},createThread:function inbox_createThread(record){var li=document.createElement('li');var timestamp=+record.timestamp;var id=record.id;var thread=Threads.get(id);var isDraft=thread.isDraft;var draft=thread.getDraft();li.id='thread-'+id;li.dataset.threadId=id;li.dataset.time=timestamp;li.classList.add('threadlist-item');li.innerHTML=this.tmpl.thread.interpolate({hash:isDraft?'#/composer':'#/thread?id='+id,mode:isDraft?'drafts':'threads',id:String(isDraft?draft.id:id),timestamp:String(timestamp)},{safe:['id']});this.updateConversationContent(li,record);TimeHeaders.update(li.querySelector('time'));return li;},deleteThread:function(threadId){Threads.delete(threadId);this.removeConversationDOM(threadId);Utils.closeNotificationsForThread(threadId);},insertThreadContainer:function inbox_insertThreadContainer(group,timestamp){var headers=InboxView.container.getElementsByTagName('header');var groupFound=false;for(var i=0;i<headers.length;i++){if(timestamp>=headers[i].dataset.time){groupFound=true;InboxView.container.insertBefore(group,headers[i].parentNode);break;}}
|
||||
if(!groupFound){InboxView.container.appendChild(group);}},updateThread(record,options={}){var thread=Thread.create(record,options);var threadUINode=document.getElementById('thread-'+thread.id);var threadUITime=threadUINode?+threadUINode.dataset.time:NaN;var recordTime=+thread.timestamp;Threads.set(thread.id,thread);var newMessageReceived=options.unread;if(newMessageReceived&&threadUITime>recordTime){this.mark(thread.id,'unread');return;}
|
||||
if(options.deleted&&threadUITime===recordTime){return;}
|
||||
if(threadUINode&&options.conversationDraft){this.updateConversationContent(threadUINode,record);return;}
|
||||
if(threadUINode){this.removeConversationDOM(thread.id);}
|
||||
this.setEmpty(false);if(this.appendThread(thread)){this.sticky&&this.sticky.refresh();}},onMessageSending:function inbox_onMessageSending(e){this.updateThread(e.message);},onMessageReceived:function inbox_onMessageReceived(e){var markAsRead=Navigation.isCurrentPanel('thread',{id:e.message.threadId});this.updateThread(e.message,{unread:!markAsRead});},onThreadsDeleted:function inbox_onThreadDeleted(e){e.ids.forEach(function(threadId){if(Threads.has(threadId)){this.deleteThread(threadId);}},this);},appendThread:function inbox_appendThread(thread){var timestamp=+thread.timestamp;var firstThreadInContainer=false;var node=this.createThread(thread);this.setContact(node);var threadsContainerID='threadsContainer_'+
|
||||
Utils.getDayDate(timestamp);var threadsContainer=document.getElementById(threadsContainerID);if(!threadsContainer){var threadsContainerWrapper=InboxView.createThreadContainer(timestamp);threadsContainer=threadsContainerWrapper.childNodes[1];InboxView.insertThreadContainer(threadsContainerWrapper,timestamp);firstThreadInContainer=true;}
|
||||
var threads=threadsContainer.getElementsByTagName('li');var threadFound=false;for(var i=0,l=threads.length;i<l;i++){if(timestamp>threads[i].dataset.time){threadFound=true;threadsContainer.insertBefore(node,threads[i]);break;}}
|
||||
if(!threadFound){threadsContainer.appendChild(node);}
|
||||
if(this.inEditMode){this.selectionHandler.unselect(thread.id);this.updateSelectionStatus();}
|
||||
return firstThreadInContainer;},createThreadContainer:function inbox_createThreadContainer(timestamp){var threadContainer=document.createElement('div');var headerDOM=document.createElement('header');headerDOM.id='header_'+timestamp;headerDOM.dataset.timeUpdate='repeat';headerDOM.dataset.time=timestamp;headerDOM.dataset.dateOnly=true;var threadsContainerDOM=document.createElement('ul');threadsContainerDOM.id='threadsContainer_'+
|
||||
Utils.getDayDate(timestamp);Utils.setHeaderDate({time:timestamp,element:headerDOM});threadContainer.appendChild(headerDOM);threadContainer.appendChild(threadsContainerDOM);return threadContainer;},updateContactsInfo:function inbox_updateContactsInfo(){Contacts.clearUnknown();if(!this.container){return;}
|
||||
var threads=this.container.getElementsByTagName('li');[].forEach.call(threads,this.setContact.bind(this));},mark:function inbox_mark(id,current){var li=document.getElementById('thread-'+id);if(li){li.classList.toggle('unread',current==='unread');}},onDraftDeleted:function inbox_onDraftDeleted(draft){var thread=Threads.get(draft.threadId||draft.id);if(!thread){return;}
|
||||
if(thread.isDraft){this.deleteThread(thread.id);}else{this.updateThread(thread,{conversationDraft:true});}
|
||||
if(draft.id===this.notifyAboutSavedDraftWithId){this.notifyAboutSavedDraftWithId=null;}},onDraftSaved:function inbox_onDraftSaved(draft){if(draft.threadId){this.updateThread(Threads.get(draft.threadId),{conversationDraft:true});}else{this.updateThread(draft);}
|
||||
if(!Navigation.isCurrentPanel('thread-list')){this.notifyAboutSavedDraftWithId=draft.id;}},showDraftSavedBanner:function(){this.draftSavedBanner.classList.remove('hide');clearTimeout(this.timeouts.onDraftSaved);this.timeouts.onDraftSaved=null;this.timeouts.onDraftSaved=setTimeout(()=>this.draftSavedBanner.classList.add('hide'),this.DRAFT_SAVED_DURATION);}};exports.InboxView=EventDispatcher.mixin(InboxView,['visually-loaded','fully-loaded']);}(this));
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
;(function(exports){'use strict';const LAZY_DEPENDENCIES=['/shared/js/option_menu.js','/views/shared/js/waiting_screen.js','/views/shared/js/dialog.js','/views/shared/js/error_dialog.js','/views/shared/js/activity_picker.js'];function initLazyDependencies(){return LazyLoader.load(LAZY_DEPENDENCIES).then(()=>{TimeHeaders.init();Settings.init();Navigation.setReady();InterInstanceEventDispatcher.connect();});}
|
||||
exports.Startup={init(){Utils.initializeShimHost(App.instanceId);ConversationClient.init(App.instanceId);MessageManager.init();Navigation.init();Drafts.init();InboxView.init();InboxView.once('visually-loaded',()=>{initLazyDependencies();});InboxView.once('fully-loaded',()=>{App.setReady();});InboxView.renderThreads();}};})(window);
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* This file contains styles for Inbox view edit mode. They complement styles
|
||||
* from views/shared/style/edit-mode.css that are applied as well.
|
||||
* View edit mode is activated via Options -> Select threads.
|
||||
*/
|
||||
|
||||
|
||||
.bb-tablist > li button[data-action="mark-as-read"] {
|
||||
background-image: url("images/icons/ico_in_markasread_30x30.png");
|
||||
}
|
||||
|
||||
.bb-tablist > li button[data-action="mark-as-unread"] {
|
||||
background-image: url("images/icons/ico_in_markasunread_30x30.png");
|
||||
}
|
||||
|
||||
.edit #threads-container[data-type="list"] {
|
||||
height: calc(100% - 10rem);
|
||||
}
|
||||
|
||||
html[dir="ltr"] .edit [data-type="list"] li > a > aside.icon-unread {
|
||||
transform: translateX(5rem);
|
||||
}
|
||||
html[dir="rtl"] .edit [data-type="list"] li > a > aside.icon-unread {
|
||||
transform: translateX(-5rem);
|
||||
}
|
||||
|
||||
.edit #threads-container aside.pack-end {
|
||||
margin-inline-start: 4rem;
|
||||
}
|
||||
|
||||
html[dir="ltr"] .edit #threads-container[data-type="list"] aside.pack-end span {
|
||||
transform: translateX(1.5rem);
|
||||
}
|
||||
html[dir="rtl"] .edit #threads-container[data-type="list"] aside.pack-end span {
|
||||
transform: translateX(-1.5rem);
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 160 B |
Binary file not shown.
|
After Width: | Height: | Size: 800 B |
Binary file not shown.
|
After Width: | Height: | Size: 779 B |
Binary file not shown.
|
After Width: | Height: | Size: 131 B |
191
assets/webapps/sms.gaiamobile.org/views/inbox/style/inbox.css
Normal file
191
assets/webapps/sms.gaiamobile.org/views/inbox/style/inbox.css
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
#sticky {
|
||||
position: absolute;
|
||||
|
||||
/* The sticky element is positioned at the beginning of the list. */
|
||||
top: 5rem;
|
||||
|
||||
/* The width is not 100% so the scrollbar is visible. */
|
||||
width: calc(100% - 2rem);
|
||||
|
||||
/* The height needs to be kept in sync with the header height. */
|
||||
height: 3.1rem;
|
||||
|
||||
/* Leaving 1rem margin for both side to makes scrollbar visible in LTR/RTL */
|
||||
margin: 0 1rem;
|
||||
|
||||
/* The sticky element needs to be above the list. */
|
||||
z-index: 2;
|
||||
|
||||
/* Hide sticky header when content is not ready */
|
||||
visibility: hidden;
|
||||
|
||||
/* Those style will affect the backgroundImage: -moz-element. */
|
||||
background: white no-repeat center top;
|
||||
}
|
||||
|
||||
#sticky.has-content {
|
||||
/* Set sticky header visible only when content is ready */
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#threads-container[data-type="list"] header {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
#threads-container[data-type="list"] ul {
|
||||
padding: 0 1.0rem;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
#threads-container[data-type="list"] .mms-icon {
|
||||
display: none;
|
||||
|
||||
font-size: 1.5rem;
|
||||
color: #ff6622;
|
||||
}
|
||||
|
||||
#threads-container[data-type="list"] [data-last-message-type="mms"] .mms-icon {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#threads-container[data-type="list"] [data-last-message-type="mms"] .body-text {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.threadlist-item-picture {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.threadlist-item-picture.has-picture {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.threadlist-item .default-picture > span[data-type=img],
|
||||
.threadlist-item .group-picture > span[data-type=img] {
|
||||
/* Please keep this image in sync with what is used in js/inbox.js */
|
||||
background: url('images/default_contact_image.png') top left; /* BiDi proof: CSS sprites */
|
||||
}
|
||||
|
||||
.threadlist-item:nth-child(even) .default-picture > span[data-type=img],
|
||||
.threadlist-item:nth-child(even) .group-picture > span[data-type=img] {
|
||||
background-position: bottom right; /* BiDi proof: CSS sprites */
|
||||
}
|
||||
|
||||
.threadlist-item:nth-child(3n+1) .default-picture > span[data-type=img],
|
||||
.threadlist-item:nth-child(3n+1) .group-picture > span[data-type=img] {
|
||||
background-position: top right; /* BiDi proof: CSS sprites */
|
||||
}
|
||||
|
||||
.threadlist-item:nth-child(4n+4) .default-picture > span[data-type=img],
|
||||
.threadlist-item:nth-child(4n+4) .group-picture > span[data-type=img] {
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
.threadlist-item-picture.group-picture > span[data-type=img] {
|
||||
display: flex;
|
||||
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
color: #fff;
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug 967878, 979018 -[Messages] Background doesn't
|
||||
* scroll with the threads causing expensive over-invalidation
|
||||
*/
|
||||
#threads-container > div {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
[data-type="list"] aside.icon-unread {
|
||||
margin: 0;
|
||||
width: 1.9rem;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
[data-type="list"] .unread aside.icon-unread {
|
||||
background: url("images/unread.png") no-repeat;
|
||||
background-size: 1rem;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
[data-type="list"] .threadlist-item a * {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
[data-type="list"] .summary {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
[data-type="list"] .draft .icon-draft {
|
||||
background: url("images/draft.png") no-repeat;
|
||||
background-size: 1.2rem;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
[data-type="list"] .is-draft .pack-end {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
[data-type="list"] .is-draft .threadlist-item-title {
|
||||
font-style: italic;
|
||||
color: #5f5f5f;
|
||||
}
|
||||
|
||||
/* Override time margin for flex layout */
|
||||
[data-type="list"] .summary time {
|
||||
display: inline-block;
|
||||
margin-inline-end: 1rem;
|
||||
}
|
||||
|
||||
[data-type="list"] .unread .summary time {
|
||||
color: #1D8399;
|
||||
}
|
||||
|
||||
/* Empty Inbox layout */
|
||||
|
||||
#threads-no-messages {
|
||||
background: url("images/SMS_200x200_bubble.png")
|
||||
no-repeat center;
|
||||
background-size: 20rem;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
height: calc(100% - 5rem);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#no-result-message {
|
||||
position: relative;
|
||||
top: 50%;
|
||||
|
||||
width: 27rem;
|
||||
padding: 2rem 0.5rem;
|
||||
margin: -8rem auto;
|
||||
border-top: .1rem solid rgba(96,96,96,.5);
|
||||
|
||||
line-height: 3rem;
|
||||
text-align: start;
|
||||
font-weight: 300;
|
||||
font-size: 2.2rem;
|
||||
color: #606060;
|
||||
}
|
||||
|
||||
#threads-no-messages, .threadlist-is-empty #threads-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Using !important to override scoped style in gaia-header component. */
|
||||
#threads-settings-button, .threadlist-is-empty #threads-options-button {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Using flex to center the content. */
|
||||
.threadlist-is-empty #threads-settings-button {
|
||||
display: flex !important;
|
||||
}
|
||||
|
||||
.threadlist-is-empty #threads-no-messages {
|
||||
display: block;
|
||||
}
|
||||
Loading…
Reference in a new issue