Skip to content
Browse files

- got username autocompletion working again using old-skool code.

  • Loading branch information...
1 parent 149ce65 commit bba5d7045d6b4800b312a0eb8677ee403a209afa funkatron committed Dec 5, 2009
View
54 app/models/spaz.autocomplete.js
@@ -0,0 +1,54 @@
+var Spaz; if (!Spaz) Spaz = {};
+
+/***********
+Spaz.Autocomplete
+************/
+if (!Spaz.Autocomplete) Spaz.Autocomplete = {};
+
+Spaz.Autocomplete.sources = {};
+Spaz.Autocomplete.statuses = {};
+Spaz.Autocomplete.screenNames = [];
+
+// 'username':{ 'count':0 }
+// this isn't used yet, but it really should be
+Spaz.Autocomplete.screenNamesAccesses = {};
+
+// Spaz.Autocomplete.maxScreenNames = 300;
+
+Spaz.Autocomplete.addScreenName = function(name) {
+ if (Spaz.Autocomplete.screenNames.indexOf(name) == -1) {
+ Spaz.Autocomplete.screenNames.push(name)
+ Spaz.dump('Added "'+name.toLowerCase()+'". Number of screen names is '+Spaz.Autocomplete.getScreenNamesCount());
+ }
+};
+
+Spaz.Autocomplete.delScreenName = function(name) {
+ if (Spaz.Autocomplete.screenNames.indexOf(name)) {
+ sch.dump('Spaz.Autocomplete.delScreenName not yet implemented');
+ }
+
+};
+
+Spaz.Autocomplete.getScreenNames = function() {
+ // return Spaz.Autocomplete.screenNames;
+
+ var screen_names = [];
+
+ $('.user-screen-name', '#'+Spaz.Section.friends.timeline).each(function() {
+ name = $(this).attr('user-screen_name');
+ if (screen_names.indexOf(name) == -1) {
+ screen_names.push(name);
+ // sch.dump('Added "'+name+'". Number of screen names is '+screen_names.length);
+ }
+ });
+
+ sch.error('Screen Names:')
+ sch.error(screen_names);
+
+ return screen_names;
+
+}
+
+Spaz.Autocomplete.getScreenNamesCount = function() {
+ return Spaz.Autocomplete.screenNames.length;
+}
View
2 app/spaz.js
@@ -250,7 +250,7 @@ Spaz.initialize = function() {
set-up usernameCompleter
*/
Spaz.uc = new usernameCompleter({
- 'usernames':Spaz.Cache.getScreenNamesAsTags(),
+ 'usernames':Spaz.Autocomplete.getScreenNames(),
'displayDiv':'#suggestions',
'textarea':'#entrybox',
'maxMatches':15
View
2 app/views/spaz.editor.js
@@ -62,5 +62,5 @@ Spaz.Editor.$wrap = function(open, close, selstart, selend) {
Spaz.Editor.initSuggestions = function() {
- Spaz.uc.usernames = Spaz.Cache.getScreenNamesAsTags();
+ Spaz.uc.usernames = Spaz.Autocomplete.getScreenNames();
};
View
9 app/views/spaz.timelines.js
@@ -145,7 +145,7 @@ AppTimeline.prototype.sortByAttribute = function(sortattr, idattr, sortfunc) {
jQuery(this.getTimelineSelector()).html(sortedHTML);
};
-// Spaz.uc.usernames = Spaz.Cache.getScreenNamesAsTags();
+// Spaz.uc.usernames = Spaz.Autocomplete.getScreenNames();
/**
@@ -271,7 +271,12 @@ var FriendsTimeline = function() {
jQuery('#timeline-friends div.timeline-entry').removeClass('even').removeClass('odd');
jQuery('#timeline-friends div.timeline-entry:even').addClass('even');
jQuery('#timeline-friends div.timeline-entry:odd').addClass('odd');
-
+
+ /*
+ get new set of usernames
+ */
+ Spaz.uc.usernames = Spaz.Autocomplete.getScreenNames();
+
Spaz.UI.hideLoading();
Spaz.UI.statusBar("Ready");
View
BIN bin/growlnotify
Binary file not shown.
View
1 css/init.css
@@ -100,6 +100,7 @@ div.timeline.dm-replies div.reply, div.timeline.dm-replies div.dm {
max-height:200px;
max-width:200px;
overflow:hidden;
+ z-index:2000; /*So this is on top*/
}
#suggestions .username-match {
View
14 index.html
@@ -125,7 +125,7 @@
<!-- app model -->
<script src="app/models/spaz.db.js" type="text/javascript"></script>
<script src="app/models/spaz.data.js" type="text/javascript"></script>
- <script src="app/models/spaz.cache.js" type="text/javascript"></script>
+ <script src="app/models/spaz.autocomplete.js" type="text/javascript"></script>
<script src="app/models/spaz.prefs.js" type="text/javascript"></script>
<script src="app/models/spaz.accounts.js" type="text/javascript"></script>
@@ -808,12 +808,6 @@ <h2 class="CollapsiblePanelTab" tabindex="0">Service URLs</h2>
</div>
- <!-- suggestions popup -->
- <div id="suggestions">
-
- </div>
-
-
<!-- the context menu container -->
<div id="linkContextMenu" class="context-menu">
<ul>
@@ -898,6 +892,12 @@ <h2 class="CollapsiblePanelTab" tabindex="0">Service URLs</h2>
<div class="preview" style='display:none; overflow:hidden; margin-top:.7em'></div>
</div>
+ <!-- suggestions popup -->
+ <div id="suggestions">
+
+ </div>
+
+
<!--
The About popup
-->
View
8 themes/spaz/theme.css
@@ -820,6 +820,14 @@ div.timeline-entry {
div.status-actions {
font-size:10px;
float:right;
+ opacity:0;
+ -webkit-transition-property:opacity;
+ -webkit-transition-duration:.5s;
+ }
+
+ div.timeline-entry:hover div.status-actions,
+ div.timeline-entry.ui-selected div.status-actions {
+ opacity:1;
}
.status-action {
width:15px;

0 comments on commit bba5d70

Please sign in to comment.
Something went wrong with that request. Please try again.