From bcf903a33553e9c03f3f9eb72d27c7018643de7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Norman=20Hauk=C3=A5s?= Date: Sat, 26 Sep 2015 21:42:56 +0200 Subject: [PATCH] tweaked menu prototype. Added css. --- content_script.js | 42 ++++++++++++++++++++---------------------- prototype-menu.html | 31 +++++++++++++++++++++++-------- style.css | 7 +++++++ 3 files changed, 50 insertions(+), 30 deletions(-) create mode 100644 style.css diff --git a/content_script.js b/content_script.js index b7a38f1..a824626 100644 --- a/content_script.js +++ b/content_script.js @@ -14,7 +14,26 @@ $(document).ready(function () { var sel = window.getSelection(); var selectedText = sel.toString(); } - console.log(selectedText); + if (selectedText == false) { + return; + } else { + createPopover(document.activeElement, selectedText); + } + } + + function createPopover(element, content) { + console.log('createPopover'); + + $(document.activeElement).append('test'); + + $(document.activeElement).popover({ + title: "Please select a semantic tag", + content: 'say something', + html: true, + placement: 'auto' + }); + + $(document.activeElement).popover('show'); } document.addEventListener('click', function(evt) { @@ -26,25 +45,4 @@ $(document).ready(function () { // evt.preventDefault(); }, false); - // var popoverContent; - - // $.get('test-menu-content.html', function (data) { - // popoverContent = data; - // contentReady(); - // }); - - // function contentReady () { - // $('.selected').popover({ - // title: "Please select a semantic tag", - - // content: popoverContent, - - // html: true, - - // placement: 'auto' - - // }); - - // $('.selected').popover('show'); - // } }); \ No newline at end of file diff --git a/prototype-menu.html b/prototype-menu.html index 6add655..87f9c16 100644 --- a/prototype-menu.html +++ b/prototype-menu.html @@ -3,17 +3,33 @@ Prototype page mockup + - -
-
-

Testing ground

-

The Triumph of Cleopatra, also known as Cleopatra's Arrival in Cilicia[1] and The Arrival of Cleopatra in Cilicia,[2] is an oil painting by English artist William Etty. It was first exhibited in 1821, and is now in the Lady Lever Art Gallery in Port Sunlight across the River Mersey from Liverpool. During the 1810s Etty had become widely respected among staff and students at the Royal + + +

+

Add a tag

+ + + +
    +
  • Conscientious objector: A conscientious objector (CO) is an "individual who has claimed the right to refuse to perform military service" on the grounds of freedom
  • + +
  • Irish War of Independence: The Irish War of Independence (Irish: Cogadh na Saoirse), Anglo-Irish War, Black and Tan War, or Tan War was a guerrilla war mounted by the Irish Republican Army (IRA) against the British government and its forces in Ireland.
  • + +
  • Flag of the United States: The national flag of the United States of America, often simply referred to as the American flag, consists of thirteen equal horizontal stripes of red (top and bottom) alternating with white, with a blue rectangle in the canton
  • +
+
+ +
+

Testing ground

+ +

The Triumph of Cleopatra, also known as Cleopatra's Arrival in Cilicia[1] and The Arrival of Cleopatra in Cilicia,[2] is an oil painting by English artist William Etty. It was first exhibited in 1821, and is now in the Lady Lever Art Gallery in Port Sunlight across the River Mersey from Liverpool. During the 1810s Etty had become widely respected among staff and students at the Royal Academy of Arts, in particular for his use of colour and ability to paint realistic flesh tones. Despite having exhibited at every Summer Exhibition since 1811 he attracted little commercial or critical interest. In 1820 he exhibited The Coral Finder, which showed nude figures on a gilded boat. This painting attracted the attention of Sir Francis Freeling, who commissioned a similar painting on a more ambitious scale.

@@ -22,6 +38,5 @@
Yet another weird text.
-
- - \ No newline at end of file + + \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..7ed4bec --- /dev/null +++ b/style.css @@ -0,0 +1,7 @@ +.u-add-margin-top { + margin-top: 20px; +} + +.tagit-selection-menu ul { + padding-left: 15px; +} \ No newline at end of file