From 26c62fba4bfdd17b8677a7af635cbfc2087111ac Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 31 Dec 2006 14:32:13 +0000 Subject: [PATCH] Addresses #400, Report generation CSS updates from Jeremy with some streamlining by me (consistency of print style, removal of unnecessary lines, and some other fixes) Changed doctype to XHTML 1.0 Strict from 1.1 Adding /html/report.html to end of URL to provide a filename hint for Firefox (instead of the file being called 12345-34567-84573-42632.xhtml) --- chrome/content/zotero/reportInterface.js | 8 +- chrome/content/zotero/xpcom/report.js | 9 +- chrome/skin/default/zotero/report/detail.css | 120 ++++++------------ .../default/zotero/report/detail_print.css | 45 ++++--- .../default/zotero/report/detail_screen.css | 42 ++++++ 5 files changed, 113 insertions(+), 111 deletions(-) create mode 100644 chrome/skin/default/zotero/report/detail_screen.css diff --git a/chrome/content/zotero/reportInterface.js b/chrome/content/zotero/reportInterface.js index 7621078e9..9ea492e79 100644 --- a/chrome/content/zotero/reportInterface.js +++ b/chrome/content/zotero/reportInterface.js @@ -43,13 +43,13 @@ var Zotero_Report_Interface = new function() { } if (id) { - window.loadURI('zotero://report/collection/' + id + queryString); + window.loadURI('zotero://report/collection/' + id + '/html/report.html' + queryString); return; } var id = ZoteroPane.getSelectedSavedSearch(true); if (id) { - window.loadURI('zotero://report/search/' + id + queryString); + window.loadURI('zotero://report/search/' + id + '/html/report.html' + queryString); return; } @@ -67,7 +67,7 @@ var Zotero_Report_Interface = new function() { throw ('No items currently selected'); } - window.loadURI('zotero://report/items/' + items.join('-')); + window.loadURI('zotero://report/items/' + items.join('-') + '/html/report.html'); } @@ -79,6 +79,6 @@ var Zotero_Report_Interface = new function() { throw ('No itemIDs provided to loadItemReportByIds()'); } - window.loadURI('zotero://report/items/' + ids.join('-')); + window.loadURI('zotero://report/items/' + ids.join('-') + '/html/report.html'); } } diff --git a/chrome/content/zotero/xpcom/report.js b/chrome/content/zotero/xpcom/report.js index bfee7a647..ad914046e 100644 --- a/chrome/content/zotero/xpcom/report.js +++ b/chrome/content/zotero/xpcom/report.js @@ -35,12 +35,13 @@ Zotero.Report = new function() { var ZU = new Zotero.Utilities(); var escapeXML = ZU.htmlSpecialChars; - var content = '\n'; + var content = '\n'; content += '\n'; content += '\n'; content += '' + Zotero.getString('report.title.default') + '\n'; content += '\n'; + content += '\n'; content += '\n'; content += '\n\n'; @@ -48,7 +49,7 @@ Zotero.Report = new function() { for each(var arr in items) { //Zotero.debug(arr); - content += '
  • \n'; + content += '
  • \n'; // Title if (arr.title) { @@ -257,7 +258,7 @@ Zotero.Report = new function() { } - content += '
  • \n'; + content += '\n'; } content += '\n'; content += '\n'; diff --git a/chrome/skin/default/zotero/report/detail.css b/chrome/skin/default/zotero/report/detail.css index ad2fc9047..8d38bf0cf 100644 --- a/chrome/skin/default/zotero/report/detail.css +++ b/chrome/skin/default/zotero/report/detail.css @@ -1,110 +1,70 @@ -/* Fonts */ -li, li > p { - font-family: Georgia, Times New Roman, Times, serif; - font-size: .95em; -} -h2 { - font-size: 1.3em; - margin: .4em 0; -} -h3 { - font-size: 1.05em; -} -th, td { - font-size: .95em; -} - -ul { - margin: 0; +body { padding: 0; } -ul li { - list-style: none; + +ul.report li.item { + border-top: 4px solid #555; + padding-top: 1em; + padding-left: 1em; + padding-right: 1em; + margin-bottom: 2em; } +h1, h2, h3, h4, h5, h6 { + font-weight: normal; +} -/* Line between items */ -ul.report > li { +h2 { + margin: 0 0 .75em; + padding: 0 0 0.25em; + border-bottom: 1px solid #ccc; +} + +h3 { + margin-bottom: .5em; + font-weight: bold !important; + font-size: 1em; display: block; - border-bottom: 1px #333 solid; - padding: .95em 0; } -ul.report > li:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} -ul.report > li:first-child { - padding-top: 0; -} -ul.report > li:last-child { - border-bottom: none; -} - /* Metadata table */ -table { - border: 1px #ccc solid; - float: right; - width: 35%; - margin: .1em 0 .75em 1.5em; - padding: .2em .3em; - background: #fff; -} th { vertical-align: top; text-align: right; - padding-right: .1em; + width: 15%; white-space: nowrap; } -th:after { - content: ':'; + +td { + padding-left: .5em; } -/* Tags and child notes */ -ul ul { - padding: 0 .5em; +ul { + list-style: none; + margin-left: 0; + padding-left: 0; } -h3 { - margin-bottom: .4em; -} -h3:after { - content: ':'; -} - /* Display tags as comma-separated lists */ +ul.tags { + line-height: 1.75em; + list-style: none; +} + ul.tags li { display: inline; } + ul.tags li:not(:last-child):after { content: ', '; } - -/* Child notes */ -ul.notes { - margin-left: 1em; -} -ul.notes li { - display: inline; -} -ul.notes li:first-child p:first-child { - margin-top: 1em; -} -ul.notes li p:first-child { - margin-top: .7em; - display: list-item; - list-style: square outside; -} - +/* Preserve whitespace on notes */ ul.notes li p, li.note p { - white-space: pre-wrap; /* css-3 */ + white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ } diff --git a/chrome/skin/default/zotero/report/detail_print.css b/chrome/skin/default/zotero/report/detail_print.css index 8cb90e3e2..26088fd7e 100644 --- a/chrome/skin/default/zotero/report/detail_print.css +++ b/chrome/skin/default/zotero/report/detail_print.css @@ -1,27 +1,26 @@ +body { + font: 12pt "Times New Roman", Times, Georgia, serif; + margin: 0; + width: auto; + color: black; +} + +/* Page Breaks (page-break-inside only recognized by Opera) */ +h1, h2, h3, h4, h5, h6 { + page-break-after: avoid; + page-break-inside: avoid; +} + +ul, ol, dl { + page-break-inside: avoid; +} + +h2 { + font-size: 1.3em; + line-height: 1.3em; +} + a { color: #000; text-decoration: none; } - - -/* - * Firefox gets funky with floated elements that span two pages, so we pretend we're a table - */ -ul.report { - display: table; -} - -ul.report > li { - display: table-row; - page-break-inside: avoid; /* Waiting on https://bugzilla.mozilla.org/show_bug.cgi?id=132035 */ -} - -ul.report > li > span { - display: table-cell; - border-bottom: 1px solid #000; /* Normal
  • border disappears in table mode */ - padding: .95em 0; -} - -ul.report > li:last-child > span { - border-bottom: none; -} diff --git a/chrome/skin/default/zotero/report/detail_screen.css b/chrome/skin/default/zotero/report/detail_screen.css new file mode 100644 index 000000000..42738164f --- /dev/null +++ b/chrome/skin/default/zotero/report/detail_screen.css @@ -0,0 +1,42 @@ +/* Generic styles */ +body { + font: 62.5% Georgia, Times, serif; + width: 780px; + margin: 0 auto; +} + +h2 { + font-size: 1.5em; + line-height: 1.5em; + font-family: Georgia, Times, serif; +} + +p { + line-height: 1.5em; +} + +a:link, a:visited { + color: #900; +} + +a:hover, a:active { + color: #777; +} + + +ul.report { + font-size: 1.4em; + width: 680px; + margin: 0 auto; + overflow: auto; + padding: 20px 20px; +} + +/* Metadata table */ +table { + border: 1px #ccc solid; + overflow: auto; + width: 100%; + margin: .1em auto .75em; + padding: 0.5em; +}