Giter Club home page Giter Club logo

documentcloud-notes's Introduction

This is the repository for the legacy DocumentCloud site, please see the current repository here:

https://github.com/muckrock/documentcloud

______                                      _   _____ _                 _
|  _  \                                    | | /  __ \ |               | |
| | | |___   ___ _   _ _ __ ___   ___ _ __ | |_| /  \/ | ___  _   _  __| |
| | | / _ \ / __| | | | '_ ` _ \ / _ \ '_ \| __| |   | |/ _ \| | | |/ _` |
| |/ / (_) | (__| |_| | | | | | |  __/ | | | |_| \__/\ | (_) | |_| | (_| |
|___/ \___/ \___|\__,_|_| |_| |_|\___|_| |_|\__|\____/_|\___/ \__,_|\__,_|

DocumentCloud is a catalog of primary source documents and a tool for annotating, organizing and publishing them on the web. Documents are contributed by journalists, researchers and archivists.

This codebase contains the entirety of DocumentCloud.org, and pulls together the rest of our open-source projects: Docsplit is used to extract data from incoming documents; that work is parallelized across CloudCrowd; data on the client-side is modeled by Backbone.js, which depends on Underscore.js for all of its abilities; Jammit concatenates and compresses the dozens of CSS and JS files into a single asset package; the NYTimes' Document Viewer displays the documents, while Pixel Ping records the traffic.

If you find a security issue while browsing the source, please email [email protected] to inform us of the problem.

Code contributed to this project is provided under the MIT license (see the LICENSE file). Some components of the project are subject to their own licenses as indicated (see /vendor and /public/javascripts/vendor directories).

documentcloud-notes's People

Contributors

aramology avatar freedmand avatar knowtheory avatar reefdog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

documentcloud-notes's Issues

Do less work when resizing

In the integration branch, scaleNote is called every time the window resize handler fires, regardless of whether the note needs to be rescaled/restyled.

Can this be made smarter, so that notes are not scaled unless the boundary conditions for how each note is displayed has been passed?

Embedding same note multiple times

Sprung from: documentcloud/documentcloud#19

Been chatting with @knowtheory about ways to allow this. Basically, we should be able to internally store a note model once and then reference it from multiple note views. Currently, there's a 1:1 relationship and so the last view instantiated is the only one who gets the note. (dc.embed.notes is keyed by note ID and points to a noteView, so you can't have multiple noteViews modeled on the same note.)

Goals:

  1. Make this work
  2. Make this work in a way that doesn't break existing integrations

Classifying this as a bug because there are many reasonably scenarios where a user would expect the same note to appear on the same page (e.g., index page for blog posts which each embed the same note).

Check for jQuery / Underscore before including

Noticed an issue when trying to embed notes on our article pages – they work, but cause a cascade of errors to the rest of the page with anything else that requires jQuery.

We assign jQuery.noConflict to a different global var ($j) when we call it, but since jQuery is also delivered via note_embed.js it reassigns, breaking other functions called by the footer (or anything that runs after the embed script does).

Could the vendor scripts be checked and called as part of the asset loader rather than minified into note_embed.js to avoid reassigning to the default global vars? While less common, I imagine this would also be an issue for sites that already call Underscore, but reassign to a different global var.

Modernize design

A step toward unification of the note embed code with components of the page embed code. Backwards-compatible with existing embed codes. This issue is mostly a stub for documenting existing API coverage and requirements.

Load paths

Application

Available at assets.documentcloud.org, s3.documentcloud.org, and s3.amazonaws.com/s3.documentcloud.org:

  • /notes/loader.js: Writes the following two to DOM
  • /note_embed/note_embed.js
  • /note_embed/note_embed.css

Data

  • www.documentcloud.org/documents/282753-lefler-thesis/annotations/53674.js: JSONP that wraps JSON in dc.embed.noteCallback() function

dc global structure

  • dc
    • embed
      • notes: Array of note views, keyed by note ID
      • loadNote(url, {id, container, afterLoad()})
      • noteCallback()
      • pingRemoteUrl()
      • noteModel()
      • noteView()
        • displayModes
        • displayNames
        • $()
        • setElement()
        • render()
        • cacheDomReferences()
        • checkAndSetWidth()
        • resize()

HTML structure:

  • .DC-note
    • .DC-note-contents
      • .DC-note-title
        • a.DC-title-link
          • .DC-page-number
      • .DC-note-draft-label
      • .DC-icon
      • a
        • .DC-note-excerpt-wrap
          • .DC-note-excerpt
            • .DC-left-cover
            • .DC-right-cover
            • .DC-note-image
      • .DC-note-text

note images get clobbered when max-width is set to anything other than 'none'

One of the consequences of writing things into someone else's DOM is sharing their CSS rules.

We need our note images to have a max-width and max-height set to none or else our width and positioning calculations end up coming out wrong.

Due to selector specificity (a page may use an ID on an element, and note embeds can't use IDs to override their specificity), i suspect we don't have any choice except to inline those directives.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.