zepheira / exhibit3 Goto Github PK
View Code? Open in Web Editor NEWSimile Widgets Exhibit 3 code repository
Home Page: http://simile-widgets.org/exhibit3/
License: MIT License
Simile Widgets Exhibit 3 code repository
Home Page: http://simile-widgets.org/exhibit3/
License: MIT License
I wrote some tests for date-time.js with just the source code to work from, but the lack of requirements bit me a couple of times when I couldn't figure out the intent of the functions.
For week-based rounding-down, I would have expected the rounding to be based on the week number. So, e.g. a week round-down from a day in week 34 using an interval of 5, would give me the same day of the week in week 30. But the implementation does not even consult the value of 'multiple', so I assume that wasn't the intent.
I wrote some tests for round-up based on what I expected of the function based on the name, but none of them passed so I must be missing something.
ISO 8601 fractional times aren't currently supported. Do we need to support them?
The control panel should be inserted automatically above, perhaps, the first viewPanel or view encountered. It is currently not created if not explicitly configured by the author.
Originally the control panel was to carry the export button, but I missed how collection-dependent this made the control panel. There would need to be a control panel to carry a collection-dependent export button for each collection, or several export buttons in one control panel, which would be a confusing user experience. Since this is starting to look overly complicated, moving the export button back to a per-view place would be useful - though this should be handled in a way so that every view gets the widget (in non-hover show/hide mode) with a setting to completely hide the export button without explicitly having code in every view for it.
One of the basic functions missing due to the new history tracking system is the ability to clear all facet restrictions at once. Adding it back in is just a matter of clarifying the appropriate API for facets to implement.
This is likely to go unimplemented since the History.js library must listen to hash changes (as displayed in the location bar) for HTML4 based browser compatibility. Implementing this feature means removing HTML4 support for Exhibit entirely as the history system has become core to responding to user input.
It may be possible with further modification of the History.js library or Exhibit's history management. Further diagnosis required.
'/' is an invalid character for (non-URI) rel values as described in RFC 5988's reg-rel-type production.
I'd recommend changing it to "exhibit-data" so it can be registered, documenting that as the preferred rel value, but supporting both values in code.
The E2 subversion repository came with a jetty server for the local repository and a subdirectory full of example exhibits. This made it easy to develop/test exhibit. Can we create a similar subdirectory in the E3 repository?
Remove instances of eval()
in the code. This is mostly used to cut corners so, say, mapping between the view class of Tabular
and the actual object type can be done without adding any new enumerations, etc. These uses should probably just be enumerated, or "registered," or anything other than using eval()
.
In the Nobelists demo, the button for the timeline sometimes disappears when you refresh.
The only way to get it back is by clearing the cache.
The following facets have not yet been ported to Exhibit 3 from Exhibit 2:
The image facet is on the chopping block and should perhaps exist as an extension. The slider facet UI can almost certainly be handled by jQuery UI (fit for #21), perhaps just as easily handled with jQuery. Its slider library should be removed elsewhere.
It currently doesn't do what's expected.
Browsing an authored Exhibit that has pagination enabled in the view and grouping as sorted checked, then making a facet selection, results in the disappearance of paging controls and show all / show some controls despite not displaying all results. The expected behavior would be to show all, as grouping tends to lead to, instead of reverting to the show some / show all paradigm it currently falls into, out of the paging paradigm.
Write a basic tool that takes in Exhibit JSON valid in Exhibit 2.0 and re-output it as valid JSON, ready for Exhibit 3.
Look over the Google Code issues list for anything that might need to be addressed in Exhibit 3 as it comes over from Exhibit 2.
Audit the current code for any missing opportunities to use jQuery. Use Exhibit.jQuery() where possible, even if it effectively means $($()), so it's obvious to code readers what's going on.
Bring importers in that work with JSONP, especially Google Spreadsheet-based imports.
Particularly the evaluate()
method, which takes roots and rootValueTypes arguments that are hashes and returns a hash. Also Path segments. Is the overhead of new classes worth a possibly more easily comprehensible API?
I was getting a "null has no length attribute" error and then figured out that an attribute like ex:expressions=".snippet"
is needed on a TextSearch facet declaration.
In the nobelists demo I found a sorting order that shows a working... popup module that won't dissapear anymore.
This combination is: Discipline, deceased and then relationship.
I wasn't able to find any other combinations that caused this strange behavior.
Much of Exhibit was written at a time where imitating classical inheritance patterns was state of the art. Recent developments encourage Javascript's native prototypal inheritance pattern instead, to which end most modern engines now implement Object.create
:
var TrackedComponent = {
"getID": function() { return this._id; },
"setID": function() { this._id = this.getRegistryKey() + "-" + this._type; },
"getRegistryKey": function() { return this._registryKey }
};
var View = Object.create(TrackedComponent, {
"_registryKey": {
"value": "view",
"enumerable": true,
"writable": false,
"configurable": false
}
});
View.create = function() {
var view = Object.create(this);
view.setID();
return view;
};
var TileView = Object.create(View, {
"_type": {
"value": "tile",
"enumerable": true
}
});
var tv = TileView.create();
tv.getID(); // "view-tile"
Or something along those lines. Working with the language's native design limits instead of imposing a different paradigm on top should ultimately make it easier to abstract and deal with. There are presently notable performance penalties when using Object.create
, so watching enhancements in this arena would help indicate when to start making the move.
Browse an Exhibit. Leave it in a non-vanilla state (state "A") by visiting another site. Come back to the Exhibit and do some more browsing within it, then try to go back to state "A" using the back button. It will fail to go all the way back, stopping at state "A"+1 and not showing state "A" before moving farther back past it to the external site.
Use the bit.ly API with CORS in advanced browsers to generate a short URL for bookmarked permalinks.
The Exporter as implemented loops through the database to gather items into a collection, then loops through the items to export each one. Try to combine them to save cycles.
The files in the demos directory currently link to a specific release (http://api.simile-widgets.org/exhibit/3.0.0rc1/exhibit-api.js). For testing (and futureproofing) would it be better to use relative links to the accompanying scripts in the same repository? e.g. "../../dist/exhibit-api.js" or "../../src/exhibit-api.js"? For development purposes, the ideal would probably to link to the src directory with bundle=false, so people can directly test against their changes to the code. The bundles won't be available in src, but that seems less problematic for testers.
Like the Timeline View, the Map View should have a configuration setting for which property items take their title from.
Extend the now-working bundle and compression tasks to styling and extensions. (Edit: no longer related to how #22 shakes out.)
This has been ignored lately; go back and address any new jslint complaints.
The failure occurs in firefox 10. Visit the nobelists example in the demos directory. In the viewpanel, select the timeline view. Reload a few times. Intermittently, the reloaded page will fail to render it view; apparently the history (saying the timeline view is selected) is persisting over the reload and exhibit is attempting to invoke the timeline view before it has been fully loaded or initialized by the reload. In particular, at the time of invocation Timline.DefaultEventSource is undefined, so the following error is thrown:
Error: Timeline.DefaultEventSource is not a constructor
Source File: http://api.simile-widgets.org/exhibit/3.0.0rc1/extensions/time/time-extension-bundle.js
Line: 1
Take the current Exhibit templating language and map it into HTML5, reusing HTML5 attributes as appropriate.
When clicking the link generated for a property of type "Item" in the Tabular View, the generated pop-up to show the linked item details is referencing a number of static image files that can't be found (404):
(From Chrome developer console)
GET http://api.simile-widgets.org/exhibit/images/bubble-top-left.png 404 (Not Found)
GET http://api.simile-widgets.org/exhibit/images/bubble-top-right.png 404 (Not Found)
GET http://api.simile-widgets.org/exhibit/images/bubble-bottom-left.png 404 (Not Found)
GET http://api.simile-widgets.org/exhibit/images/bubble-left.png 404 (Not Found)
GET http://api.simile-widgets.org/exhibit/images/bubble-right.png 404 (Not Found)
GET http://api.simile-widgets.org/exhibit/images/bubble-bottom-right.png 404 (Not Found)
GET http://api.simile-widgets.org/exhibit/images/bubble-top.png 404 (Not Found)
GET http://api.simile-widgets.org/exhibit/images/close-button.png 404 (Not Found)
GET http://api.simile-widgets.org/exhibit/images/bubble-arrow-point-down.png 404 (Not Found)
GET http://api.simile-widgets.org/exhibit/images/bubble-bottom.png 404 (Not Found)
There is then no way to close the "naked" pop-up window without refreshing the page. You get the same behavior with the default lens for a linked item and a custom lens (div[ex:role="lens]) defined within the table view
Some class names generated on rendered exhibit elements are extremely specific, e.g exhibit-tabularView-body and exhibit-thumbnailView-itemContainer . This will make it hard to e.g. change one's mind about which view to use without also going back and changing css. I think it would help to use more generic classnames, e.g. exhibit-viewBody and exhibit-itemContainer, to be used in addition to or instead of the more specific classes (note that if for example the containing view received class exhibit-thumbnailView, then instead of exhibit-thumbnailView-itemContainer I could use the selector exhibit-thumbnailView > exhibit-itemContainer).
If this issue is accepted/approved then I will keep in mind to make such changes as I do other work on the code.
Remove Timeline's dependence on SimileAjax, update its usage of jQuery, and modify its loading method to use LABjs.
Exhibit.Backwards.Attributes.getAttribute expects a single DOM element as its first argument. Instead it is receiving a jquery object and breaking. The problem starts from
Exhibit._Impl.prototype.configureFromDOM which invokes
panel = Exhibit.ControlPanel.createFromDOM(
$("
the first (jquery object) argument is passed to getConfigurationFromDOM which passes it to Exhibit.Backwards.Attributes.getAttribute which breaks.
This is a low priority feature. Explore what it would take to allow users to add extension functions to the expression language so they can work with returned results at a lower level than the templating language currently allows.
One of the facets I use myself is the cloud facet.
I wanted to get my feet wet, so I tried a port, like so:
I started off with a three way merge of the exhibit 2 list-facet.js, cloud-facet.js and the 3 list-facet.js. That got me pretty far, then I had to port over import- and exportState and stateDiffers stuff, and replace a bit of SimileAjax. Found that createDOMFromString(...) is now $.simileDOM("string", ...).
I don't know how to really create tests for facets, so I just created a small demo for the cloud facet to check that it does what I expect it to. Not sure if I caught all changes.
When an exhibit includes any link to a nonexistent data file, even if other links are good, E3 issues a relatively opaque "uncaught exception: Not Found" message in the error console. Adding the faulty URL would be nice. More importantly, this kind of "fail fast" is good for programmers but I don't think it's ideal for non-users. I suggest that we take a lesson from the browser, which tries to proceed if e.g. it fails to load a script or an image. Exhibit should try to load any other data files, render the exhibit, etc. This will give the naive user more information about what's gone wrong, and may also produce something useful-though-imperfect. Summarizing: we should issue warning, not throw errors, for these kind of non-fatal issues.
See an example at http://people.csail.mit.edu/karger/Exhibit3/demos/nobelists/broken-nobelists.html
Consider using HTML5 microdata built-ins as a way to extract data from within the page and also as an export mechanism.
Incorporate the map view extension.
Add a Timeline view, also to Backstage, to see what's needed for more complicated views.
The amount of code required to do resizable facets is quite large, potentially try to find a way to cut it down.
Either way, bring the feature back.
Using jslint's preference for !== means former checks for != null also need to be expanded to verify the typeof isn't undefined.
jslint also doesn't like in, which was initially replaced with hasOwnProperty, but should really just be checking for typeof undefined.
when I have a table within a table (in one cell), exhibit seems to insert and either before or after the table.
Exhibit wraps it in a adds another empty one either before or after this span and puts an 'and' in between.
This should be configurable and one should be able to turn this off.
Pagination is broken:
The senate demo, when switching to tiles view throws errors.
Removing the "ex:paginate="true" makes tiles view work again.
The same error happens when I try to paginate my exhibit view.
Uncaught TypeError: Cannot call method 'bind' of undefined
fexhibit-scripted-bundle.js:1
Exhibit.Debug.exceptionexhibit-scripted-bundle.js:1
Exhibit.ViewPanel._createViewexhibit-scripted-bundle.js:1
Exhibit.ViewPanel._switchViewexhibit-scripted-bundle.js:1
Exhibit.ViewPanel.importStateexhibit-scripted-bundle.js:1
Exhibit.History.stateListenerexhibit-scripted-bundle.js:1
f.event.dispatchjquery-1.7.1.min.js:3
f.event.add.h.handle.ijquery-1.7.1.min.js:3
f.event.triggerjquery-1.7.1.min.js:3
f.fn.extend.triggerjquery-1.7.1.min.js:3
e.extend.eachjquery-1.7.1.min.js:2
e.fn.e.eachjquery-1.7.1.min.js:2
f.fn.extend.triggerjquery-1.7.1.min.js:3
c.Adapter.triggerjquery.history.js:1
m.initCore.m.onPopStatejquery.history.js:1
f.event.dispatchjquery-1.7.1.min.js:3
f.event.add.h.handle.ijquery-1.7.1.min.js:3
f.event.triggerjquery-1.7.1.min.js:3
f.fn.extend.triggerjquery-1.7.1.min.js:3
e.extend.eachjquery-1.7.1.min.js:2
e.fn.e.eachjquery-1.7.1.min.js:2
f.fn.extend.triggerjquery-1.7.1.min.js:3
c.Adapter.triggerjquery.history.js:1
m.initCore.m.pushStatejquery.history.js:1
Exhibit.History.pushStateexhibit-scripted-bundle.js:1
Exhibit.History.pushComponentStateexhibit-scripted-bundle.js:1
Exhibit.ViewPanel._selectViewexhibit-scripted-bundle.js:1
(anonymous function)exhibit-scripted-bundle.js:1
dom.setViewIndex.handlerexhibit-scripted-bundle.js:1
f.event.dispatchjquery-1.7.1.min.js:3
f.event.add.h.handle.i
Exhibit3 is currently providing a scriptLoaded.exhibit event that is triggered after all exhibits scripts have loaded. But someone who needs to listen on that event has to use jquery to specify a listener.on('scriptsLoaded.exhibit'). Since jquery is one of the scripts exhibit loads, this makes it impossible to specify a listener for the event until after the event has triggered!
An easy fix would be to include an Exhibit.ready() method in exhibit-api.js that accepts functions and adds them as listeners to scriptsLoaded.exhibit after exhibit-api.js loads jquery.
Popup dialogs should be closed when a click is registered anywhere outside its DOM rectangle but aren't. Track down the reason and fix.
Try out using jQuery UI with Exhibit. As jQuery UI is a modular download and has produced a bad taste in other projects, I'm not certain it's a good fit, but it's worth checking out to see if what it simplifies (dialogs, resizing, theming) can help make Exhibit simpler for end users.
E2 used eval to parse its exhibit/data files while E3 uses the stricter JSON.Parse. This will be a source of breakage if people try to switch to using exhibit 3. For example in E2 property names in the data file need not be quoted while in E3 they must. Should E3 back-off and try more relaxed parsing if JSON.Parse fails? If not, there should be an entry about this incompatibility in the E2-->E3 upgrade guide (we have an E2-->E3 upgrade guide, right?)
The following importers have not yet been ported from Exhibit 2 to Exhibit 3:
They are not prioritized for the first major release but should mostly be very straightforward to convert. The HTML Table may be slightly more complex as it relies on Babel, but not in the way other Babel-based importers do. RDFa import requires reliance on an external reference implementation from several years ago of RDFa parsing and, with different movement in this arena, is possibly irrelevant and probably stands best as an external extension.
Interested parties are welcome to look into porting and making pull requests for ports.
The scripted event api https://github.com/zepheira/exhibit3/wiki/Scripted-Event-API currently does not include an event triggered when someone changes the selection on a facet---only when they clear it.
that the tracknum option works similar to timeline v2.3?
Extract all of the strings sitting around in various code files. Replace with a gettext-like strategy (any libraries?) so English strings can be keys for their localized translations and stand in as the default value.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.