"a witticism," 1712, from French, from jeu "play, game," from Latin jocum "jest, joke, play, sport" (see joke (n.)).
1825, "drawer or box where things are heaped together in a disorderly manner." The first element probably is a variant of Scottish glaur "to make muddy, dirty, defile" (Middle English glorien, mid-15c.), which is perhaps from Old Norse leir "mud." Hence, in nautical use, "a small room between decks," and, in mining, "large opening or pit." Meaning "opening through which the interior of a furnace may be seen and reached" (originally in glassblowing) is from 1849, probably from glory (n.), which had developed a sense of "circle or ring of light" by 1690s. Sexual (originally homosexual) sense from 1940s.
"unkempt; having rough, coarse, long hair," 1580s, from shag (n.) + -y (2). Related: Shaggily; shagginess. Earlier was shagged, from Old English sceacgede "hairy;" compare Old Norse skeggjaðr, Danish skægget "bearded." The shaggy-dog story as a type of absurd joke built into a long, tedious story, is attested from 1943 and was a fad in the mid-40s. The origin of the phrase may be in vaudeville; the most-often cited original example involves an Englishman who offers a reward for a lost shaggy dog, an enterprising American who, with great difficulty, tracks him down and offers a shaggy dog that he claims is the one, and his curt reception: "Not that shaggy." But the story does not seem to be older than the phrase.